[e2e tests] Add hpos disabled environment and tag tests (#50448)
This commit is contained in:
parent
49e11aa25b
commit
e82f1ea98f
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: dev
|
||||
|
||||
E2E tests: add hpos-disabled env and tagged tests with hpos tag
|
|
@ -329,14 +329,8 @@
|
|||
{
|
||||
"name": "Core e2e tests - HPOS disabled",
|
||||
"testType": "e2e",
|
||||
"command": "test:e2e",
|
||||
"shardingArguments": [
|
||||
"--shard=1/5",
|
||||
"--shard=2/5",
|
||||
"--shard=3/5",
|
||||
"--shard=4/5",
|
||||
"--shard=5/5"
|
||||
],
|
||||
"command": "test:e2e:with-env default-hpos-disabled --project=ui",
|
||||
"shardingArguments": [],
|
||||
"events": [
|
||||
"daily-checks",
|
||||
"release-checks"
|
||||
|
@ -349,7 +343,7 @@
|
|||
}
|
||||
},
|
||||
"report": {
|
||||
"resultsBlobName": "core-e2e-reports-non-hpos",
|
||||
"resultsBlobName": "core-e2e-reports-hpos-disabled",
|
||||
"resultsPath": "tests/e2e-pw/test-results",
|
||||
"allure": true
|
||||
}
|
||||
|
@ -443,7 +437,7 @@
|
|||
{
|
||||
"name": "Core API tests - HPOS disabled",
|
||||
"testType": "api",
|
||||
"command": "test:api",
|
||||
"command": "test:e2e:with-env default-hpos-disabled --project=api",
|
||||
"optional": false,
|
||||
"changes": [
|
||||
"client/admin/config/*.json",
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -eo pipefail
|
||||
|
||||
echo "Default environment setup."
|
|
@ -0,0 +1,20 @@
|
|||
let config = require( '../../playwright.config.js' );
|
||||
|
||||
process.env.USE_WP_ENV = 'true';
|
||||
process.env.DISABLE_HPOS = '1';
|
||||
|
||||
config = {
|
||||
...config,
|
||||
projects: [
|
||||
{
|
||||
name: 'ui',
|
||||
grep: /@hpos/,
|
||||
},
|
||||
{
|
||||
name: 'api',
|
||||
testMatch: '**/api-tests/**',
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
module.exports = config;
|
|
@ -48,7 +48,7 @@ let simpleProductId,
|
|||
|
||||
test.describe(
|
||||
'WooCommerce Orders > Add new order',
|
||||
{ tag: '@services' },
|
||||
{ tag: [ '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ const productPrice = '15.99';
|
|||
|
||||
test.describe(
|
||||
'WooCommerce Merchant Flow: Orders > Customer Payment Page',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const { test, expect } = require( '@playwright/test' );
|
||||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
|
||||
test.describe( 'Bulk edit orders', { tag: '@services' }, () => {
|
||||
test.describe( 'Bulk edit orders', { tag: [ '@services', '@hpos' ] }, () => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
let orderId1, orderId2, orderId3, orderId4, orderId5;
|
||||
|
|
|
@ -11,7 +11,7 @@ const discountedPrice = ( productPrice - couponAmount ).toString();
|
|||
|
||||
test.describe(
|
||||
'WooCommerce Orders > Apply Coupon',
|
||||
{ tag: '@services' },
|
||||
{ tag: [ '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ const { test, expect } = require( '@playwright/test' );
|
|||
const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
||||
const uuid = require( 'uuid' );
|
||||
|
||||
test.describe( 'Edit order', { tag: '@services' }, () => {
|
||||
test.describe( 'Edit order', { tag: [ '@services', '@hpos' ] }, () => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
let orderId, orderToCancel;
|
||||
|
@ -286,7 +286,7 @@ test.describe( 'Edit order', { tag: '@services' }, () => {
|
|||
|
||||
test.describe(
|
||||
'Edit order > Downloadable product permissions',
|
||||
{ tag: '@services' },
|
||||
{ tag: [ '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
|||
|
||||
test.describe(
|
||||
'Merchant > Order Action emails received',
|
||||
{ tag: '@services' },
|
||||
{ tag: [ '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const wcApi = require( '@woocommerce/woocommerce-rest-api' ).default;
|
|||
|
||||
test.describe.serial(
|
||||
'WooCommerce Orders > Refund an order',
|
||||
{ tag: '@payments' },
|
||||
{ tag: [ '@payments', '@hpos' ] },
|
||||
() => {
|
||||
let productId, orderId, currencySymbol;
|
||||
|
||||
|
@ -147,7 +147,7 @@ test.describe.serial(
|
|||
|
||||
test.describe(
|
||||
'WooCommerce Orders > Refund and restock an order item',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
let productWithStockId, productWithNoStockId, orderId;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ const deleteCustomer = async ( api ) => {
|
|||
|
||||
test.describe(
|
||||
'WooCommerce Orders > Search orders',
|
||||
{ tag: '@services' },
|
||||
{ tag: [ '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -17,7 +17,7 @@ const orderStatus = [
|
|||
|
||||
test.describe(
|
||||
'WooCommerce Orders > Filter Order by Status',
|
||||
{ tag: '@services' },
|
||||
{ tag: [ '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
|
@ -38,7 +38,7 @@ let productId,
|
|||
|
||||
test.describe(
|
||||
'Shopper Cart & Checkout Block Tax Display',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
test.beforeAll( async ( { baseURL } ) => {
|
||||
|
|
|
@ -24,7 +24,7 @@ let productId,
|
|||
|
||||
test.describe.serial(
|
||||
'Tax rates in the cart and checkout',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.beforeAll( async ( { baseURL } ) => {
|
||||
const api = new wcApi( {
|
||||
|
|
|
@ -26,7 +26,7 @@ const totals = [ '$15.00', '$10.00', '$13.00' ];
|
|||
|
||||
test.describe(
|
||||
'Cart & Checkout applying coupons',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
let firstProductId;
|
||||
const couponBatchId = [];
|
||||
|
|
|
@ -10,7 +10,7 @@ const excludedCategoryName = 'Excluded Category';
|
|||
|
||||
test.describe(
|
||||
'Cart & Checkout Restricted Coupons',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
let firstProductId,
|
||||
secondProductId,
|
||||
|
|
|
@ -57,7 +57,7 @@ const test = baseTest.extend( {
|
|||
|
||||
test.describe(
|
||||
'Checkout Block page',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.beforeAll( async ( { baseURL } ) => {
|
||||
const api = new wcApi( {
|
||||
|
|
|
@ -24,7 +24,7 @@ const customer = {
|
|||
|
||||
test.describe(
|
||||
'Shopper Checkout Login Account',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
let productId, orderId, shippingZoneId, customerId;
|
||||
|
||||
|
|
|
@ -8,7 +8,10 @@ const { getOrderIdFromUrl } = require( '../../utils/order' );
|
|||
|
||||
const guestEmail = 'checkout-guest@example.com';
|
||||
|
||||
test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
||||
test.describe(
|
||||
'Checkout page',
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
const singleProductPrice = '9.99';
|
||||
const simpleProductName = 'Checkout Page Product';
|
||||
const twoProductPrice = ( singleProductPrice * 2 ).toString();
|
||||
|
@ -97,7 +100,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await api.delete( `orders/${ guestOrderId }`, { force: true } );
|
||||
}
|
||||
if ( customerOrderId ) {
|
||||
await api.delete( `orders/${ customerOrderId }`, { force: true } );
|
||||
await api.delete( `orders/${ customerOrderId }`, {
|
||||
force: true,
|
||||
} );
|
||||
}
|
||||
} );
|
||||
|
||||
|
@ -119,7 +124,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
} );
|
||||
} );
|
||||
|
||||
test( 'should display cart items in order review', async ( { page } ) => {
|
||||
test( 'should display cart items in order review', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
await addAProductToCart( page, productId );
|
||||
|
||||
await page.goto( '/checkout/' );
|
||||
|
@ -127,9 +134,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await expect( page.locator( 'td.product-name' ) ).toContainText(
|
||||
simpleProductName
|
||||
);
|
||||
await expect( page.locator( 'strong.product-quantity' ) ).toContainText(
|
||||
'1'
|
||||
);
|
||||
await expect(
|
||||
page.locator( 'strong.product-quantity' )
|
||||
).toContainText( '1' );
|
||||
let totalPrice = await page
|
||||
.getByRole( 'row', { name: 'Total' } )
|
||||
.last()
|
||||
|
@ -148,9 +155,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await addProductsToCart( page, simpleProductName, '2' );
|
||||
|
||||
await page.goto( '/checkout/' );
|
||||
await expect( page.locator( 'strong.product-quantity' ) ).toContainText(
|
||||
'2'
|
||||
);
|
||||
await expect(
|
||||
page.locator( 'strong.product-quantity' )
|
||||
).toContainText( '2' );
|
||||
let totalPrice = await page
|
||||
.getByRole( 'row', { name: 'Total' } )
|
||||
.last()
|
||||
|
@ -162,7 +169,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
);
|
||||
|
||||
// check the payment methods
|
||||
await expect( page.locator( '#payment_method_bacs' ) ).toBeEnabled();
|
||||
await expect(
|
||||
page.locator( '#payment_method_bacs' )
|
||||
).toBeEnabled();
|
||||
await expect( page.locator( '#payment_method_cod' ) ).toBeEnabled();
|
||||
} );
|
||||
|
||||
|
@ -171,9 +180,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await addProductsToCart( page, simpleProductName, '3' );
|
||||
|
||||
await page.goto( '/checkout/' );
|
||||
await expect( page.locator( 'strong.product-quantity' ) ).toContainText(
|
||||
'3'
|
||||
);
|
||||
await expect(
|
||||
page.locator( 'strong.product-quantity' )
|
||||
).toContainText( '3' );
|
||||
let totalPrice = await page
|
||||
.getByRole( 'row', { name: 'Total' } )
|
||||
.last()
|
||||
|
@ -185,7 +194,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
);
|
||||
|
||||
// asserting that you can fill in the billing details
|
||||
await expect( page.locator( '#billing_first_name' ) ).toBeEditable();
|
||||
await expect(
|
||||
page.locator( '#billing_first_name' )
|
||||
).toBeEditable();
|
||||
await expect( page.locator( '#billing_last_name' ) ).toBeEditable();
|
||||
await expect( page.locator( '#billing_company' ) ).toBeEditable();
|
||||
await expect( page.locator( '#billing_country' ) ).toBeEnabled();
|
||||
|
@ -264,13 +275,15 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
).toBeVisible();
|
||||
} );
|
||||
|
||||
test( 'allows customer to fill shipping details', async ( { page } ) => {
|
||||
test( 'allows customer to fill shipping details', async ( {
|
||||
page,
|
||||
} ) => {
|
||||
await addProductsToCart( page, simpleProductName, '2' );
|
||||
|
||||
await page.goto( '/checkout/' );
|
||||
await expect( page.locator( 'strong.product-quantity' ) ).toContainText(
|
||||
'2'
|
||||
);
|
||||
await expect(
|
||||
page.locator( 'strong.product-quantity' )
|
||||
).toContainText( '2' );
|
||||
let totalPrice = await page
|
||||
.getByRole( 'row', { name: 'Total' } )
|
||||
.last()
|
||||
|
@ -284,12 +297,20 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await page.locator( '#ship-to-different-address' ).click();
|
||||
|
||||
// asserting that you can fill in the shipping details
|
||||
await expect( page.locator( '#shipping_first_name' ) ).toBeEditable();
|
||||
await expect( page.locator( '#shipping_last_name' ) ).toBeEditable();
|
||||
await expect(
|
||||
page.locator( '#shipping_first_name' )
|
||||
).toBeEditable();
|
||||
await expect(
|
||||
page.locator( '#shipping_last_name' )
|
||||
).toBeEditable();
|
||||
await expect( page.locator( '#shipping_company' ) ).toBeEditable();
|
||||
await expect( page.locator( '#shipping_country' ) ).toBeEnabled();
|
||||
await expect( page.locator( '#shipping_address_1' ) ).toBeEditable();
|
||||
await expect( page.locator( '#shipping_address_2' ) ).toBeEditable();
|
||||
await expect(
|
||||
page.locator( '#shipping_address_1' )
|
||||
).toBeEditable();
|
||||
await expect(
|
||||
page.locator( '#shipping_address_2' )
|
||||
).toBeEditable();
|
||||
await expect( page.locator( '#shipping_city' ) ).toBeEditable();
|
||||
await expect( page.locator( '#shipping_state' ) ).toBeEnabled();
|
||||
await expect( page.locator( '#shipping_postcode' ) ).toBeEditable();
|
||||
|
@ -310,7 +331,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
.last()
|
||||
.locator( 'td' )
|
||||
.textContent();
|
||||
totalPrice = Number( totalPrice.replace( /\$([\d.]+).*/, '$1' ) );
|
||||
totalPrice = Number(
|
||||
totalPrice.replace( /\$([\d.]+).*/, '$1' )
|
||||
);
|
||||
await expect( totalPrice ).toBeGreaterThanOrEqual(
|
||||
Number( twoProductPrice )
|
||||
); // account for taxes or shipping that may be present
|
||||
|
@ -338,7 +361,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
|
||||
await page.getByText( 'Cash on delivery' ).click();
|
||||
|
||||
await page.getByRole( 'button', { name: 'Place order' } ).click();
|
||||
await page
|
||||
.getByRole( 'button', { name: 'Place order' } )
|
||||
.click();
|
||||
} );
|
||||
|
||||
await test.step( 'Load the order confirmation page, extract order number', async () => {
|
||||
|
@ -392,7 +417,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
)
|
||||
).toBeVisible();
|
||||
await expect(
|
||||
page.getByText( 'We were unable to verify the email address' )
|
||||
page.getByText(
|
||||
'We were unable to verify the email address'
|
||||
)
|
||||
).toBeVisible();
|
||||
} );
|
||||
|
||||
|
@ -409,8 +436,12 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
|
||||
await test.step( 'Confirm order details on the backend (as a merchant)', async () => {
|
||||
await page.goto( 'wp-login.php' );
|
||||
await page.locator( 'input[name="log"]' ).fill( admin.username );
|
||||
await page.locator( 'input[name="pwd"]' ).fill( admin.password );
|
||||
await page
|
||||
.locator( 'input[name="log"]' )
|
||||
.fill( admin.username );
|
||||
await page
|
||||
.locator( 'input[name="pwd"]' )
|
||||
.fill( admin.password );
|
||||
await page.locator( 'text=Log In' ).click();
|
||||
|
||||
// load the order placed as a guest
|
||||
|
@ -423,9 +454,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
name: `Order #${ guestOrderId } details`,
|
||||
} )
|
||||
).toBeVisible();
|
||||
await expect( page.locator( '.wc-order-item-name' ) ).toContainText(
|
||||
simpleProductName
|
||||
);
|
||||
await expect(
|
||||
page.locator( '.wc-order-item-name' )
|
||||
).toContainText( simpleProductName );
|
||||
await expect(
|
||||
page.locator( 'td.quantity >> nth=0' )
|
||||
).toContainText( '2' );
|
||||
|
@ -457,9 +488,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await addProductsToCart( page, simpleProductName, '2' );
|
||||
|
||||
await page.goto( '/checkout/' );
|
||||
await expect( page.locator( 'strong.product-quantity' ) ).toContainText(
|
||||
'2'
|
||||
);
|
||||
await expect(
|
||||
page.locator( 'strong.product-quantity' )
|
||||
).toContainText( '2' );
|
||||
let totalPrice = await page
|
||||
.getByRole( 'row', { name: 'Total' } )
|
||||
.last()
|
||||
|
@ -483,7 +514,9 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await page.locator( '#billing_email' ).fill( customer.email );
|
||||
|
||||
await page.locator( 'text=Cash on delivery' ).click();
|
||||
await expect( page.locator( 'div.payment_method_cod' ) ).toBeVisible();
|
||||
await expect(
|
||||
page.locator( 'div.payment_method_cod' )
|
||||
).toBeVisible();
|
||||
|
||||
await page.locator( 'text=Place order' ).click();
|
||||
|
||||
|
@ -520,14 +553,15 @@ test.describe( 'Checkout page', { tag: [ '@payments', '@services' ] }, () => {
|
|||
await expect( page.locator( '.wc-order-item-name' ) ).toContainText(
|
||||
simpleProductName
|
||||
);
|
||||
await expect( page.locator( 'td.quantity >> nth=0' ) ).toContainText(
|
||||
'2'
|
||||
);
|
||||
await expect( page.locator( 'td.item_cost >> nth=0' ) ).toContainText(
|
||||
singleProductPrice
|
||||
);
|
||||
await expect( page.locator( 'td.line_cost >> nth=0' ) ).toContainText(
|
||||
twoProductPrice
|
||||
);
|
||||
} );
|
||||
await expect(
|
||||
page.locator( 'td.quantity >> nth=0' )
|
||||
).toContainText( '2' );
|
||||
await expect(
|
||||
page.locator( 'td.item_cost >> nth=0' )
|
||||
).toContainText( singleProductPrice );
|
||||
await expect(
|
||||
page.locator( 'td.line_cost >> nth=0' )
|
||||
).toContainText( twoProductPrice );
|
||||
} );
|
||||
}
|
||||
);
|
||||
|
|
|
@ -10,7 +10,7 @@ const customer = {
|
|||
|
||||
test.describe(
|
||||
'Customer can pay for their order through My Account',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
let productId, orderId;
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ const storeName = 'WooCommerce Core E2E Test Suite';
|
|||
|
||||
test.describe(
|
||||
'Shopper Order Email Receiving',
|
||||
{ tag: [ '@payments', '@services' ] },
|
||||
{ tag: [ '@payments', '@services', '@hpos' ] },
|
||||
() => {
|
||||
test.use( { storageState: process.env.ADMINSTATE } );
|
||||
|
||||
|
|
Loading…
Reference in New Issue