Make e2e test `can discard industry changes when navigating back to "Store Details"` independent from previous tests (#38715)
* e2e test update * handle modal on test * Update deprecated method --------- Co-authored-by: Rodel Calasagsag <rodel.calasagsag@automattic.com>
This commit is contained in:
parent
b91c37fe32
commit
3b075731a5
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
Ensure `can discard industry changes when navigating back to "Store Details"'` can run independent from previous tests
|
|
@ -65,6 +65,29 @@ testRunner( 'Store owner can complete onboarding wizard', () => {
|
||||||
test( 'can discard industry changes when navigating back to "Store Details"', async ( {
|
test( 'can discard industry changes when navigating back to "Store Details"', async ( {
|
||||||
page,
|
page,
|
||||||
} ) => {
|
} ) => {
|
||||||
|
|
||||||
|
// set up pre-condition to ensure Industries stored in
|
||||||
|
// storeDetails.us.industries2 have been set
|
||||||
|
await onboarding.completeIndustrySection(
|
||||||
|
page,
|
||||||
|
storeDetails.us.industries2,
|
||||||
|
storeDetails.us.expectedNumberOfIndustries
|
||||||
|
);
|
||||||
|
|
||||||
|
// Navigate to "Store Details" section to show Save Changes modal prompt
|
||||||
|
await page.locator( 'button >> text=Store Details' ).click();
|
||||||
|
|
||||||
|
// handle save changes modal if displayed
|
||||||
|
const saveChangesModalVisible = await page
|
||||||
|
.locator( '.components-modal__header-heading' )
|
||||||
|
.isVisible();
|
||||||
|
if ( saveChangesModalVisible ) {
|
||||||
|
// Save the changes to ensure the test is now in the correct state
|
||||||
|
// independent of the previous test results
|
||||||
|
await onboarding.handleSaveChangesModal( page, { saveChanges: true } );
|
||||||
|
}
|
||||||
|
|
||||||
|
// test proper begins
|
||||||
await onboarding.completeIndustrySection(
|
await onboarding.completeIndustrySection(
|
||||||
page,
|
page,
|
||||||
storeDetails.us.industries,
|
storeDetails.us.industries,
|
||||||
|
|
Loading…
Reference in New Issue