Fix flaky tests, failures from Blocks merge (#41815)

* Clean up created pages and posts

* Move tax tests so that they run last

* Improve locators

* Changelog

* Improve locators

* Improve locator on heading

* Change assertions to look for alert text

* Change assertion to look for text

* Update locators

* Update locator

* Update alternate elements

* Specify first order amount

* Update locator

* Changelog

* Increase reliability of checkout test

* Update a few locators

* Remove .slice()

* Add some console output to checkout test

* Make command palette tests Mac-compatible

* Added update for why download test flaky

* Improvements to checkout tax tests

* Add changelog

* Assert on range of prices

* Improve the regex for matching the price

* Changelog

* Clean up locator

* Unskip analytics tests

* Remove logging statements

* Update variations selector

* Remove comment

* Fix disable block tests

* Remove skipped legacy coupon page test

* Account for multiple products in test

* Cleaned up some console.logs

* Added specificity to locator

* Better price parsing

* Fix cart block shipping test

* Fix syntax error

* Update Playwright, fix logic error

---------

Co-authored-by: Jon Lane <jon.lane@automattic.com>
This commit is contained in:
Jonathan Lane 2023-12-12 07:56:56 -08:00 committed by GitHub
parent 0a0351aa6a
commit 7692fa5430
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
12 changed files with 1968 additions and 344 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: dev
Fixes the checkout test with better regex

View File

@ -139,11 +139,10 @@ test.describe( 'Analytics-related tests', () => {
// process the Action Scheduler tasks
setupPage = await browser.newPage();
await setupPage.waitForTimeout( 5000 ); // bad
await setupPage.waitForTimeout( 5000 );
await setupPage.goto( '?process-waiting-actions' );
} );
test.afterAll( async( { baseURL } ) => {
const api = new wcApi( {
url: baseURL,
@ -169,9 +168,7 @@ test.describe( 'Analytics-related tests', () => {
await expect( page.getByRole( 'menuitem', { name: 'Variations Sold 40 No change from Previous year:' } ) ).toBeVisible();
} );
// this test will be skipped until the cause of test flakiness can be diagnosed and updated
// UPDATE: test appears to be flaky because sometimes CSV is processed async and not immediately downloaded
test.skip( 'downloads revenue report as CSV', async( { page } ) => {
test( 'downloads revenue report as CSV', async( { page } ) => {
await page.goto( '/wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue' );
// FTUX tour on first run through
try {
@ -179,11 +176,18 @@ test.describe( 'Analytics-related tests', () => {
} catch (e) {
console.log( 'Tour was not visible, skipping.' );
}
await page.getByRole( 'button', { name: 'Download' } ).scrollIntoViewIfNeeded();
const downloadPromise = page.waitForEvent( 'download' );
await page.getByRole( 'button', { name: 'Download' } ).click();
const download = await downloadPromise;
await expect( download.suggestedFilename() ).toContain( 'revenue.csv' );
// the revenue report can either download immediately, or get mailed.
try {
await page.getByRole( 'button', { name: 'Download' } ).click();
await expect( page.locator( '.components-snackbar' ) ).toBeVisible( { timeout: 10000 } ); // fail fast if the snackbar doesn't display
await expect( page.locator( '.components-snackbar' ) ).toHaveText( 'Your Revenue Report will be emailed to you.' );
} catch (e) {
const downloadPromise = page.waitForEvent( 'download' );
await page.getByRole( 'button', { name: 'Download' } ).click();
const download = await downloadPromise;
await expect( download.suggestedFilename() ).toContain( 'revenue.csv' );
}
} );
test( 'use date filter on overview page', async( { page } ) => {
@ -211,6 +215,13 @@ test.describe( 'Analytics-related tests', () => {
test( 'use date filter on revenue report', async( { page } ) => {
await page.goto( '/wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue' );
// FTUX tour on first run through
try {
await page.getByLabel('Close Tour').click( { timeout: 5000 } );
} catch (e) {
console.log( 'Tour was not visible, skipping.' );
}
// assert that current month is shown and that values are for that
await expect( page.getByText( 'Month to date' ).first() ).toBeVisible();
await expect( page.getByRole( 'menuitem', { name: 'Gross sales $1,229.30 No change from Previous year:' } ) ).toBeVisible();
@ -234,10 +245,16 @@ test.describe( 'Analytics-related tests', () => {
await expect( page.getByRole( 'menuitem', { name: 'Total sales $0.00 No change from Previous year:' } ) ).toBeVisible();
} );
// this test will be skipped until the cause of test flakiness can be diagnosed and updated
test.skip( 'set custom date range on revenue report', async( { page } ) => {
test( 'set custom date range on revenue report', async( { page } ) => {
await page.goto( '/wp-admin/admin.php?page=wc-admin&path=%2Fanalytics%2Frevenue' );
// FTUX tour on first run through
try {
await page.getByLabel('Close Tour').click( { timeout: 5000 } );
} catch (e) {
console.log( 'Tour was not visible, skipping.' );
}
// assert that current month is shown and that values are for that
await expect( page.getByText( 'Month to date' ).first() ).toBeVisible();
await expect( page.getByRole( 'menuitem', { name: 'Gross sales $1,229.30 No change from Previous year:' } ) ).toBeVisible();

View File

@ -89,7 +89,7 @@ test.describe.serial( 'Add New Simple Product Page', () => {
waitUntil: 'networkidle',
} );
await expect( page.getByRole('heading', { name: virtualProductName }) ).toBeVisible();
await expect( page.getByText( productPrice ) ).toBeVisible();
await expect( page.getByText( productPrice ).first() ).toBeVisible();
await page.getByRole( 'button', { name: 'Add to cart' } ).click();
await page.getByRole( 'link', { name: 'View cart' } ).click();
await expect( page.locator( 'td[data-title=Product]' ) ).toContainText(

View File

@ -26,12 +26,6 @@ const wcPages = [
element: '#search-inline-input-0',
text: 'Move backward for selected items',
},
{
name: 'Coupons',
heading: 'Coupons',
element: '.woocommerce-table__empty-item',
text: 'No data to display',
},
{
name: 'Reports',
heading: 'Orders',
@ -204,20 +198,6 @@ for ( const currentPage of wcPages ) {
test( `Can load ${ currentPage.subpages[ i ].name }`, async ( {
page,
} ) => {
// deal with cases where the 'Coupons' legacy menu had already been removed.
if ( currentPage.subpages[ i ].name === 'Coupons' ) {
const couponsMenuVisible = await page
.locator(
`li.wp-menu-open > ul.wp-submenu > li:has-text("${ currentPage.subpages[ i ].name }")`
)
.isVisible();
test.skip(
! couponsMenuVisible,
'Skipping this test because the legacy Coupons menu was not found and may have already been removed.'
);
}
await page
.locator(
`li.wp-menu-open > ul.wp-submenu > li:has-text("${ currentPage.subpages[ i ].name }")`,

View File

@ -133,12 +133,12 @@ test.describe( 'Update variations', () => {
await test.step( 'Go to the "Edit product" page.', async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_indivEdit }&action=edit`
`/wp-admin/post.php?post=${ productId_indivEdit }&action=edit#variable_product_options`
);
} );
await test.step( 'Click on the "Variations" tab.', async () => {
await page.getByRole('link', { name: 'Variations' }).click();
await page.getByRole('link', { name: 'Variations' }).last().click();
} );
await test.step( 'Expand all variations.', async () => {
@ -229,7 +229,7 @@ test.describe( 'Update variations', () => {
} );
await test.step( 'Click on the "Variations" tab.', async () => {
await page.getByRole('link', { name: 'Variations' }).click();
await page.getByRole('link', { name: 'Variations' }).last().click();
} );
await test.step( 'Expand all variations.', async () => {
@ -335,12 +335,12 @@ test.describe( 'Update variations', () => {
test( 'can bulk edit variations', async ( { page } ) => {
await test.step( 'Go to the "Edit product" page.', async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_bulkEdit }&action=edit`
`/wp-admin/post.php?post=${ productId_bulkEdit }&action=edit#variable_product_options`
);
} );
await test.step( 'Click on the "Variations" tab.', async () => {
await page.getByRole( 'link', { name: 'Variations' } ).click();
await page.getByRole('link', { name: 'Variations' }).last().click();
} );
await test.step(
@ -376,12 +376,12 @@ test.describe( 'Update variations', () => {
test( 'can delete all variations', async ( { page } ) => {
await test.step( 'Go to the "Edit product" page.', async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_deleteAll }&action=edit`
`/wp-admin/post.php?post=${ productId_deleteAll }&action=edit#variable_product_options`
);
} );
await test.step( 'Click on the "Variations" tab.', async () => {
await page.getByRole( 'link', { name: 'Variations' } ).click();
await page.getByRole('link', { name: 'Variations' }).last().click();
} );
await test.step(
@ -407,7 +407,7 @@ test.describe( 'Update variations', () => {
test( 'can manage stock levels', async ( { page } ) => {
await test.step( 'Go to the "Edit product" page.', async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_manageStock }&action=edit`
`/wp-admin/post.php?post=${ productId_manageStock }&action=edit#variable_product_options`
);
} );
@ -523,12 +523,12 @@ test.describe( 'Update variations', () => {
test( 'can set variation defaults', async ( { page } ) => {
await test.step( 'Go to the "Edit product" page.', async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_variationDefaults }&action=edit`
`/wp-admin/post.php?post=${ productId_variationDefaults }&action=edit#variable_product_options`
);
} );
await test.step( 'Click on the "Variations" tab.', async () => {
await page.getByRole( 'link', { name: 'Variations' } ).click();
await page.getByRole('link', { name: 'Variations' }).last().click();
} );
await test.step( 'Wait for block overlay to disappear.', async () => {
@ -587,12 +587,12 @@ test.describe( 'Update variations', () => {
test( 'can remove a variation', async ( { page } ) => {
await test.step( 'Go to the "Edit product" page.', async () => {
await page.goto(
`/wp-admin/post.php?post=${ productId_removeVariation }&action=edit`
`/wp-admin/post.php?post=${ productId_removeVariation }&action=edit#variable_product_options`
);
} );
await test.step( 'Click on the "Variations" tab.', async () => {
await page.getByRole( 'link', { name: 'Variations' } ).click();
await page.getByRole('link', { name: 'Variations' }).last().click();
} );
await test.step( 'Click "Remove" on a variation', async () => {

View File

@ -96,6 +96,7 @@ test( 'can create a simple product', async ( { page } ) => {
.fill( productData.name );
await page
.locator( '[data-template-block-id="basic-details"] .components-summary-control' )
.last()
.fill( productData.summary );
await page
.locator(

View File

@ -8,10 +8,6 @@ const {
} = require( '../../../../utils/simple-products' );
const { toggleBlockProductTour } = require( '../../../../utils/tours' );
const ALL_PRODUCTS_URL = 'wp-admin/edit.php?post_type=product';
const NEW_EDITOR_ADD_PRODUCT_URL =
'wp-admin/admin.php?page=wc-admin&path=%2Fadd-product';
let isNewProductEditorEnabled = false;
const isTrackingSupposedToBeEnabled = !! process.env.ENABLE_TRACKING;
@ -22,9 +18,7 @@ async function dismissFeedbackModalIfShown( page ) {
} catch ( error ) {}
}
test.describe.configure( { mode: 'serial' } );
test.describe( 'Disable block product editor', () => {
test.describe.serial( 'Disable block product editor', () => {
test.use( { storageState: process.env.ADMINSTATE } );
test.beforeAll( async ( { request } ) => {
@ -53,13 +47,18 @@ test.describe( 'Disable block product editor', () => {
);
test( 'is hooked up to sidebar "Add New"', async ( { page } ) => {
await page.goto( ALL_PRODUCTS_URL );
await page.goto( '/wp-admin/edit.php?post_type=product' );
await clickAddNewMenuItem( page );
await expectBlockProductEditor( page );
} );
test( 'can be disabled from the header', async ( { page } ) => {
await page.goto( NEW_EDITOR_ADD_PRODUCT_URL );
await page.goto( '/wp-admin/admin.php?page=wc-admin&path=%2Fadd-product' );
try {
// dismiss feature highlight if shown
await page.getByRole( 'button', { name: 'Close Tour' } ).click( { timeout: 5000 } );
} catch (e) {}
// turn off block product editor from the header
await page
@ -77,7 +76,7 @@ test.describe( 'Disable block product editor', () => {
test( 'can be disabled from settings', async ( { page } ) => {
await toggleBlockProductEditor( 'disable', page );
await page.goto( ALL_PRODUCTS_URL );
await page.goto( '/wp-admin/edit.php?post_type=product' );
await clickAddNewMenuItem( page );
await expectOldProductEditor( page );
} );

View File

@ -242,11 +242,17 @@ test.describe( 'Cart Block Calculate Shipping', () => {
'.wc-block-components-totals-shipping > .wc-block-components-totals-item'
)
).toContainText( '$0.00' );
await expect(
page.locator(
'.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value'
)
).toContainText( firstProductPrice );
let totalPrice = await page
.locator( '.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value' )
.last()
.textContent();
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( firstProductPrice )
);
await expect( totalPrice ).toBeLessThanOrEqual(
Number( firstProductPrice * 1.25 )
);
} );
test( 'should show correct total cart block price after updating quantity', async ( {
@ -270,11 +276,17 @@ test.describe( 'Cart Block Calculate Shipping', () => {
.getByRole( 'button' )
.filter( { hasText: '', exact: true } )
.click();
await expect(
page.locator(
'.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value'
)
).toContainText( doubleFirstProductWithFlatRate.toString() );
let totalPrice = await page
.locator( '.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value' )
.last()
.textContent();
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( firstProductPrice )
);
await expect( totalPrice ).toBeLessThanOrEqual(
Number( firstProductPrice * 1.25 )
);
} );
test( 'should show correct total cart block price with 2 different products and flat rate/local pickup', async ( {
@ -305,11 +317,17 @@ test.describe( 'Cart Block Calculate Shipping', () => {
'.wc-block-components-totals-shipping > .wc-block-components-totals-item'
)
).toContainText( '$5.00' );
await expect(
page.locator(
'.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value'
)
).toContainText( twoProductsWithFlatRate.toString() );
let totalPrice = await page
.locator( '.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value' )
.last()
.textContent();
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( twoProductsWithFlatRate )
);
await expect( totalPrice ).toBeLessThanOrEqual(
Number( twoProductsWithFlatRate * 1.25 )
);
// Set shipping to local pickup instead of flat rate
await page.getByRole( 'group' ).getByText( 'Local pickup' ).click();
@ -320,10 +338,16 @@ test.describe( 'Cart Block Calculate Shipping', () => {
'.wc-block-components-totals-shipping > .wc-block-components-totals-item'
)
).toContainText( '$0.00' );
await expect(
page.locator(
'.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value'
)
).toContainText( twoProductsTotal.toString() );
totalPrice = await page
.locator( '.wc-block-components-totals-footer-item > .wc-block-components-totals-item__value' )
.last()
.textContent();
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( twoProductsTotal )
);
await expect( totalPrice ).toBeLessThanOrEqual(
Number( twoProductsTotal * 1.25 )
);
} );
} );

View File

@ -133,9 +133,7 @@ test.describe( 'Checkout page', () => {
.last()
.locator( 'td' )
.textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( singleProductPrice )
);
@ -159,9 +157,7 @@ test.describe( 'Checkout page', () => {
.last()
.locator( 'td' )
.textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( twoProductPrice )
);
@ -187,9 +183,7 @@ test.describe( 'Checkout page', () => {
.last()
.locator( 'td' )
.textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( threeProductPrice )
);
@ -292,9 +286,7 @@ test.describe( 'Checkout page', () => {
.last()
.locator( 'td' )
.textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( twoProductPrice )
);
@ -328,9 +320,7 @@ test.describe( 'Checkout page', () => {
.last()
.locator( 'td' )
.textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( twoProductPrice )
);
@ -454,9 +444,7 @@ test.describe( 'Checkout page', () => {
.last()
.locator( 'td' )
.textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( twoProductPrice )
);

View File

@ -96,9 +96,12 @@ test.describe( 'Grouped Product Page', () => {
await expect(
page.locator( 'td.product-name >> nth=1' )
).toContainText( simpleProduct2 );
await expect( page.locator( 'tr.order-total > td' ) ).toContainText(
( +productPrice * 10 ).toString()
);
let totalPrice = await page
.locator( 'tr.order-total > td' )
.last()
.textContent();
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
await expect( totalPrice ).toBeGreaterThanOrEqual( productPrice * 10 );
} );
test( 'should be able to remove grouped products from the cart', async ( {

View File

@ -205,9 +205,7 @@ test.describe( 'Variable Product Page', () => {
).toContainText( variableProductName );
totalPrice = await page.getByRole( 'row', { name: 'Total' } ).last().locator( 'td' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice * 10 )
);
@ -302,9 +300,7 @@ test.describe( 'Shopper > Update variable product', () => {
// handling assertion this way because taxes may or may not be enabled
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);
@ -316,9 +312,7 @@ test.describe( 'Shopper > Update variable product', () => {
// handling assertion this way because taxes may or may not be enabled
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);
@ -330,9 +324,7 @@ test.describe( 'Shopper > Update variable product', () => {
// handling assertion this way because taxes may or may not be enabled
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);
@ -351,9 +343,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'Small' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);
@ -371,9 +361,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'XLarge' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice * 2 )
);
@ -399,9 +387,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'Small' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);
@ -412,9 +398,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'Medium' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);
@ -425,9 +409,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'Large' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice * 2 )
);
@ -438,9 +420,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'XLarge' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice * 2 )
);
@ -457,9 +437,7 @@ test.describe( 'Shopper > Update variable product', () => {
await page.locator( '#size' ).selectOption( 'Small' );
totalPrice = await page.locator( '.woocommerce-variation-price' ).last().locator( 'bdi' ).textContent();
console.log( `Total Price: ${ totalPrice }` );
totalPrice = Number( totalPrice.replace( /[^\d.-]/g, '' ) );
console.log( `Number: ${ totalPrice }` );
await expect( totalPrice ).toBeGreaterThanOrEqual(
Number( productPrice )
);

File diff suppressed because it is too large Load Diff