This repository has been archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 219
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move cart widget tests to playwright and ensure classic/block theme c…
…onfigs are executed correctly (#10669)
- Loading branch information
Showing
12 changed files
with
108 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,19 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { BLOCK_THEME_SLUG, cli } from '@woocommerce/e2e-utils'; | ||
import { | ||
BLOCK_THEME_NAME, | ||
BLOCK_THEME_SLUG, | ||
cli, | ||
} from '@woocommerce/e2e-utils'; | ||
import { test as setup, expect } from '@woocommerce/e2e-playwright-utils'; | ||
|
||
cli( `npm run wp-env run tests-cli "wp theme activate ${ BLOCK_THEME_SLUG }` ); | ||
setup( 'Sets up the block theme', async ( { admin } ) => { | ||
await cli( | ||
`npm run wp-env run tests-cli "wp theme install ${ BLOCK_THEME_SLUG } --activate"` | ||
); | ||
await admin.page.goto( '/wp-admin/themes.php' ); | ||
await expect( | ||
admin.page.getByText( `Active: ${ BLOCK_THEME_NAME }` ) | ||
).toBeVisible(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,19 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { CLASSIC_THEME_SLUG, cli } from '@woocommerce/e2e-utils'; | ||
import { | ||
CLASSIC_THEME_NAME, | ||
CLASSIC_THEME_SLUG, | ||
cli, | ||
} from '@woocommerce/e2e-utils'; | ||
import { test as setup, expect } from '@woocommerce/e2e-playwright-utils'; | ||
|
||
cli( | ||
`npm run wp-env run tests-cli "wp theme activate ${ CLASSIC_THEME_SLUG }` | ||
); | ||
setup( 'Sets up the classic theme', async ( { admin } ) => { | ||
await cli( | ||
`npm run wp-env run tests-cli "wp theme install ${ CLASSIC_THEME_SLUG } --activate"` | ||
); | ||
await admin.page.goto( '/wp-admin/themes.php' ); | ||
await expect( | ||
admin.page.getByText( `Active: ${ CLASSIC_THEME_NAME }` ) | ||
).toBeVisible(); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { defineConfig } from '@playwright/test'; | ||
import path from 'path'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import config from './playwright.config'; | ||
|
||
export default defineConfig( { | ||
...config, | ||
outputDir: path.join( | ||
process.cwd(), | ||
'artifacts/test-results-side-effects' | ||
), | ||
fullyParallel: false, | ||
workers: 1, | ||
projects: [ | ||
{ | ||
name: 'classicThemeConfiguration', | ||
testDir: '.', | ||
testMatch: /classic-theme.setup.ts/, | ||
}, | ||
{ | ||
name: 'classicTheme', | ||
testMatch: /.*.classic_theme.spec.ts/, | ||
dependencies: [ 'classicThemeConfiguration' ], | ||
}, | ||
], | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
tests/e2e/tests/cart/cart-block.merchant.classic_theme.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { test, expect } from '@woocommerce/e2e-playwright-utils'; | ||
|
||
test.describe( 'Merchant → Cart', () => { | ||
test.describe( 'in widget editor', () => { | ||
test( "can't be inserted in a widget area", async ( { | ||
editorUtils, | ||
page, | ||
} ) => { | ||
await page.goto( '/wp-admin/widgets.php' ); | ||
await editorUtils.closeModalByName( 'Welcome to block Widgets' ); | ||
|
||
await editorUtils.openGlobalBlockInserter(); | ||
await editorUtils.page | ||
.getByLabel( 'Search for blocks and patterns' ) | ||
.fill( 'woocommerce/cart' ); | ||
const cartButton = editorUtils.page.getByRole( 'option', { | ||
name: 'Cart', | ||
exact: true, | ||
} ); | ||
await expect( cartButton ).toBeHidden(); | ||
} ); | ||
} ); | ||
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters