diff --git a/tests/e2e/specs/dashboard/edit-free-listings.test.js b/tests/e2e/specs/dashboard/edit-free-listings.test.js index 03f275b94d..e6bbbaa21e 100644 --- a/tests/e2e/specs/dashboard/edit-free-listings.test.js +++ b/tests/e2e/specs/dashboard/edit-free-listings.test.js @@ -70,7 +70,7 @@ test.describe( 'Edit Free Listings', () => { test( 'Check recommended shipping settings', async () => { await editFreeListingsPage.checkRecommendShippingSettings(); - await editFreeListingsPage.fillCountriesShippingTimeInput( '5' ); + await editFreeListingsPage.fillCountriesShippingTimeInput( '5', '10' ); await editFreeListingsPage.checkDestinationBasedTaxRates(); const saveChangesButton = await editFreeListingsPage.getSaveChangesButton(); diff --git a/tests/e2e/specs/setup-mc/step-2-product-listings.test.js b/tests/e2e/specs/setup-mc/step-2-product-listings.test.js index 08155d24dc..0fbbb79707 100644 --- a/tests/e2e/specs/setup-mc/step-2-product-listings.test.js +++ b/tests/e2e/specs/setup-mc/step-2-product-listings.test.js @@ -260,8 +260,8 @@ test.describe( 'Configure product listings', () => { await expect( minimumOrderForFreeShippingText ).toBeVisible(); } ); - test( 'should show error message if clicking "Continue" button when shipping time is < 0', async () => { - await productListingsPage.fillEstimatedShippingTimes( '-1' ); + test( 'should show error message if min shipping time is bigger than max time', async () => { + await productListingsPage.fillEstimatedShippingTimes( '9', '7' ); await productListingsPage.clickContinueButton(); const estimatedTimesError = productListingsPage.getEstimatedShippingTimesError(); @@ -370,7 +370,7 @@ test.describe( 'Configure product listings', () => { request.postDataJSON().time === 14 ); - await productListingsPage.fillEstimatedShippingTimes( '14' ); + await productListingsPage.fillEstimatedShippingTimes( '14', '20' ); const request = await requestPromise; const response = await request.response(); @@ -438,7 +438,7 @@ test.describe( 'Configure product listings', () => { // Mock MC contact information productListingsPage.mockContactInformation(); productListingsPage.checkRecommendedShippingRateRadioButton(); - await productListingsPage.fillEstimatedShippingTimes( '14' ); + await productListingsPage.fillEstimatedShippingTimes( '14', '20' ); await productListingsPage.checkNonDestinationBasedTaxRateRadioButton(); } ); diff --git a/tests/e2e/utils/pages/edit-free-listings.js b/tests/e2e/utils/pages/edit-free-listings.js index 5f2c742b8f..0c086cdeea 100644 --- a/tests/e2e/utils/pages/edit-free-listings.js +++ b/tests/e2e/utils/pages/edit-free-listings.js @@ -49,11 +49,14 @@ export default class EditFreeListingsPage extends MockRequests { /** * Fill the countries shipping time input. * - * @param {string} input The shipping time + * @param {string} min The minimum shipping time + * @param {string} max The maximum shipping time * @return {Promise} */ - async fillCountriesShippingTimeInput( input ) { - await this.page.locator( '.countries-time input' ).fill( input ); + async fillCountriesShippingTimeInput( min, max ) { + const timesLocator = this.page.locator( '.countries-time input' ); + await timesLocator.first().fill( min ); + await timesLocator.last().fill( max ); } /** diff --git a/tests/e2e/utils/pages/setup-mc/step-2-product-listings.js b/tests/e2e/utils/pages/setup-mc/step-2-product-listings.js index 36affb1b22..c87d71d023 100644 --- a/tests/e2e/utils/pages/setup-mc/step-2-product-listings.js +++ b/tests/e2e/utils/pages/setup-mc/step-2-product-listings.js @@ -242,7 +242,7 @@ export default class ProductListingsPage extends MockRequests { */ getEstimatedShippingTimesError() { return this.getEstimatedShippingTimesCard().getByText( - 'Please specify estimated shipping times for all the countries, and the time cannot be less than 0' + 'The minimum shipping time must not be more than the maximum shipping time.' ); } @@ -514,16 +514,20 @@ export default class ProductListingsPage extends MockRequests { /** * Fill estimated shipping times. * - * @param {string} days + * @param {string} min The minimum shipping time + * @param {string} max The maximum shipping time * * @return {Promise} */ - async fillEstimatedShippingTimes( days = '0' ) { + async fillEstimatedShippingTimes( min = '0', max = '10' ) { const estimatedTimesInputBox = this.getEstimatedShippingTimesInputBox(); - await estimatedTimesInputBox.fill( days ); + + await estimatedTimesInputBox.first().fill( min ); + await estimatedTimesInputBox.last().fill( max ); // A hack to finish typing in the input box, similar to pressing anywhere in the page. - await estimatedTimesInputBox.press( 'Tab' ); + await estimatedTimesInputBox.first().press( 'Tab' ); + await estimatedTimesInputBox.last().press( 'Tab' ); await this.page.waitForLoadState( LOAD_STATE.DOM_CONTENT_LOADED ); }