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