Skip to content

Commit

Permalink
E2E: Update Revisions editor tests and removing all actions menu item…
Browse files Browse the repository at this point in the history
… check (#92352)

* Remove revision menu item and all actions
* Update showRevisionButton target class to
  • Loading branch information
sejas authored and gabrielcaires committed Jul 22, 2024
1 parent f00d81e commit e56c21d
Showing 1 changed file with 5 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,8 @@ const selectors = {
section: ( name: string ) =>
`${ panel } .components-panel__body-title button:has-text("${ name }")`,

// Actions Button
allActionsButton: '.editor-all-actions-button',
viewRevisionsModalMenuItem: '.view-revisions-modal-button',
viewRevisionsMenuItem: '[role=menuitem]:has-text("View revisions")',

// Revisions (before 18.4.0)
showRevisionButton: '.editor-post-last-revision__panel', // Revision is a link, not a panel.
// Revisions (after 18.7.0)
showRevisionButton: '.editor-private-post-last-revision__button',

// Status & Visibility
visibilityButton: '.edit-post-post-visibility__toggle',
Expand Down Expand Up @@ -350,55 +345,17 @@ export class EditorSettingsSidebarComponent {
}
}

/* All Actions Dropdown */

/**
* Opens the All Actions dropdown
*/
async openAllActionsDropdown(): Promise< void > {
const editorParent = await this.editor.parent();
const locator = editorParent.locator( selectors.allActionsButton );
await locator.click();
}

/* Revisions */

/**
* Clicks on the View Revisions menu itme on the All Actions dropdown
*/
async showRevisionsViaActionsDropdown(): Promise< void > {
// Open the all actions dropdown menu
await this.openAllActionsDropdown();

const menuItem = envVariables.TEST_ON_ATOMIC
? selectors.viewRevisionsMenuItem
: selectors.viewRevisionsModalMenuItem;

// Click on the revisions menu item
const editorParent = await this.editor.parent();
const locator = editorParent.locator( menuItem );
await locator.click();
}

/**
* Clicks on the Revision button
* Opens the Revisions modal
* via summary button for Gutenberg 18.7.0
*/
async showRevisionsViaButton(): Promise< void > {
async showRevisions(): Promise< void > {
const editorParent = await this.editor.parent();
const locator = editorParent.locator( selectors.showRevisionButton );

await locator.click();
}

/**
* Opens the Revisions modal
* via button for Gutenberg < 18.6.0
* via actions dropdown for Gutenberg >= 18.6.0
*/
async showRevisions(): Promise< void > {
await Promise.race( [ this.showRevisionsViaActionsDropdown(), this.showRevisionsViaButton() ] );
}

/**
* Check a category checkbox for an article.
*
Expand Down

0 comments on commit e56c21d

Please sign in to comment.