Blocks E2E: Fix template revert tests (#46373)
This commit is contained in:
parent
24bed48bb8
commit
7f6d21395e
|
@ -2,7 +2,7 @@
|
|||
* External dependencies
|
||||
*/
|
||||
import { Page } from '@playwright/test';
|
||||
import { Editor } from '@wordpress/e2e-test-utils-playwright';
|
||||
import { Editor, expect } from '@wordpress/e2e-test-utils-playwright';
|
||||
import { BlockRepresentation } from '@wordpress/e2e-test-utils-playwright/build-types/editor/insert-block';
|
||||
|
||||
/**
|
||||
|
@ -425,27 +425,24 @@ export class EditorUtils {
|
|||
}
|
||||
|
||||
async revertTemplateCustomizations( templateName: string ) {
|
||||
await this.page.getByPlaceholder( 'Search' ).fill( templateName );
|
||||
|
||||
const templateRow = this.page.getByRole( 'row' ).filter( {
|
||||
has: this.page.getByRole( 'link', {
|
||||
name: templateName,
|
||||
exact: true,
|
||||
} ),
|
||||
} );
|
||||
const resetButton = templateRow.getByRole( 'button', {
|
||||
name: 'Reset',
|
||||
} );
|
||||
const waitForReset = this.page
|
||||
const resetButton = templateRow.getByLabel( 'Reset', { exact: true } );
|
||||
const revertedNotice = this.page
|
||||
.getByLabel( 'Dismiss this notice' )
|
||||
.getByText( `"${ templateName }" reverted.` )
|
||||
.waitFor();
|
||||
|
||||
const waitForSavedLabel = this.page
|
||||
.getByRole( 'button', { name: 'Saved' } )
|
||||
.waitFor();
|
||||
.getByText( `"${ templateName }" reverted.` );
|
||||
const savedButton = this.page.getByRole( 'button', { name: 'Saved' } );
|
||||
|
||||
await resetButton.click();
|
||||
await waitForSavedLabel;
|
||||
await waitForReset;
|
||||
|
||||
await expect( revertedNotice ).toBeVisible();
|
||||
await expect( savedButton ).toBeVisible();
|
||||
}
|
||||
|
||||
async updatePost() {
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
Fix template revert tests where the template is unreachable due to pagination.
|
Loading…
Reference in New Issue