Skip to content

Commit

Permalink
Update e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Aug 23, 2021
1 parent b659662 commit 31ecd50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion packages/e2e-test-utils/src/click-on-more-menu-item.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 }")]`
Expand Down
13 changes: 0 additions & 13 deletions packages/e2e-tests/experimental-features.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 );
Expand Down

0 comments on commit 31ecd50

Please sign in to comment.