-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Remove duplicate views: Fix Page Basic Flow E2E test #98607
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
This PR does not affect the size of JS and CSS bundles shipped to the user's browser. Generated by performance advisor bot at iscalypsofastyet.com. |
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.
Looks ok to me. 👍
await Promise.all( [ | ||
this.page.waitForNavigation(), | ||
this.page | ||
.getByRole( 'link', { name: /Add New Page/ } ) | ||
.first() | ||
.click(), | ||
this.page.waitForNavigation( { url: /post-new.php\?post_type=page/, timeout: 20 * 1000 } ), | ||
locator.click( { timeout: 20 * 1000 } ), | ||
] ); |
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.
I wonder if we could improve the timeout situation by doing like this instead.
await this.page.waitForNavigation( { url: /post-new.php\?post_type=page/, timeout: 20 * 1000 } );
await locator.click( { timeout: 20 * 1000 } );
I think that way it won't start the timer for the click until after the page is navigated to, instead of starting both timers at the same time.
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.
waitForNavigation
does not navigate to a different page, it only introduces a blocker until the URL changes. It's the click action what produces the navigation.
So if we wanted to have a sequence, it should be the other way around:
// Navigate to "Add New Page"
await locator.click( { timeout: 20 * 1000 } );
// Wait for "Add New Page" to be loaded
await this.page.waitForNavigation( { url: /post-new.php\?post_type=page/, timeout: 20 * 1000 } );
The two are intrinsically related, so I think it makes sense to group them in the same promise.
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.
TIL, thanks!
See p1737384275008899-slack-C034JEXD1RD
Proposed Changes
Updates the logic to click on the "Add New Page" button for the Page Basic Flow E2E test since apparently it was broken when we started the "Remove duplicate views" experiment
Why are these changes being made?
Because there is a broken e2e test
Testing Instructions
Run this locally:
Make sure the E2E test passes
Pre-merge Checklist