-
Notifications
You must be signed in to change notification settings - Fork 18
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
test: Delete site E2E case supports native dialogs #186
test: Delete site E2E case supports native dialogs #186
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.
// This fails, not sure why... | ||
// return this.page.getByTestId( 'onboarding' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
@@ -29,7 +25,7 @@ export default class Onboarding { | |||
} | |||
|
|||
get continueButton() { | |||
return this.locator.getByRole( 'button', { name: 'Continue' } ); | |||
return this.locator.getByRole( 'button', { name: 'Add site' } ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to match changes from #111.
const sidebar = new MainSidebar( onboardingMainWindow ); | ||
|
||
// Await UI visibility before proceeding. | ||
await expect( onboarding.heading.or( sidebar.addSiteButton ) ).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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 |
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