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 waitForSelector calls in create-daml-app-tests #6253

Merged
merged 1 commit into from
Jun 8, 2020

Conversation

cocreature
Copy link
Contributor

waitForSelector returns immediately if the selector is already
present (which is documented). This means that the waitForSelector
after the second follow isn’t doing anything since we already waited
for after the first follow. waitForFunction seemed like the simplest
solution and doesn’t require patching the HTML which is a bit finnicky
in the compat tests.

changelog_begin
changelog_end

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

`waitForSelector` returns immediately if the selector is already
present (which is documented). This means that the waitForSelector
after the second follow isn’t doing anything since we already waited
for after the first follow. `waitForFunction` seemed like the simplest
solution and doesn’t require patching the HTML which is a bit finnicky
in the compat tests.

changelog_begin
changelog_end
Comment on lines +310 to +312
await page1.waitForFunction(
() => document.querySelectorAll(".test-select-following").length == 2
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Doesn't this make the length check below redundant?

   expect(followingList11).toHaveLength(2);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Kind of but it seemed reasonable to keep the assertion separate from the check for how long we wait. Otherwise this is easy to get lost during refactoring.

Comment on lines +271 to +273
await page2.waitForFunction(
() => document.querySelectorAll(".test-select-following").length == 2
);
Copy link
Contributor

Choose a reason for hiding this comment

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

waitForSelector returns immediately if the selector is already present (which is documented). ...

page2 is a separate result of newUiPage than page1. Do I understand correctly that the presence of .test-select-following on page1 influences the query on page2? How is that happening?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I’m not following, we waited on page2 before, we wait on page2 now.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, nevermind, I misread the description of the issue.

Copy link
Contributor

@aherrmann-da aherrmann-da left a comment

Choose a reason for hiding this comment

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

LGTM

@cocreature cocreature merged commit 5feab1b into master Jun 8, 2020
@cocreature cocreature deleted the create-daml-app-tests branch June 8, 2020 09:26
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