REfactor first 2 tests
This commit is contained in:
parent
81e05acdd6
commit
ef90dc7ea3
|
@ -4,13 +4,14 @@
|
||||||
*/
|
*/
|
||||||
const {
|
const {
|
||||||
shopper,
|
shopper,
|
||||||
merchant,
|
|
||||||
createVariableProduct,
|
createVariableProduct,
|
||||||
} = require( '@woocommerce/e2e-utils' );
|
} = require( '@woocommerce/e2e-utils' );
|
||||||
|
const config = require('config');
|
||||||
|
|
||||||
let variablePostIdValue;
|
let variablePostIdValue;
|
||||||
|
|
||||||
const cartDialogMessage = 'Please select some product options before adding this product to your cart.';
|
const cartDialogMessage = 'Please select some product options before adding this product to your cart.';
|
||||||
|
const attributes = config.get( 'products.variable.attributes' )
|
||||||
|
|
||||||
const runVariableProductUpdateTest = () => {
|
const runVariableProductUpdateTest = () => {
|
||||||
describe('Shopper > Update variable product',() => {
|
describe('Shopper > Update variable product',() => {
|
||||||
|
@ -20,25 +21,58 @@ const runVariableProductUpdateTest = () => {
|
||||||
|
|
||||||
it('shopper can change variable attributes to the same value', async () => {
|
it('shopper can change variable attributes to the same value', async () => {
|
||||||
await shopper.goToProduct(variablePostIdValue);
|
await shopper.goToProduct(variablePostIdValue);
|
||||||
await expect(page).toSelect('#attr-1', 'val1');
|
|
||||||
await expect(page).toSelect('#attr-2', 'val1');
|
|
||||||
await expect(page).toSelect('#attr-3', 'val1');
|
|
||||||
|
|
||||||
await expect(page).toMatchElement('.woocommerce-variation-price', { text: '9.99' });
|
for (const a of attributes) {
|
||||||
|
const { name, options } = a;
|
||||||
|
const attrHTMLId = `#${name.toLowerCase()}`;
|
||||||
|
|
||||||
|
await expect(page).toSelect(attrHTMLId, options[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
await expect(page).toMatchElement('.woocommerce-variation-price', {
|
||||||
|
text: '9.99'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('shopper can change attributes to combination with dimensions and weight', async () => {
|
it('shopper can change attributes to combination with dimensions and weight', async () => {
|
||||||
await shopper.goToProduct(variablePostIdValue);
|
await shopper.goToProduct(variablePostIdValue);
|
||||||
await expect(page).toSelect('#attr-1', 'val1');
|
await expect(page).toSelect(
|
||||||
await expect(page).toSelect('#attr-2', 'val2');
|
`#${attributes[0].name.toLowerCase()}`,
|
||||||
await expect(page).toSelect('#attr-3', 'val1');
|
attributes[0].options[0]
|
||||||
|
);
|
||||||
|
await expect(page).toSelect(
|
||||||
|
`#${attributes[1].name.toLowerCase()}`,
|
||||||
|
attributes[1].options[1]
|
||||||
|
);
|
||||||
|
await expect(page).toSelect(
|
||||||
|
`#${attributes[2].name.toLowerCase()}`,
|
||||||
|
attributes[2].options[0]
|
||||||
|
);
|
||||||
|
|
||||||
await expect(page).toMatchElement('.woocommerce-variation-price', { text: '20.00' });
|
await expect(page).toMatchElement('.woocommerce-variation-price', {
|
||||||
await expect(page).toMatchElement('.woocommerce-variation-availability', { text: 'Out of stock' });
|
text: '20.00'
|
||||||
await expect(page).toMatchElement('.woocommerce-product-attributes-item--weight', { text: '200 kg' });
|
});
|
||||||
await expect(page).toMatchElement('.woocommerce-product-attributes-item--dimensions', { text: '10 × 20 × 15 cm' });
|
await expect(page).toMatchElement(
|
||||||
|
'.woocommerce-variation-availability',
|
||||||
|
{
|
||||||
|
text: 'Out of stock'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(page).toMatchElement(
|
||||||
|
'.woocommerce-product-attributes-item--weight',
|
||||||
|
{
|
||||||
|
text: '200 kg'
|
||||||
|
}
|
||||||
|
);
|
||||||
|
await expect(
|
||||||
|
page
|
||||||
|
).toMatchElement(
|
||||||
|
'.woocommerce-product-attributes-item--dimensions',
|
||||||
|
{ text: '10 × 20 × 15 cm' }
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// mytodo continue transforming from here
|
||||||
it('shopper can change variable product attributes to variation with a different price', async () => {
|
it('shopper can change variable product attributes to variation with a different price', async () => {
|
||||||
await shopper.goToProduct(variablePostIdValue);
|
await shopper.goToProduct(variablePostIdValue);
|
||||||
await expect(page).toSelect('#attr-1', 'val1');
|
await expect(page).toSelect('#attr-1', 'val1');
|
||||||
|
|
Loading…
Reference in New Issue