From 31ecd501c1990a89dffae572316cb0e05c5d0c97 Mon Sep 17 00:00:00 2001 From: Daniel Richards Date: Mon, 23 Aug 2021 11:06:36 +0800 Subject: [PATCH] Update e2e test --- .../e2e-test-utils/src/click-on-more-menu-item.js | 2 +- packages/e2e-tests/experimental-features.js | 13 ------------- .../specs/experiments/site-editor-export.test.js | 8 ++++++-- 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/packages/e2e-test-utils/src/click-on-more-menu-item.js b/packages/e2e-test-utils/src/click-on-more-menu-item.js index 04d3709ac0e196..c52296040df513 100644 --- a/packages/e2e-test-utils/src/click-on-more-menu-item.js +++ b/packages/e2e-test-utils/src/click-on-more-menu-item.js @@ -16,7 +16,7 @@ import { toggleMoreMenu } from './toggle-more-menu'; export async function clickOnMoreMenuItem( buttonLabel ) { await toggleMoreMenu(); const moreMenuContainerSelector = - '//*[contains(concat(" ", @class, " "), " edit-post-more-menu__content ")]'; + '//*[contains(concat(" ", @class, " "), " interface-more-menu-dropdown__content ")]'; const elementToClick = first( await page.$x( `${ moreMenuContainerSelector }//span[contains(concat(" ", @class, " "), " components-menu-item__item ")][contains(text(), "${ buttonLabel }")]` diff --git a/packages/e2e-tests/experimental-features.js b/packages/e2e-tests/experimental-features.js index bcc6c3da8c8432..e920ee7114db87 100644 --- a/packages/e2e-tests/experimental-features.js +++ b/packages/e2e-tests/experimental-features.js @@ -118,19 +118,6 @@ export const siteEditor = { ); }, - async clickOnMoreMenuItem( buttonLabel ) { - await this.toggleMoreMenu(); - const moreMenuContainerSelector = - '//*[contains(concat(" ", @class, " "), " edit-site-more-menu__content ")]'; - const elementToClick = ( - await page.$x( - `${ moreMenuContainerSelector }//span[contains(concat(" ", @class, " "), " components-menu-item__item ")][contains(text(), "${ buttonLabel }")]` - ) - )[ 0 ]; - - await elementToClick.click(); - }, - async getEditedPostContent() { return page.evaluate( async () => { const postId = window.wp.data diff --git a/packages/e2e-tests/specs/experiments/site-editor-export.test.js b/packages/e2e-tests/specs/experiments/site-editor-export.test.js index 961a19525c6a23..e97bc3b99e4642 100644 --- a/packages/e2e-tests/specs/experiments/site-editor-export.test.js +++ b/packages/e2e-tests/specs/experiments/site-editor-export.test.js @@ -8,7 +8,11 @@ import os from 'os'; /** * WordPress dependencies */ -import { trashAllPosts, activateTheme } from '@wordpress/e2e-test-utils'; +import { + clickOnMoreMenuItem, + trashAllPosts, + activateTheme, +} from '@wordpress/e2e-test-utils'; /** * Internal dependencies @@ -52,7 +56,7 @@ describe( 'Site Editor Templates Export', () => { downloadPath: directory, } ); - await siteEditor.clickOnMoreMenuItem( 'Export' ); + await clickOnMoreMenuItem( 'Export' ); const filePath = path.join( directory, 'edit-site-export.zip' ); await waitForFileExists( filePath ); expect( fs.existsSync( filePath ) ).toBe( true );