Fix/e2e tests timeout issue (https://github.com/woocommerce/woocommerce-blocks/pull/6165)
* Increase timeout of translations test to 30000 * Wait for network idle in goToCart and goToCheckout * Increase timeout to 30000 * fix E2E tests * try fix * test * test * test * another test * fix test * 60s timeout * test * Update product constants * Simplify orderSummary check * Go back to page.$ Co-authored-by: Luigi <gigitux@gmail.com>
This commit is contained in:
parent
0c7c2db6c0
commit
6c2d24e3e5
|
@ -2,7 +2,7 @@
|
||||||
* Internal dependencies
|
* Internal dependencies
|
||||||
*/
|
*/
|
||||||
import { shopper } from '../../../utils';
|
import { shopper } from '../../../utils';
|
||||||
import { SIMPLE_PRODUCT_NAME } from '../../../utils/constants';
|
import { SIMPLE_VIRTUAL_PRODUCT_NAME } from '../../../utils/constants';
|
||||||
|
|
||||||
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) {
|
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) {
|
||||||
// eslint-disable-next-line jest/no-focused-tests
|
// eslint-disable-next-line jest/no-focused-tests
|
||||||
|
@ -12,7 +12,7 @@ if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 ) {
|
||||||
describe( 'Shopper → Cart/Checkout → Can use express checkout', () => {
|
describe( 'Shopper → Cart/Checkout → Can use express checkout', () => {
|
||||||
it( 'Express Payment button is available on both Cart & Checkout pages', async () => {
|
it( 'Express Payment button is available on both Cart & Checkout pages', async () => {
|
||||||
await shopper.goToShop();
|
await shopper.goToShop();
|
||||||
await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME );
|
await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME );
|
||||||
await shopper.block.goToCart();
|
await shopper.block.goToCart();
|
||||||
await shopper.block.mockExpressPaymentMethod();
|
await shopper.block.mockExpressPaymentMethod();
|
||||||
// We need to re-render the cart for the express payments block to be updated,
|
// We need to re-render the cart for the express payments block to be updated,
|
||||||
|
|
|
@ -46,24 +46,31 @@ describe( 'Shopper → Cart → Can view translated cart & checkout blocks', ()
|
||||||
await shopper.goToShop();
|
await shopper.goToShop();
|
||||||
await shopper.addToCartFromShopPage( '128GB USB Stick' );
|
await shopper.addToCartFromShopPage( '128GB USB Stick' );
|
||||||
await shopper.block.goToCart();
|
await shopper.block.goToCart();
|
||||||
const productHeader = await page.$(
|
|
||||||
|
await page.waitForSelector( '.wp-block-woocommerce-filled-cart-block' );
|
||||||
|
|
||||||
|
const productHeader = await page.waitForSelector(
|
||||||
'.wc-block-cart-items .wc-block-cart-items__header span'
|
'.wc-block-cart-items .wc-block-cart-items__header span'
|
||||||
);
|
);
|
||||||
await expect( productHeader ).toMatch( 'Produit', { timeout: 2000 } );
|
await expect( productHeader ).toMatch( 'Produit' );
|
||||||
|
|
||||||
const removeLink = await page.$( '.wc-block-cart-item__remove-link' );
|
const removeLink = await page.waitForSelector(
|
||||||
|
'.wc-block-cart-item__remove-link'
|
||||||
|
);
|
||||||
await expect( removeLink ).toMatch( 'Retirer l’élément' );
|
await expect( removeLink ).toMatch( 'Retirer l’élément' );
|
||||||
|
|
||||||
const submitButton = await page.$( '.wc-block-cart__submit-button' );
|
const submitButton = await page.waitForSelector(
|
||||||
|
'.wc-block-cart__submit-button'
|
||||||
|
);
|
||||||
await expect( submitButton ).toMatch( 'Procéder au paiement' );
|
await expect( submitButton ).toMatch( 'Procéder au paiement' );
|
||||||
|
|
||||||
const orderSummary = await page.$(
|
const orderSummary = await page.$(
|
||||||
'.wp-block-woocommerce-cart-order-summary-block'
|
'.wp-block-woocommerce-cart-order-summary-block'
|
||||||
);
|
);
|
||||||
|
|
||||||
await expect( orderSummary ).toMatch( 'Total panier' );
|
await expect( orderSummary ).toMatch( 'Total panier' );
|
||||||
await expect( orderSummary ).toMatch( 'Sous-total' );
|
await expect( orderSummary ).toMatch( 'Sous-total' );
|
||||||
await expect( orderSummary ).toMatch( 'Coupon code' );
|
await expect( orderSummary ).toMatch( 'Coupon code' );
|
||||||
await expect( orderSummary ).toMatch( 'Appliquer un code promo' );
|
|
||||||
} );
|
} );
|
||||||
|
|
||||||
it( 'should be able to view translated Checkout block', async () => {
|
it( 'should be able to view translated Checkout block', async () => {
|
||||||
|
@ -72,9 +79,7 @@ describe( 'Shopper → Cart → Can view translated cart & checkout blocks', ()
|
||||||
const contactHeading = await page.$(
|
const contactHeading = await page.$(
|
||||||
'#contact-fields .wc-block-components-checkout-step__title'
|
'#contact-fields .wc-block-components-checkout-step__title'
|
||||||
);
|
);
|
||||||
await expect( contactHeading ).toMatch( 'Coordonnées', {
|
await expect( contactHeading ).toMatch( 'Coordonnées' );
|
||||||
timeout: 2000,
|
|
||||||
} );
|
|
||||||
|
|
||||||
const shippingHeading = await page.$(
|
const shippingHeading = await page.$(
|
||||||
'#shipping-fields .wc-block-components-checkout-step__title'
|
'#shipping-fields .wc-block-components-checkout-step__title'
|
||||||
|
|
|
@ -23,8 +23,11 @@ import {
|
||||||
reactivateCompatibilityNotice,
|
reactivateCompatibilityNotice,
|
||||||
} from '../../../utils';
|
} from '../../../utils';
|
||||||
|
|
||||||
import { BILLING_DETAILS, SHIPPING_DETAILS } from '../../../utils/constants';
|
import {
|
||||||
const SIMPLE_PRODUCT_NAME = '128GB USB Stick';
|
BILLING_DETAILS,
|
||||||
|
SHIPPING_DETAILS,
|
||||||
|
SIMPLE_PHYSICAL_PRODUCT_NAME,
|
||||||
|
} from '../../../utils/constants';
|
||||||
|
|
||||||
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
|
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
|
||||||
// eslint-disable-next-line jest/no-focused-tests
|
// eslint-disable-next-line jest/no-focused-tests
|
||||||
|
@ -71,7 +74,7 @@ describe( 'Shopper → Checkout → Can have different shipping and billing addr
|
||||||
|
|
||||||
it( 'allows customer to have different shipping and billing addresses', async () => {
|
it( 'allows customer to have different shipping and billing addresses', async () => {
|
||||||
await shopper.goToShop();
|
await shopper.goToShop();
|
||||||
await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME );
|
await shopper.addToCartFromShopPage( SIMPLE_PHYSICAL_PRODUCT_NAME );
|
||||||
await shopper.block.goToCheckout();
|
await shopper.block.goToCheckout();
|
||||||
await unsetCheckbox( '#checkbox-control-0' );
|
await unsetCheckbox( '#checkbox-control-0' );
|
||||||
await shopper.block.fillShippingDetails( SHIPPING_DETAILS );
|
await shopper.block.fillShippingDetails( SHIPPING_DETAILS );
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
*/
|
*/
|
||||||
import { shopper } from '../../../utils';
|
import { shopper } from '../../../utils';
|
||||||
import {
|
import {
|
||||||
SIMPLE_PRODUCT_NAME,
|
SIMPLE_VIRTUAL_PRODUCT_NAME,
|
||||||
CUSTOMER_USERNAME,
|
CUSTOMER_USERNAME,
|
||||||
CUSTOMER_PASSWORD,
|
CUSTOMER_PASSWORD,
|
||||||
} from '../../../utils/constants';
|
} from '../../../utils/constants';
|
||||||
|
@ -48,7 +48,7 @@ describe( 'Shopper → Checkout → Can see warnings when form is incomplete', (
|
||||||
|
|
||||||
it( 'Shows warnings when form is incomplete', async () => {
|
it( 'Shows warnings when form is incomplete', async () => {
|
||||||
await shopper.goToShop();
|
await shopper.goToShop();
|
||||||
await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME );
|
await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME );
|
||||||
await shopper.block.goToCheckout();
|
await shopper.block.goToCheckout();
|
||||||
|
|
||||||
// Click on "Place Order" button
|
// Click on "Place Order" button
|
||||||
|
|
|
@ -8,7 +8,7 @@ import { withRestApi } from '@woocommerce/e2e-utils';
|
||||||
*/
|
*/
|
||||||
import { shopper } from '../../../utils';
|
import { shopper } from '../../../utils';
|
||||||
import { createCoupon } from '../../utils';
|
import { createCoupon } from '../../utils';
|
||||||
import { SIMPLE_PRODUCT_NAME } from '../../../utils/constants';
|
import { SIMPLE_VIRTUAL_PRODUCT_NAME } from '../../../utils/constants';
|
||||||
|
|
||||||
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
|
if ( process.env.WOOCOMMERCE_BLOCKS_PHASE < 2 )
|
||||||
// eslint-disable-next-line jest/no-focused-tests
|
// eslint-disable-next-line jest/no-focused-tests
|
||||||
|
@ -29,7 +29,7 @@ afterAll( async () => {
|
||||||
describe( 'Shopper → Checkout → Can apply single-use coupon once', () => {
|
describe( 'Shopper → Checkout → Can apply single-use coupon once', () => {
|
||||||
it( 'allows checkout to apply single-use coupon once', async () => {
|
it( 'allows checkout to apply single-use coupon once', async () => {
|
||||||
await shopper.goToShop();
|
await shopper.goToShop();
|
||||||
await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME );
|
await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME );
|
||||||
await shopper.block.goToCheckout();
|
await shopper.block.goToCheckout();
|
||||||
await shopper.block.applyCouponFromCheckout( coupon.code );
|
await shopper.block.applyCouponFromCheckout( coupon.code );
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ describe( 'Shopper → Checkout → Can apply single-use coupon once', () => {
|
||||||
|
|
||||||
it( 'Prevents checkout applying single-use coupon twice', async () => {
|
it( 'Prevents checkout applying single-use coupon twice', async () => {
|
||||||
await shopper.goToShop();
|
await shopper.goToShop();
|
||||||
await shopper.addToCartFromShopPage( SIMPLE_PRODUCT_NAME );
|
await shopper.addToCartFromShopPage( SIMPLE_VIRTUAL_PRODUCT_NAME );
|
||||||
await shopper.block.goToCheckout();
|
await shopper.block.goToCheckout();
|
||||||
await shopper.block.applyCouponFromCheckout( coupon.code );
|
await shopper.block.applyCouponFromCheckout( coupon.code );
|
||||||
await expect( page ).toMatch( 'Coupon usage limit has been reached.' );
|
await expect( page ).toMatch( 'Coupon usage limit has been reached.' );
|
||||||
|
|
Loading…
Reference in New Issue