Add todo tag for later fixing

This commit is contained in:
Rodel Calasagsag 2024-09-07 14:04:43 +08:00
parent c646236ac2
commit 024dc324f2
1 changed files with 99 additions and 87 deletions

View File

@ -84,7 +84,10 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} }
} ); } );
test( 'can manually add a variation', async ( { page } ) => { test(
'can manually add a variation',
{ tag: '@todo-fix-in-multisite' },
async ( { page } ) => {
await test.step( `Open "Edit product" page of product id ${ productId_addManually }`, async () => { await test.step( `Open "Edit product" page of product id ${ productId_addManually }`, async () => {
await page.goto( await page.goto(
`/wp-admin/post.php?post=${ productId_addManually }&action=edit` `/wp-admin/post.php?post=${ productId_addManually }&action=edit`
@ -98,12 +101,14 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
window window
.jQuery( '#variable_product_options' ) .jQuery( '#variable_product_options' )
.on( 'woocommerce_variations_added', ( event, data ) => { .on(
window.woocommerceVariationsAddedFunctionCalls.push( [ 'woocommerce_variations_added',
event, ( event, data ) => {
data, window.woocommerceVariationsAddedFunctionCalls.push(
] ); [ event, data ]
} ); );
}
);
} ); } );
} ); } );
@ -112,7 +117,9 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} ); } );
await test.step( `Manually add ${ variationsToManuallyCreate.length } variations`, async () => { await test.step( `Manually add ${ variationsToManuallyCreate.length } variations`, async () => {
const variationRows = page.locator( '.woocommerce_variation h3' ); const variationRows = page.locator(
'.woocommerce_variation h3'
);
let variationRowsCount = await variationRows.count(); let variationRowsCount = await variationRows.count();
const originalVariationRowsCount = variationRowsCount; const originalVariationRowsCount = variationRowsCount;
@ -131,7 +138,8 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
// verify that the woocommerce_variations_added jQuery trigger was fired // verify that the woocommerce_variations_added jQuery trigger was fired
const woocommerceVariationsAddedFunctionCalls = const woocommerceVariationsAddedFunctionCalls =
await page.evaluate( await page.evaluate(
() => window.woocommerceVariationsAddedFunctionCalls () =>
window.woocommerceVariationsAddedFunctionCalls
); );
expect( expect(
woocommerceVariationsAddedFunctionCalls.length woocommerceVariationsAddedFunctionCalls.length
@ -142,7 +150,8 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
for ( const attributeValue of variationToCreate ) { for ( const attributeValue of variationToCreate ) {
const attributeName = productAttributes.find( const attributeName = productAttributes.find(
( { options } ) => options.includes( attributeValue ) ( { options } ) =>
options.includes( attributeValue )
).name; ).name;
const addAttributeMenu = variationRows const addAttributeMenu = variationRows
.nth( 0 ) .nth( 0 )
@ -153,7 +162,9 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} ); } );
await test.step( `Select "${ attributeValue }" from the "${ attributeName }" attribute menu`, async () => { await test.step( `Select "${ attributeValue }" from the "${ attributeName }" attribute menu`, async () => {
await addAttributeMenu.selectOption( attributeValue ); await addAttributeMenu.selectOption(
attributeValue
);
} ); } );
} }
@ -184,5 +195,6 @@ test.describe( 'Add variations', { tag: '@gutenberg' }, () => {
} ); } );
} }
} ); } );
} ); }
);
} ); } );