Wait for notice text to be visible instead of checking data store

This commit is contained in:
Thomas Roberts 2024-04-02 11:42:36 +01:00
parent b47ddcceab
commit f26892a646
No known key found for this signature in database
GPG Key ID: 0262BEBCBE336365
1 changed files with 6 additions and 11 deletions

View File

@ -33,17 +33,12 @@ export class LocalPickupUtils {
async saveLocalPickupSettings() {
await this.page.getByRole( 'button', { name: 'Save changes' } ).click();
await this.page.waitForFunction( () => {
return window.wp.data
.select( 'core/notices' )
.getNotices()
.some(
( notice: Notice ) =>
notice.status === 'success' &&
notice.content ===
'Local Pickup settings have been saved.'
);
} );
// Wait for the snackbar to appear with the success notice showing.
await this.page
.getByLabel( 'Dismiss this notice' )
.getByText( 'Local Pickup settings have been saved.' )
.isVisible();
}
async enableLocalPickup() {