Fix flaky visitTemplateEditor util

This commit is contained in:
Bart Kalisz 2024-03-19 16:37:37 +01:00
parent 7d252716e8
commit 227336f265
1 changed files with 6 additions and 3 deletions

View File

@ -205,12 +205,12 @@ export class EditorUtils {
}
async enterEditMode() {
await this.editor.page
await this.page
.getByRole( 'button', {
name: 'Edit',
exact: true,
} )
.dispatchEvent( 'click' );
.click();
await this.page.locator( '.edit-site-layout__sidebar' ).waitFor( {
state: 'hidden',
@ -377,6 +377,8 @@ export class EditorUtils {
await this.page.goto(
`/wp-admin/site-editor.php?path=/${ templateType }/all`
);
await this.waitForSiteEditorFinishLoading();
const templateLink = this.page.getByRole( 'link', {
name: templateName,
exact: true,
@ -386,6 +388,8 @@ export class EditorUtils {
await this.page.goto(
`/wp-admin/site-editor.php?path=/${ templateType }`
);
await this.waitForSiteEditorFinishLoading();
const templateButton = this.page.getByRole( 'button', {
name: templateName,
exact: true,
@ -395,7 +399,6 @@ export class EditorUtils {
await this.enterEditMode();
await this.closeWelcomeGuideModal();
await this.waitForSiteEditorFinishLoading();
// Verify we are editing the correct template and it has the correct title.
const templateTypeName =