[e2e tests] External sites - update /merchant tests, part 1 (#51014)

* Dismiss "Choose a pattern" if present

* Cover "New in store" for PRessable

* Handle error for `api.delete( coupons/<id> )`

* Check if `Select an option…` is available

* Expand Pressable suite

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

* Missed one spec, adding it now

* Handle "Choose a pattern" popup

* Use `closeChoosePatternModal` instead

* Remove comments

* Add missing `throw` error

* Revert to check `Browse store` link, after updating template on Pressable

---------

Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
Ivan Stojadinov 2024-08-29 21:05:30 +02:00 committed by GitHub
parent a5e9744ed5
commit 3a2a812e1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 35 additions and 5 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: update
Update /merchant tests (first five files), so they are passing against Pressable env.

View File

@ -16,6 +16,11 @@ config = {
'**/admin-marketing/**/*.spec.js', '**/admin-marketing/**/*.spec.js',
'**/admin-tasks/**/*.spec.js', '**/admin-tasks/**/*.spec.js',
'**/customize-store/**/*.spec.js', '**/customize-store/**/*.spec.js',
'**/merchant/command-palette.spec.js',
'**/merchant/create-cart-block.spec.js',
'**/merchant/create-checkout-block.spec.js',
'**/merchant/create-coupon.spec.js',
'**/merchant/create-order.spec.js',
], ],
grepInvert: /@skip-on-default-pressable/, grepInvert: /@skip-on-default-pressable/,
}, },

View File

@ -5,6 +5,7 @@ const {
insertBlock, insertBlock,
transformIntoBlocks, transformIntoBlocks,
publishPage, publishPage,
closeChoosePatternModal,
} = require( '../../utils/editor' ); } = require( '../../utils/editor' );
const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' );
@ -23,6 +24,8 @@ test.describe(
} ) => { } ) => {
await goToPageEditor( { page } ); await goToPageEditor( { page } );
await closeChoosePatternModal( { page } );
await fillPageTitle( page, testPage.title ); await fillPageTitle( page, testPage.title );
const wordPressVersion = await getInstalledWordPressVersion(); const wordPressVersion = await getInstalledWordPressVersion();
await insertBlock( page, 'Classic Cart', wordPressVersion ); await insertBlock( page, 'Classic Cart', wordPressVersion );

View File

@ -7,6 +7,7 @@ const {
transformIntoBlocks, transformIntoBlocks,
publishPage, publishPage,
openEditorSettings, openEditorSettings,
closeChoosePatternModal,
} = require( '../../utils/editor' ); } = require( '../../utils/editor' );
const { getInstalledWordPressVersion } = require( '../../utils/wordpress' ); const { getInstalledWordPressVersion } = require( '../../utils/wordpress' );
@ -74,6 +75,8 @@ test.describe(
} ) => { } ) => {
await goToPageEditor( { page } ); await goToPageEditor( { page } );
await closeChoosePatternModal( { page } );
await fillPageTitle( page, testPage.title ); await fillPageTitle( page, testPage.title );
const wordPressVersion = await getInstalledWordPressVersion(); const wordPressVersion = await getInstalledWordPressVersion();
await insertBlock( page, 'Classic Checkout', wordPressVersion ); await insertBlock( page, 'Classic Checkout', wordPressVersion );

View File

@ -35,7 +35,15 @@ const test = baseTest.extend( {
coupon: async ( { api }, use ) => { coupon: async ( { api }, use ) => {
const coupon = {}; const coupon = {};
await use( coupon ); await use( coupon );
await api.delete( `coupons/${ coupon.id }`, { force: true } ); await api
.delete( `coupons/${ coupon.id }`, { force: true } )
.then( ( response ) => {
console.log( 'Delete successful:', response.data );
} )
.catch( ( error ) => {
console.log( 'Error response data:', error.response.data );
throw new Error( error.response.data );
} );
}, },
} ); } );

View File

@ -299,10 +299,17 @@ test.describe(
await page await page
.getByRole( 'textbox', { name: 'Postcode' } ) .getByRole( 'textbox', { name: 'Postcode' } )
.fill( '12345' ); .fill( '12345' );
await page // eslint-disable-next-line playwright/no-conditional-in-test
.getByRole( 'textbox', { name: 'Select an option…' } ) if (
.click(); await page
await page.getByRole( 'option', { name: 'Florida' } ).click(); .getByRole( 'textbox', { name: 'Select an option…' } )
.isVisible()
) {
await page
.getByRole( 'textbox', { name: 'Select an option…' } )
.click();
await page.getByRole( 'option', { name: 'Florida' } ).click();
}
await page await page
.getByRole( 'textbox', { name: 'Email address' } ) .getByRole( 'textbox', { name: 'Email address' } )
.fill( 'elbarto@example.com' ); .fill( 'elbarto@example.com' );