Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update lmp calculation to fix flaky test #9170

Merged
merged 1 commit into from
Jun 11, 2024
Merged

Conversation

Benmuiruri
Copy link
Contributor

@Benmuiruri Benmuiruri commented Jun 10, 2024

Description

The test /tests/e2e/default/contacts/contact-details.wdio-spec.js started being flaky on the CI as noted by #9155.

The initlal lmp calculation was const lmp = moment().subtract(3, 'months');
My initial hypothesis and investigation suggested the lmp value was varying depending on the date the test is run and how many days the previous 3 months had.

Therefore, the fix I came up with was to use a fixed date and then subtract a specific number of days so that lmp will always be 12 weeks.

Unfortunately, the test is still flaky.

  • The original const lmp = moment().subtract(3, 'months');fails by giving 13 weeks instead of the expected 12 weeks
  • The fix to use 👇, also fails giving 13 weeks instead of the expected 12 weeks
const fixedPregDate = moment('2024-06-03');
const lmp = fixedPregDate.subtract(84, 'days');

If you run any of the two above in master, the test fails.

The change made in this PR hopefully stabilises the test but @lorerod I welcome your thought on this

Code review checklist

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or e2e where appropriate
  • Internationalised: All user facing text
  • Backwards compatible: Works with existing data and configuration or includes a migration. Any breaking changes documented in the release notes.

Compose URLs

If Build CI hasn't passed, these may 404:

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@Benmuiruri Benmuiruri requested a review from lorerod June 10, 2024 12:11
Copy link
Member

@dianabarsan dianabarsan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is blocking me. Approving to get a green build on another branch.

@dianabarsan dianabarsan merged commit 9e90536 into master Jun 11, 2024
40 checks passed
@dianabarsan dianabarsan deleted the 9155-fix-test branch June 11, 2024 08:37
dianabarsan pushed a commit that referenced this pull request Jun 17, 2024
dianabarsan pushed a commit that referenced this pull request Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants