Skip to content

Commit

Permalink
Update e2e test actions and selectors
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Mar 3, 2022
1 parent a1920f2 commit c366a96
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions packages/e2e-test-utils/src/site-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,32 @@ export async function closeSiteEditorNavigationPanel() {
* Skips the welcome guide popping up to first time users of the site editor
*/
export async function disableSiteEditorWelcomeGuide() {
const isWelcomeGuideActive = await page.evaluate( () =>
wp.data.select( 'core/edit-site' ).isFeatureActive( 'welcomeGuide' )
const isWelcomeGuideActive = await page.evaluate(
() =>
!! wp.data
.select( 'core/preferences' )
.get( 'core/edit-site', 'welcomeGuide' )
);
const isWelcomeGuideStyesActive = await page.evaluate( () =>
wp.data
.select( 'core/edit-site' )
.isFeatureActive( 'welcomeGuideStyles' )
const isWelcomeGuideStyesActive = await page.evaluate(
() =>
!! wp.data
.select( 'core/preferences' )
.get( 'core/edit-site', 'welcomeGuideStyles' )
);

if ( isWelcomeGuideActive ) {
await page.evaluate( () =>
wp.data.dispatch( 'core/edit-site' ).toggleFeature( 'welcomeGuide' )
wp.data
.dispatch( 'core/preferences' )
.toggle( 'core/edit-site', 'welcomeGuide' )
);
}

if ( isWelcomeGuideStyesActive ) {
await page.evaluate( () =>
wp.data
.dispatch( 'core/edit-site' )
.toggleFeature( 'welcomeGuideStyles' )
.dispatch( 'core/preferences' )
.toggle( 'core/edit-site', 'welcomeGuideStyles' )
);
}
}
Expand Down

0 comments on commit c366a96

Please sign in to comment.