test: Delete site E2E case supports native dialogs - #186
Merged
wojtekn merged 4 commits intoMay 30, 2024
Conversation
Playwright lacks support for interacting with native dialogs, so we mock the dialog module to simulate the user clicking the "Delete site" confirmation button with "Delete site files from my computer" checked. See: microsoft/playwright#2143 See: microsoft/playwright#8278 (comment)
Combine `toBeVisible`'s interval with the ability to assert the precence of one of multiple elements to ensure the UI is ready before conditionally proceeding with the onboarding steps. This reduces the likelihood that the UI is not ready when the test interactions begin and also allows the Sites tests to succeed regardless of whether sites already exists when the tests begin to run.
dcalhoun
commented
May 29, 2024
Comment on lines
-8
to
-9
| // This fails, not sure why... | ||
| // return this.page.getByTestId( 'onboarding' ); |
Member
Author
There was a problem hiding this comment.
My guess is that the unexpected failure may have related to attempting queries before the UI was visible. With the new approach proposed in these changes, the original query appears to work consistently.
|
|
||
| get continueButton() { | ||
| return this.locator.getByRole( 'button', { name: 'Continue' } ); | ||
| return this.locator.getByRole( 'button', { name: 'Add site' } ); |
| const sidebar = new MainSidebar( onboardingMainWindow ); | ||
|
|
||
| // Await UI visibility before proceeding. | ||
| await expect( onboarding.heading.or( sidebar.addSiteButton ) ).toBeVisible(); |
Member
Author
There was a problem hiding this comment.
By relying upon toBeVisible's interval-based query and the or query, this approach should guarantee the app UI is visible before proceeding with interactions.
dcalhoun
marked this pull request as ready for review
May 29, 2024 19:37
derekblank
approved these changes
May 30, 2024
Contributor
|
@dcalhoun changes look good and work fine. It caught me at first as I couldn't make e2e work locally today, either in this branch or trunk. I noticed that Studio was using x64 binary, and then I realized I needed to clean |
wojtekn
approved these changes
May 30, 2024
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes https://github.com/Automattic/dotcom-forge/issues/7236.
Proposed Changes
support interactions with this OS UI.
Testing Instructions
N/A, no user-facing changes.
Pre-merge Checklist