CYS - E2E tests: restore the default theme (#46268)

* CYS - E2E tests: restore the default theme

* Add changefile(s) from automation for the following project(s): woocommerce

* add comment

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Luigi Teschio 2024-04-08 12:17:47 +02:00 committed by GitHub
parent 9f159f7141
commit 606bb5cf79
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 38 additions and 24 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Comment: CYS - E2E tests: restore the default theme

View File

@ -1,6 +1,6 @@
const { test: base, expect, request } = require( '@playwright/test' );
const { AssemblerPage } = require( './assembler/assembler.page' );
const { activateTheme } = require( '../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../utils/themes' );
const { setOption } = require( '../../utils/options' );
const ASSEMBLER_HUB_URL =
@ -47,8 +47,8 @@ test.describe( 'Store owner can view Assembler Hub for store customization', ()
} );
test.afterAll( async ( { baseURL } ) => {
// Reset theme back to twentynineteen
await activateTheme( 'twentynineteen' );
// Reset theme back to default.
await activateTheme( DEFAULT_THEME );
// Reset tour to visible.
await setOption(

View File

@ -2,7 +2,7 @@ const { test: base, expect, request } = require( '@playwright/test' );
const { AssemblerPage } = require( './assembler.page' );
const { CustomizeStorePage } = require( '../customize-store.page' );
const { activateTheme } = require( '../../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../../utils/themes' );
const { setOption } = require( '../../../utils/options' );
const test = base.extend( {
@ -50,7 +50,8 @@ test.skip( 'Assembler -> Color Pickers', () => {
'no'
);
await activateTheme( 'twentynineteen' );
// Reset theme back to default.
await activateTheme( DEFAULT_THEME );
await customizeStorePageObject.resetCustomizeStoreChanges(
baseURL
);

View File

@ -1,6 +1,6 @@
const { test: base, expect, request } = require( '@playwright/test' );
const { AssemblerPage } = require( './assembler.page' );
const { activateTheme } = require( '../../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../../utils/themes' );
const { setOption } = require( '../../../utils/options' );
const test = base.extend( {
@ -42,8 +42,8 @@ test.describe( 'Assembler -> Footers', () => {
'woocommerce_admin_customize_store_completed',
'no'
);
await activateTheme( 'twentynineteen' );
// Reset theme back to default.
await activateTheme( DEFAULT_THEME );
} catch ( error ) {
console.log( 'Store completed option not updated' );
}
@ -117,7 +117,9 @@ test.describe( 'Assembler -> Footers', () => {
.frameLocator( 'iframe' )
.locator( '.wc-blocks-footer-pattern' );
const expectedFooterClass = extractFooterClass( await footer.getAttribute( 'class' ) );
const expectedFooterClass = extractFooterClass(
await footer.getAttribute( 'class' )
);
await footer.click();
@ -135,7 +137,9 @@ test.describe( 'Assembler -> Footers', () => {
await page.goto( baseURL );
const selectedFooterClasses = await page.locator( 'footer div.wc-blocks-footer-pattern' ).getAttribute( 'class' );
const selectedFooterClasses = await page
.locator( 'footer div.wc-blocks-footer-pattern' )
.getAttribute( 'class' );
expect( selectedFooterClasses ).toContain( expectedFooterClass );
} );

View File

@ -1,6 +1,6 @@
const { test: base, expect, request } = require( '@playwright/test' );
const { AssemblerPage } = require( './assembler.page' );
const { activateTheme } = require( '../../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../../utils/themes' );
const { setOption } = require( '../../../utils/options' );
const test = base.extend( {
@ -43,7 +43,7 @@ test.describe( 'Assembler -> headers', () => {
'no'
);
await activateTheme( 'twentynineteen' );
await activateTheme( DEFAULT_THEME );
} catch ( error ) {
console.log( 'Store completed option not updated' );
}
@ -117,7 +117,9 @@ test.describe( 'Assembler -> headers', () => {
.frameLocator( 'iframe' )
.locator( '.wc-blocks-header-pattern' );
const expectedHeaderClass = extractHeaderClass( await header.getAttribute( 'class' ) );
const expectedHeaderClass = extractHeaderClass(
await header.getAttribute( 'class' )
);
await header.click();
@ -134,7 +136,9 @@ test.describe( 'Assembler -> headers', () => {
await waitResponse;
await page.goto( baseURL );
const selectedHeaderClasses = await page.locator( 'header div.wc-blocks-header-pattern' ).getAttribute( 'class' );
const selectedHeaderClasses = await page
.locator( 'header div.wc-blocks-header-pattern' )
.getAttribute( 'class' );
expect( selectedHeaderClasses ).toContain( expectedHeaderClass );
} );

View File

@ -1,7 +1,7 @@
const { test: base, expect, request } = require( '@playwright/test' );
const { AssemblerPage } = require( '../assembler.page' );
const { LogoPickerPage } = require( './logo-picker.page' );
const { activateTheme } = require( '../../../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../../../utils/themes' );
const { CustomizeStorePage } = require( '../../customize-store.page' );
const { setOption } = require( '../../../../utils/options' );
@ -59,7 +59,8 @@ test.describe( 'Assembler -> Logo Picker', () => {
await customizeStorePageObject.resetCustomizeStoreChanges(
baseURL
);
await activateTheme( 'twentynineteen' );
// Reset theme back to default.
await activateTheme( DEFAULT_THEME );
} catch ( error ) {
console.log( 'Store completed option not updated' );
}

View File

@ -1,7 +1,5 @@
const { test, expect, request } = require( '@playwright/test' );
const { BASE_URL } = process.env;
const { features } = require( '../../utils' );
const { activateTheme } = require( '../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../utils/themes' );
const { setOption } = require( '../../utils/options' );
const CUSTOMIZE_STORE_URL =
@ -37,8 +35,8 @@ test.describe( 'Store owner can view the Intro page', () => {
} );
test.afterAll( async ( { baseURL } ) => {
// Reset theme back to twentynineteen
await activateTheme( 'twentynineteen' );
// Reset theme to the default.
await activateTheme( DEFAULT_THEME );
// Reset tour to visible.
await setOption(

View File

@ -1,6 +1,6 @@
const { test: base, expect, request } = require( '@playwright/test' );
const { setOption } = require( '../../utils/options' );
const { activateTheme } = require( '../../utils/themes' );
const { activateTheme, DEFAULT_THEME } = require( '../../utils/themes' );
const { AssemblerPage } = require( './assembler/assembler.page' );
const CUSTOMIZE_STORE_URL =
@ -45,8 +45,8 @@ test.describe( 'Store owner can view the Transitional page', () => {
} );
test.afterAll( async ( { baseURL } ) => {
// Reset theme back to twentynineteen
await activateTheme( 'twentynineteen' );
// Reset theme back to default.
await activateTheme( DEFAULT_THEME );
// Reset tour to visible.
await setOption(

View File

@ -1,5 +1,7 @@
const { exec } = require( 'node:child_process' );
export const DEFAULT_THEME = 'twentytwentythree';
export const activateTheme = ( themeName ) => {
return new Promise( ( resolve, reject ) => {
const command = `wp-env run tests-cli wp theme activate ${ themeName }`;