Skip to content

Commit

Permalink
Ensure that tests work with UI situation before 18.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
olaseni committed May 3, 2024
1 parent c9f3630 commit 43f81b9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/calypso-e2e/src/lib/pages/editor-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -706,10 +706,10 @@ export class EditorPage {
actionsArray.push( this.editorToolbarComponent.clickPublish() );

// Determine whether the post/page is yet to be published or the post/page
// is merely being updated.
// is merely being saved/updated.
// If not yet published, a second click on the EditorPublishPanelComponent
// is added to the array of actions.
if ( publishButtonText.toLowerCase() !== 'save' ) {
if ( ! [ 'save', 'update' ].includes( publishButtonText.toLowerCase() ) ) {
actionsArray.push( this.editorPublishPanelComponent.publish() );
}

Expand Down Expand Up @@ -772,7 +772,10 @@ export class EditorPage {
await this.editorToolbarComponent.switchToDraft();
// @TODO: eventually refactor this out to a ConfirmationDialogComponent.
// Saves the draft
await this.editorToolbarComponent.clickPublish();
Promise.race( [
this.editorToolbarComponent.clickPublish(),
editorParent.getByRole( 'button' ).getByText( 'OK' ).click(),
] );
// @TODO: eventually refactor this out to a EditorToastNotificationComponent.
await editorParent.getByRole( 'button', { name: 'Dismiss this notice' } ).waitFor();
}
Expand Down

0 comments on commit 43f81b9

Please sign in to comment.