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(#8789): targets aggregates test is failing silently #8834

Merged
merged 12 commits into from
Feb 2, 2024

Conversation

garethbowen
Copy link
Member

@garethbowen garethbowen commented Jan 31, 2024

Description

#8789

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.

Comment on lines -370 to -372
validateCardField('Last updated', 'yesterday Clarissa');
validateCardField('what a target!', '40');
validateCardField('the most target', '50%');
Copy link
Member Author

Choose a reason for hiding this comment

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

The reason the tests were failing silently is these validations weren't being awaited. As soon as I added the await the test failed.

@@ -363,11 +363,17 @@ const exportContacts = async () => {
await (await exportButton()).click();
};

const getCardFieldInfo = async (label) => {
return {
label: await (await $(`.cell.${label} label`)).getText(),
Copy link
Member Author

Choose a reason for hiding this comment

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

This never worked. We didn't have a class for the label, and even if we did, we we using spaces in the label which would have broken this CSS selector completely.

Copy link
Contributor

@lorerod lorerod left a comment

Choose a reason for hiding this comment

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

Hi @garethbowen, thanks for fixing the e2e test. I left a suggestion, but it's not a blocker.

expect(card.label).to.equal(label);
expect(card.value).to.equal(value);
const validateCardFields = async (lastUpdated, firstTarget, secondTarget) => {
const fields = await contactsPage.getContactSummaryCardFields();
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to use text selectors for contact summary card fields?
And, validate the text directly instead of first getting the fields and then validating the text. Something similar to what @tatilepizs has done in common-enketo page objects.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oooh yes I like this. Initially I tried to keep the API as close as possible to the original, but seeing as it's only used in this one place I think I can change it to do whatever I like. Thanks for the prompt!

@garethbowen garethbowen merged commit 423cfd6 into master Feb 2, 2024
30 checks passed
@garethbowen garethbowen deleted the 8789-fix-target-aggregates-test branch February 2, 2024 11:31
This pull request was closed.
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.

2 participants