[e2e tests] Tag some e2e tests to help with test audit (#51044)
This commit is contained in:
parent
0f7773dd47
commit
74e96d689b
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: patch
|
||||||
|
Type: dev
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ const test = baseTest.extend( {
|
||||||
},
|
},
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test.describe( 'Restricted coupon management', { tag: '@services' }, () => {
|
test.describe( 'Restricted coupon management', { tag: [ '@services' ] }, () => {
|
||||||
for ( const couponType of Object.keys( couponData ) ) {
|
for ( const couponType of Object.keys( couponData ) ) {
|
||||||
test( `can create new ${ couponType } coupon`, async ( {
|
test( `can create new ${ couponType } coupon`, async ( {
|
||||||
page,
|
page,
|
||||||
|
|
|
@ -130,11 +130,10 @@ test.describe(
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'allows customer to calculate Free Shipping in cart block if in Netherlands', async ( {
|
test(
|
||||||
page,
|
'allows customer to calculate Free Shipping in cart block if in Netherlands',
|
||||||
context,
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
cartBlockPage,
|
async ( { page, context, cartBlockPage } ) => {
|
||||||
} ) => {
|
|
||||||
await context.clearCookies();
|
await context.clearCookies();
|
||||||
|
|
||||||
await addAProductToCart( page, product1Id );
|
await addAProductToCart( page, product1Id );
|
||||||
|
@ -155,18 +154,20 @@ test.describe(
|
||||||
page.getByRole( 'group' ).getByText( 'Free shipping' )
|
page.getByRole( 'group' ).getByText( 'Free shipping' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'strong' ).getByText( 'Free', { exact: true } )
|
page
|
||||||
|
.getByRole( 'strong' )
|
||||||
|
.getByText( 'Free', { exact: true } )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect( page.getByText( '$' ).nth( 2 ) ).toContainText(
|
await expect( page.getByText( '$' ).nth( 2 ) ).toContainText(
|
||||||
firstProductPrice
|
firstProductPrice
|
||||||
);
|
);
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'allows customer to calculate Flat rate and Local pickup in cart block if in Portugal', async ( {
|
test(
|
||||||
page,
|
'allows customer to calculate Flat rate and Local pickup in cart block if in Portugal',
|
||||||
context,
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
cartBlockPage,
|
async ( { page, context, cartBlockPage } ) => {
|
||||||
} ) => {
|
|
||||||
await context.clearCookies();
|
await context.clearCookies();
|
||||||
|
|
||||||
await addAProductToCart( page, product1Id );
|
await addAProductToCart( page, product1Id );
|
||||||
|
@ -186,26 +187,33 @@ test.describe(
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'group' ).getByText( 'Flat rate' )
|
page.getByRole( 'group' ).getByText( 'Flat rate' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect( page.getByText( 'Shipping$5.00Flat' ) ).toBeVisible();
|
await expect(
|
||||||
|
page.getByText( 'Shipping$5.00Flat' )
|
||||||
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( `$${ firstProductWithFlatRate }` )
|
page.getByText( `$${ firstProductWithFlatRate }` )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
// Set shipping to local pickup instead of flat rate
|
// Set shipping to local pickup instead of flat rate
|
||||||
await page.getByRole( 'group' ).getByText( 'Local pickup' ).click();
|
await page
|
||||||
|
.getByRole( 'group' )
|
||||||
|
.getByText( 'Local pickup' )
|
||||||
|
.click();
|
||||||
|
|
||||||
// Verify updated shipping costs
|
// Verify updated shipping costs
|
||||||
await expect( page.getByText( 'ShippingFreeLocal' ) ).toBeVisible();
|
await expect(
|
||||||
|
page.getByText( 'ShippingFreeLocal' )
|
||||||
|
).toBeVisible();
|
||||||
await expect( page.getByText( '$' ).nth( 2 ) ).toContainText(
|
await expect( page.getByText( '$' ).nth( 2 ) ).toContainText(
|
||||||
firstProductPrice
|
firstProductPrice
|
||||||
);
|
);
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should show correct total cart block price after updating quantity', async ( {
|
test(
|
||||||
page,
|
'should show correct total cart block price after updating quantity',
|
||||||
context,
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
cartBlockPage,
|
async ( { page, context, cartBlockPage } ) => {
|
||||||
} ) => {
|
|
||||||
await context.clearCookies();
|
await context.clearCookies();
|
||||||
|
|
||||||
await addAProductToCart( page, product1Id );
|
await addAProductToCart( page, product1Id );
|
||||||
|
@ -232,13 +240,13 @@ test.describe(
|
||||||
}`.toString()
|
}`.toString()
|
||||||
)
|
)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should show correct total cart block price with 2 different products and flat rate/local pickup', async ( {
|
test(
|
||||||
page,
|
'should show correct total cart block price with 2 different products and flat rate/local pickup',
|
||||||
context,
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
cartBlockPage,
|
async ( { page, context, cartBlockPage } ) => {
|
||||||
} ) => {
|
|
||||||
await context.clearCookies();
|
await context.clearCookies();
|
||||||
|
|
||||||
await addAProductToCart( page, product1Id );
|
await addAProductToCart( page, product1Id );
|
||||||
|
@ -259,7 +267,9 @@ test.describe(
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'group' ).getByText( 'Flat rate' )
|
page.getByRole( 'group' ).getByText( 'Flat rate' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect( page.getByText( 'Shipping$5.00Flat' ) ).toBeVisible();
|
await expect(
|
||||||
|
page.getByText( 'Shipping$5.00Flat' )
|
||||||
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText(
|
page.getByText(
|
||||||
`$${
|
`$${
|
||||||
|
@ -271,16 +281,22 @@ test.describe(
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
// Set shipping to local pickup instead of flat rate
|
// Set shipping to local pickup instead of flat rate
|
||||||
await page.getByRole( 'group' ).getByText( 'Local pickup' ).click();
|
await page
|
||||||
|
.getByRole( 'group' )
|
||||||
|
.getByText( 'Local pickup' )
|
||||||
|
.click();
|
||||||
|
|
||||||
// Verify updated shipping costs
|
// Verify updated shipping costs
|
||||||
await expect( page.getByText( 'ShippingFreeLocal' ) ).toBeVisible();
|
await expect(
|
||||||
|
page.getByText( 'ShippingFreeLocal' )
|
||||||
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.locator( 'div' )
|
.locator( 'div' )
|
||||||
.filter( { hasText: /^\$30\.00$/ } )
|
.filter( { hasText: /^\$30\.00$/ } )
|
||||||
.locator( 'span' )
|
.locator( 'span' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -127,9 +127,10 @@ test.describe(
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'allows cart block to apply coupon of any type', async ( {
|
test(
|
||||||
page,
|
'allows cart block to apply coupon of any type',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
const totals = [ '$50.00', '$27.50', '$45.00' ];
|
const totals = [ '$50.00', '$27.50', '$45.00' ];
|
||||||
|
|
||||||
// apply all coupon types
|
// apply all coupon types
|
||||||
|
@ -137,7 +138,9 @@ test.describe(
|
||||||
await page
|
await page
|
||||||
.getByRole( 'button', { name: 'Add a coupon' } )
|
.getByRole( 'button', { name: 'Add a coupon' } )
|
||||||
.click();
|
.click();
|
||||||
await page.getByLabel( 'Enter code' ).fill( coupons[ i ].code );
|
await page
|
||||||
|
.getByLabel( 'Enter code' )
|
||||||
|
.fill( coupons[ i ].code );
|
||||||
await page.getByText( 'Apply', { exact: true } ).click();
|
await page.getByText( 'Apply', { exact: true } ).click();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
|
@ -166,11 +169,13 @@ test.describe(
|
||||||
)
|
)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
}
|
}
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'allows cart block to apply multiple coupons', async ( {
|
test(
|
||||||
page,
|
'allows cart block to apply multiple coupons',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
const totals = [ '$50.00', '$22.50', '$12.50' ];
|
const totals = [ '$50.00', '$22.50', '$12.50' ];
|
||||||
const totalsReverse = [ '$17.50', '$45.00', '$55.00' ];
|
const totalsReverse = [ '$17.50', '$45.00', '$55.00' ];
|
||||||
const discounts = [ '-$5.00', '-$32.50', '-$42.50' ];
|
const discounts = [ '-$5.00', '-$32.50', '-$42.50' ];
|
||||||
|
@ -180,7 +185,9 @@ test.describe(
|
||||||
await page
|
await page
|
||||||
.getByRole( 'button', { name: 'Add a coupon' } )
|
.getByRole( 'button', { name: 'Add a coupon' } )
|
||||||
.click();
|
.click();
|
||||||
await page.getByLabel( 'Enter code' ).fill( coupons[ i ].code );
|
await page
|
||||||
|
.getByLabel( 'Enter code' )
|
||||||
|
.fill( coupons[ i ].code );
|
||||||
await page.getByText( 'Apply', { exact: true } ).click();
|
await page.getByText( 'Apply', { exact: true } ).click();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
|
@ -213,23 +220,31 @@ test.describe(
|
||||||
)
|
)
|
||||||
).toHaveText( totalsReverse[ i ] );
|
).toHaveText( totalsReverse[ i ] );
|
||||||
}
|
}
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'prevents cart block applying same coupon twice', async ( {
|
test(
|
||||||
page,
|
'prevents cart block applying same coupon twice',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
// try to add two same coupons and verify the error message
|
// try to add two same coupons and verify the error message
|
||||||
await page.getByRole( 'button', { name: 'Add a coupon' } ).click();
|
await page
|
||||||
|
.getByRole( 'button', { name: 'Add a coupon' } )
|
||||||
|
.click();
|
||||||
await page.getByLabel( 'Enter code' ).fill( coupons[ 0 ].code );
|
await page.getByLabel( 'Enter code' ).fill( coupons[ 0 ].code );
|
||||||
await page.getByText( 'Apply', { exact: true } ).click();
|
await page.getByText( 'Apply', { exact: true } ).click();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
.locator( '.wc-block-components-notice-banner__content' )
|
.locator(
|
||||||
|
'.wc-block-components-notice-banner__content'
|
||||||
|
)
|
||||||
.getByText(
|
.getByText(
|
||||||
`Coupon code "${ coupons[ 0 ].code }" has been applied to your cart.`
|
`Coupon code "${ coupons[ 0 ].code }" has been applied to your cart.`
|
||||||
)
|
)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await page.getByRole( 'button', { name: 'Add a coupon' } ).click();
|
await page
|
||||||
|
.getByRole( 'button', { name: 'Add a coupon' } )
|
||||||
|
.click();
|
||||||
await page.getByLabel( 'Enter code' ).fill( coupons[ 0 ].code );
|
await page.getByLabel( 'Enter code' ).fill( coupons[ 0 ].code );
|
||||||
await page.getByText( 'Apply', { exact: true } ).click();
|
await page.getByText( 'Apply', { exact: true } ).click();
|
||||||
await expect(
|
await expect(
|
||||||
|
@ -239,13 +254,17 @@ test.describe(
|
||||||
`Coupon code "${ coupons[ 0 ].code }" has already been applied.`
|
`Coupon code "${ coupons[ 0 ].code }" has already been applied.`
|
||||||
)
|
)
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'prevents cart block applying coupon with usage limit', async ( {
|
test(
|
||||||
page,
|
'prevents cart block applying coupon with usage limit',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
// add coupon with usage limit
|
// add coupon with usage limit
|
||||||
await page.getByRole( 'button', { name: 'Add a coupon' } ).click();
|
await page
|
||||||
|
.getByRole( 'button', { name: 'Add a coupon' } )
|
||||||
|
.click();
|
||||||
await page.getByLabel( 'Enter code' ).fill( couponLimitedCode );
|
await page.getByLabel( 'Enter code' ).fill( couponLimitedCode );
|
||||||
await page.getByText( 'Apply', { exact: true } ).click();
|
await page.getByText( 'Apply', { exact: true } ).click();
|
||||||
await expect(
|
await expect(
|
||||||
|
@ -253,6 +272,7 @@ test.describe(
|
||||||
.getByRole( 'alert' )
|
.getByRole( 'alert' )
|
||||||
.getByText( 'Coupon usage limit has been reached.' )
|
.getByText( 'Coupon usage limit has been reached.' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -73,10 +73,10 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'can see empty cart, add and remove simple & cross sell product, increase to max quantity', async ( {
|
test(
|
||||||
page,
|
'can see empty cart, add and remove simple & cross sell product, increase to max quantity',
|
||||||
testPage,
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
} ) => {
|
async ( { page, testPage } ) => {
|
||||||
await goToPageEditor( { page } );
|
await goToPageEditor( { page } );
|
||||||
await fillPageTitle( page, testPage.title );
|
await fillPageTitle( page, testPage.title );
|
||||||
await insertBlockByShortcut( page, 'Cart' );
|
await insertBlockByShortcut( page, 'Cart' );
|
||||||
|
@ -104,7 +104,10 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
page.getByRole( 'heading', { name: testPage.title } )
|
page.getByRole( 'heading', { name: testPage.title } )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'link', { name: simpleProductName, exact: true } )
|
page.getByRole( 'link', {
|
||||||
|
name: simpleProductName,
|
||||||
|
exact: true,
|
||||||
|
} )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect( page.getByText( simpleProductDesc ) ).toBeVisible();
|
await expect( page.getByText( simpleProductDesc ) ).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
|
@ -123,15 +126,21 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
)
|
)
|
||||||
).toContainText( `$${ doubleProductsPrice.toString() }` );
|
).toContainText( `$${ doubleProductsPrice.toString() }` );
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'button' ).filter( { hasText: '+', exact: true } )
|
page
|
||||||
|
.getByRole( 'button' )
|
||||||
|
.filter( { hasText: '+', exact: true } )
|
||||||
).toBeDisabled();
|
).toBeDisabled();
|
||||||
|
|
||||||
// add cross-sell products to cart
|
// add cross-sell products to cart
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'heading', { name: 'You may be interested in…' } )
|
page.getByRole( 'heading', {
|
||||||
|
name: 'You may be interested in…',
|
||||||
|
} )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await page
|
await page
|
||||||
.getByLabel( `Add to cart: “${ simpleProductName } Cross-Sell 1”` )
|
.getByLabel(
|
||||||
|
`Add to cart: “${ simpleProductName } Cross-Sell 1”`
|
||||||
|
)
|
||||||
.click();
|
.click();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
|
@ -139,7 +148,9 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
.getByText( `${ simpleProductName } Cross-Sell 1` )
|
.getByText( `${ simpleProductName } Cross-Sell 1` )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await page
|
await page
|
||||||
.getByLabel( `Add to cart: “${ simpleProductName } Cross-Sell 2”` )
|
.getByLabel(
|
||||||
|
`Add to cart: “${ simpleProductName } Cross-Sell 2”`
|
||||||
|
)
|
||||||
.click();
|
.click();
|
||||||
await expect(
|
await expect(
|
||||||
page
|
page
|
||||||
|
@ -152,7 +163,9 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
page.getByRole( 'heading', { name: testPage.title } )
|
page.getByRole( 'heading', { name: testPage.title } )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'heading', { name: 'You may be interested in…' } )
|
page.getByRole( 'heading', {
|
||||||
|
name: 'You may be interested in…',
|
||||||
|
} )
|
||||||
).toBeHidden();
|
).toBeHidden();
|
||||||
await expect(
|
await expect(
|
||||||
page.locator(
|
page.locator(
|
||||||
|
@ -166,7 +179,9 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
await page.locator( ':nth-match(:text("Remove item"), 3)' ).click();
|
await page.locator( ':nth-match(:text("Remove item"), 3)' ).click();
|
||||||
await page.locator( ':nth-match(:text("Remove item"), 2)' ).click();
|
await page.locator( ':nth-match(:text("Remove item"), 2)' ).click();
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'heading', { name: 'You may be interested in…' } )
|
page.getByRole( 'heading', {
|
||||||
|
name: 'You may be interested in…',
|
||||||
|
} )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
// check if the link to proceed to the checkout exists
|
// check if the link to proceed to the checkout exists
|
||||||
|
@ -184,5 +199,6 @@ test.describe( 'Cart Block page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
await expect(
|
await expect(
|
||||||
page.getByRole( 'link', { name: 'Browse store' } )
|
page.getByRole( 'link', { name: 'Browse store' } )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
} );
|
} );
|
||||||
|
|
|
@ -125,9 +125,10 @@ test.describe(
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'allows customer to calculate Free Shipping if in Germany', async ( {
|
test(
|
||||||
page,
|
'allows customer to calculate Free Shipping if in Germany',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
// Set shipping country to Germany
|
// Set shipping country to Germany
|
||||||
await page.locator( 'a.shipping-calculator-button' ).click();
|
await page.locator( 'a.shipping-calculator-button' ).click();
|
||||||
|
@ -143,11 +144,13 @@ test.describe(
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.order-total .amount' )
|
page.locator( '.order-total .amount' )
|
||||||
).toContainText( firstProductPrice );
|
).toContainText( firstProductPrice );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'allows customer to calculate Flat rate and Local pickup if in France', async ( {
|
test(
|
||||||
page,
|
'allows customer to calculate Flat rate and Local pickup if in France',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
// Set shipping country to France
|
// Set shipping country to France
|
||||||
await page.locator( 'a.shipping-calculator-button' ).click();
|
await page.locator( 'a.shipping-calculator-button' ).click();
|
||||||
|
@ -157,9 +160,9 @@ test.describe(
|
||||||
await page.locator( 'button[name="calc_shipping"]' ).click();
|
await page.locator( 'button[name="calc_shipping"]' ).click();
|
||||||
|
|
||||||
// Verify shipping costs
|
// Verify shipping costs
|
||||||
await expect( page.locator( '.shipping .amount' ) ).toContainText(
|
await expect(
|
||||||
'$5.00'
|
page.locator( '.shipping .amount' )
|
||||||
);
|
).toContainText( '$5.00' );
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.order-total .amount' )
|
page.locator( '.order-total .amount' )
|
||||||
).toContainText( `$${ firstProductWithFlatRate }` );
|
).toContainText( `$${ firstProductWithFlatRate }` );
|
||||||
|
@ -171,11 +174,13 @@ test.describe(
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.order-total .amount' ).first()
|
page.locator( '.order-total .amount' ).first()
|
||||||
).toContainText( `$${ firstProductPrice }` );
|
).toContainText( `$${ firstProductPrice }` );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should show correct total cart price after updating quantity', async ( {
|
test(
|
||||||
page,
|
'should show correct total cart price after updating quantity',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await page.locator( 'input.qty' ).fill( '4' );
|
await page.locator( 'input.qty' ).fill( '4' );
|
||||||
await page.locator( 'text=Update cart' ).click();
|
await page.locator( 'text=Update cart' ).click();
|
||||||
|
@ -190,11 +195,13 @@ test.describe(
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.order-total .amount' )
|
page.locator( '.order-total .amount' )
|
||||||
).toContainText( `$${ fourProductsWithFlatRate }` );
|
).toContainText( `$${ fourProductsWithFlatRate }` );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should show correct total cart price with 2 products and flat rate', async ( {
|
test(
|
||||||
page,
|
'should show correct total cart price with 2 products and flat rate',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await addAProductToCart( page, secondProductId );
|
await addAProductToCart( page, secondProductId );
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
|
@ -204,29 +211,34 @@ test.describe(
|
||||||
.selectOption( shippingCountryFR );
|
.selectOption( shippingCountryFR );
|
||||||
await page.locator( 'button[name="calc_shipping"]' ).click();
|
await page.locator( 'button[name="calc_shipping"]' ).click();
|
||||||
|
|
||||||
await expect( page.locator( '.shipping .amount' ) ).toContainText(
|
await expect(
|
||||||
'$5.00'
|
page.locator( '.shipping .amount' )
|
||||||
);
|
).toContainText( '$5.00' );
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.order-total .amount' )
|
page.locator( '.order-total .amount' )
|
||||||
).toContainText( `$${ twoProductsWithFlatRate }` );
|
).toContainText( `$${ twoProductsWithFlatRate }` );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should show correct total cart price with 2 products without flat rate', async ( {
|
test(
|
||||||
page,
|
'should show correct total cart price with 2 products without flat rate',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await addAProductToCart( page, secondProductId );
|
await addAProductToCart( page, secondProductId );
|
||||||
|
|
||||||
// Set shipping country to Spain
|
// Set shipping country to Spain
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await page.locator( 'a.shipping-calculator-button' ).click();
|
await page.locator( 'a.shipping-calculator-button' ).click();
|
||||||
await page.locator( '#calc_shipping_country' ).selectOption( 'ES' );
|
await page
|
||||||
|
.locator( '#calc_shipping_country' )
|
||||||
|
.selectOption( 'ES' );
|
||||||
await page.locator( 'button[name="calc_shipping"]' ).click();
|
await page.locator( 'button[name="calc_shipping"]' ).click();
|
||||||
|
|
||||||
// Verify shipping costs
|
// Verify shipping costs
|
||||||
await expect(
|
await expect(
|
||||||
page.locator( '.order-total .amount' )
|
page.locator( '.order-total .amount' )
|
||||||
).toContainText( `$${ twoProductsTotal }` );
|
).toContainText( `$${ twoProductsTotal }` );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -38,7 +38,7 @@ let productId,
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Shopper Cart & Checkout Block Tax Display',
|
'Shopper Cart & Checkout Block Tax Display',
|
||||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
{ tag: [ '@payments', '@services', '@hpos', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
test.use( { storageState: process.env.ADMINSTATE } );
|
test.use( { storageState: process.env.ADMINSTATE } );
|
||||||
test.beforeAll( async ( { baseURL } ) => {
|
test.beforeAll( async ( { baseURL } ) => {
|
||||||
|
@ -240,7 +240,7 @@ test.describe(
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Shopper Cart & Checkout Block Tax Rounding',
|
'Shopper Cart & Checkout Block Tax Rounding',
|
||||||
{ tag: [ '@payments', '@services' ] },
|
{ tag: [ '@payments', '@services', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
test.beforeAll( async ( { baseURL } ) => {
|
test.beforeAll( async ( { baseURL } ) => {
|
||||||
const api = new wcApi( {
|
const api = new wcApi( {
|
||||||
|
@ -484,7 +484,7 @@ test.describe(
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Shopper Cart & Checkout Block Tax Levels',
|
'Shopper Cart & Checkout Block Tax Levels',
|
||||||
{ tag: [ '@payments', '@services' ] },
|
{ tag: [ '@payments', '@services', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
test.beforeAll( async ( { baseURL } ) => {
|
test.beforeAll( async ( { baseURL } ) => {
|
||||||
const api = new wcApi( {
|
const api = new wcApi( {
|
||||||
|
@ -809,7 +809,7 @@ test.describe(
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Shipping Cart & Checkout Block Tax',
|
'Shipping Cart & Checkout Block Tax',
|
||||||
{ tag: [ '@payments', '@services' ] },
|
{ tag: [ '@payments', '@services', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
test.beforeAll( async ( { baseURL } ) => {
|
test.beforeAll( async ( { baseURL } ) => {
|
||||||
const api = new wcApi( {
|
const api = new wcApi( {
|
||||||
|
|
|
@ -24,7 +24,7 @@ let productId,
|
||||||
|
|
||||||
test.describe.serial(
|
test.describe.serial(
|
||||||
'Tax rates in the cart and checkout',
|
'Tax rates in the cart and checkout',
|
||||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
{ tag: [ '@payments', '@services', '@hpos', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
test.beforeAll( async ( { baseURL } ) => {
|
test.beforeAll( async ( { baseURL } ) => {
|
||||||
const api = new wcApi( {
|
const api = new wcApi( {
|
||||||
|
|
|
@ -306,15 +306,17 @@ test.describe(
|
||||||
} );
|
} );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
test( 'restores total when coupons are removed', async ( {
|
test(
|
||||||
page,
|
'restores total when coupons are removed',
|
||||||
context,
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
} ) => {
|
async ( { page, context } ) => {
|
||||||
await test.step( 'Load cart page and try restoring total when removed coupons', async () => {
|
await test.step( 'Load cart page and try restoring total when removed coupons', async () => {
|
||||||
await addAProductToCart( page, firstProductId );
|
await addAProductToCart( page, firstProductId );
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await page.locator( '#coupon_code' ).fill( coupons[ 0 ].code );
|
await page
|
||||||
|
.locator( '#coupon_code' )
|
||||||
|
.fill( coupons[ 0 ].code );
|
||||||
await page
|
await page
|
||||||
.getByRole( 'button', { name: 'Apply coupon' } )
|
.getByRole( 'button', { name: 'Apply coupon' } )
|
||||||
.click();
|
.click();
|
||||||
|
@ -343,7 +345,9 @@ test.describe(
|
||||||
await page
|
await page
|
||||||
.locator( 'text=Click here to enter your code' )
|
.locator( 'text=Click here to enter your code' )
|
||||||
.click();
|
.click();
|
||||||
await page.locator( '#coupon_code' ).fill( coupons[ 0 ].code );
|
await page
|
||||||
|
.locator( '#coupon_code' )
|
||||||
|
.fill( coupons[ 0 ].code );
|
||||||
await page.locator( 'text=Apply coupon' ).click();
|
await page.locator( 'text=Apply coupon' ).click();
|
||||||
|
|
||||||
// confirm numbers
|
// confirm numbers
|
||||||
|
@ -360,6 +364,7 @@ test.describe(
|
||||||
page.locator( '.order-total .amount' )
|
page.locator( '.order-total .amount' )
|
||||||
).toContainText( '$20.00' );
|
).toContainText( '$20.00' );
|
||||||
} );
|
} );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -17,7 +17,7 @@ const awaitCartPageResponse = ( page ) =>
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Cart & Checkout Restricted Coupons',
|
'Cart & Checkout Restricted Coupons',
|
||||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
{ tag: [ '@payments', '@services', '@hpos', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
let firstProductId,
|
let firstProductId,
|
||||||
secondProductId,
|
secondProductId,
|
||||||
|
|
|
@ -3,7 +3,7 @@ const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||||
|
|
||||||
test.describe(
|
test.describe(
|
||||||
'Cart > Redirect to cart from shop',
|
'Cart > Redirect to cart from shop',
|
||||||
{ tag: [ '@payments', '@services' ] },
|
{ tag: [ '@payments', '@services', '@not-e2e' ] },
|
||||||
() => {
|
() => {
|
||||||
let productId;
|
let productId;
|
||||||
const productName = 'A redirect product test';
|
const productName = 'A redirect product test';
|
||||||
|
|
|
@ -81,27 +81,34 @@ test.describe( 'Cart page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
await responsePromise;
|
await responsePromise;
|
||||||
}
|
}
|
||||||
|
|
||||||
test( 'should display no item in the cart', async ( { page } ) => {
|
test(
|
||||||
|
'should display no item in the cart',
|
||||||
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( 'Your cart is currently empty.' )
|
page.getByText( 'Your cart is currently empty.' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should add the product to the cart from the shop page', async ( {
|
test(
|
||||||
page,
|
'should add the product to the cart from the shop page',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await goToShopPageAndAddProductToCart( page, productName );
|
await goToShopPageAndAddProductToCart( page, productName );
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await expect( page.locator( 'td.product-name' ) ).toContainText(
|
await expect( page.locator( 'td.product-name' ) ).toContainText(
|
||||||
productName
|
productName
|
||||||
);
|
);
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should increase item quantity when "Add to cart" of the same product is clicked', async ( {
|
test(
|
||||||
page,
|
'should increase item quantity when "Add to cart" of the same product is clicked',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
let qty = 2;
|
let qty = 2;
|
||||||
while ( qty-- ) {
|
while ( qty-- ) {
|
||||||
await goToShopPageAndAddProductToCart( page, productName );
|
await goToShopPageAndAddProductToCart( page, productName );
|
||||||
|
@ -109,32 +116,36 @@ test.describe( 'Cart page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await expect( page.locator( 'input.qty' ) ).toHaveValue( '2' );
|
await expect( page.locator( 'input.qty' ) ).toHaveValue( '2' );
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should update quantity when updated via quantity input', async ( {
|
test(
|
||||||
page,
|
'should update quantity when updated via quantity input',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await goToShopPageAndAddProductToCart( page, productName );
|
await goToShopPageAndAddProductToCart( page, productName );
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await page.locator( 'input.qty' ).fill( '2' );
|
await page.locator( 'input.qty' ).fill( '2' );
|
||||||
await page.locator( 'text=Update cart' ).click();
|
await page.locator( 'text=Update cart' ).click();
|
||||||
|
|
||||||
await expect( page.locator( '.order-total .amount' ) ).toContainText(
|
await expect(
|
||||||
`$${ twoProductPrice }`
|
page.locator( '.order-total .amount' )
|
||||||
|
).toContainText( `$${ twoProductPrice }` );
|
||||||
|
}
|
||||||
);
|
);
|
||||||
} );
|
|
||||||
|
|
||||||
test( 'should remove the item from the cart when remove is clicked', async ( {
|
test(
|
||||||
page,
|
'should remove the item from the cart when remove is clicked',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await goToShopPageAndAddProductToCart( page, productName );
|
await goToShopPageAndAddProductToCart( page, productName );
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
|
|
||||||
// make sure that the product is in the cart
|
// make sure that the product is in the cart
|
||||||
await expect( page.locator( '.order-total .amount' ) ).toContainText(
|
await expect(
|
||||||
`$${ productPrice }`
|
page.locator( '.order-total .amount' )
|
||||||
);
|
).toContainText( `$${ productPrice }` );
|
||||||
|
|
||||||
await page.locator( 'a.remove' ).click();
|
await page.locator( 'a.remove' ).click();
|
||||||
|
|
||||||
|
@ -144,29 +155,33 @@ test.describe( 'Cart page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
await expect(
|
await expect(
|
||||||
page.getByText( 'Your cart is currently empty' )
|
page.getByText( 'Your cart is currently empty' )
|
||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'should update subtotal in cart totals when adding product to the cart', async ( {
|
test(
|
||||||
page,
|
'should update subtotal in cart totals when adding product to the cart',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await goToShopPageAndAddProductToCart( page, productName );
|
await goToShopPageAndAddProductToCart( page, productName );
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
await expect( page.locator( '.cart-subtotal .amount' ) ).toContainText(
|
await expect(
|
||||||
`$${ productPrice }`
|
page.locator( '.cart-subtotal .amount' )
|
||||||
);
|
).toContainText( `$${ productPrice }` );
|
||||||
|
|
||||||
await page.locator( 'input.qty' ).fill( '2' );
|
await page.locator( 'input.qty' ).fill( '2' );
|
||||||
await page.locator( 'text=Update cart' ).click();
|
await page.locator( 'text=Update cart' ).click();
|
||||||
|
|
||||||
await expect( page.locator( '.order-total .amount' ) ).toContainText(
|
await expect(
|
||||||
`$${ twoProductPrice }`
|
page.locator( '.order-total .amount' )
|
||||||
|
).toContainText( `$${ twoProductPrice }` );
|
||||||
|
}
|
||||||
);
|
);
|
||||||
} );
|
|
||||||
|
|
||||||
test( 'should go to the checkout page when "Proceed to Checkout" is clicked', async ( {
|
test(
|
||||||
page,
|
'should go to the checkout page when "Proceed to Checkout" is clicked',
|
||||||
} ) => {
|
{ tag: [ '@could-be-unit-test' ] },
|
||||||
|
async ( { page } ) => {
|
||||||
await goToShopPageAndAddProductToCart( page, productName );
|
await goToShopPageAndAddProductToCart( page, productName );
|
||||||
|
|
||||||
await page.goto( '/cart/' );
|
await page.goto( '/cart/' );
|
||||||
|
@ -174,7 +189,8 @@ test.describe( 'Cart page', { tag: [ '@payments', '@services' ] }, () => {
|
||||||
await page.locator( '.checkout-button' ).click();
|
await page.locator( '.checkout-button' ).click();
|
||||||
|
|
||||||
await expect( page.locator( '#order_review' ) ).toBeVisible();
|
await expect( page.locator( '#order_review' ) ).toBeVisible();
|
||||||
} );
|
}
|
||||||
|
);
|
||||||
|
|
||||||
test( 'can manage cross-sell products and maximum item quantity', async ( {
|
test( 'can manage cross-sell products and maximum item quantity', async ( {
|
||||||
page,
|
page,
|
||||||
|
|
|
@ -72,10 +72,7 @@ async function runComingSoonTests( themeContext = '' ) {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
test.describe(
|
test.describe( 'Launch Your Store front end - logged out', () => {
|
||||||
'Launch Your Store front end - logged out',
|
|
||||||
{ tag: [ '@payments', '@services' ] },
|
|
||||||
() => {
|
|
||||||
test.afterAll( async ( { baseURL } ) => {
|
test.afterAll( async ( { baseURL } ) => {
|
||||||
try {
|
try {
|
||||||
await setOption(
|
await setOption(
|
||||||
|
@ -112,11 +109,6 @@ test.describe(
|
||||||
await activateTheme( DEFAULT_THEME );
|
await activateTheme( DEFAULT_THEME );
|
||||||
} );
|
} );
|
||||||
|
|
||||||
runComingSoonTests(
|
runComingSoonTests( test.step, test.use, 'Classic Theme (Storefront)' );
|
||||||
test.step,
|
} );
|
||||||
test.use,
|
|
||||||
'Classic Theme (Storefront)'
|
|
||||||
);
|
|
||||||
} );
|
} );
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
|
@ -3,7 +3,7 @@ const { test, expect } = require( '@playwright/test' );
|
||||||
// test case for bug https://github.com/woocommerce/woocommerce/pull/46429
|
// test case for bug https://github.com/woocommerce/woocommerce/pull/46429
|
||||||
test.describe(
|
test.describe(
|
||||||
'Check the title of the shop page after the page has been deleted',
|
'Check the title of the shop page after the page has been deleted',
|
||||||
{ tag: [ '@payments', '@services' ] },
|
{ tag: [ '@payments', '@services', '@could-be-unit-test' ] },
|
||||||
() => {
|
() => {
|
||||||
test.use( { storageState: process.env.ADMINSTATE } );
|
test.use( { storageState: process.env.ADMINSTATE } );
|
||||||
test.beforeEach( async ( { page } ) => {
|
test.beforeEach( async ( { page } ) => {
|
||||||
|
|
|
@ -6,7 +6,7 @@ const test = baseTest.extend( {
|
||||||
|
|
||||||
test(
|
test(
|
||||||
'logged-in customer can comment on a post',
|
'logged-in customer can comment on a post',
|
||||||
{ tag: [ '@gutenberg', '@payments', '@services' ] },
|
{ tag: [ '@non-critical' ] },
|
||||||
async ( { page } ) => {
|
async ( { page } ) => {
|
||||||
await page.goto( 'hello-world/' );
|
await page.goto( 'hello-world/' );
|
||||||
await expect(
|
await expect(
|
||||||
|
|
Loading…
Reference in New Issue