PATH:
home
/
lab2454c
/
gemition.com
/
wp-content
/
plugins
/
woocommerce
/
e2e
/
tests
/
merchant
const { test, expect } = require( '@playwright/test' ); test.describe( 'Merchant can add shipping classes', () => { test.use( { storageState: 'e2e/storage/adminState.json' } ); test( 'can add shipping classes', async ( { page } ) => { await page.goto( 'wp-admin/admin.php?page=wc-settings&tab=shipping§ion=classes' ); const shippingClassSlug = { name: 'Small Items', slug: 'small-items', description: "Small items that don't cost much to ship.", }; const shippingClassNoSlug = { name: 'Poster Pack', slug: '', description: '', }; const shippingClasses = [ shippingClassSlug, shippingClassNoSlug ]; // Add shipping classes for ( const { name, slug, description } of shippingClasses ) { await page.click( 'text=Add shipping class' ); await page.fill( '.editing:last-child [data-attribute="name"]', name ); await page.fill( '.editing:last-child [data-attribute="slug"]', slug ); await page.fill( '.editing:last-child [data-attribute="description"]', description ); } await page.click( 'text=Save shipping classes' ); // Set the expected auto-generated slug shippingClassNoSlug.slug = 'poster-pack'; // Verify that the specified shipping classes were saved for ( const { name, slug, description } of shippingClasses ) { await expect( page.locator( `text=${ name } Edit | Remove` ) ).toBeVisible(); await expect( page.locator( `text=${ slug }` ) ).toBeVisible(); // account for blank description if ( description !== '' ) { await expect( page.locator( `text=${ description }` ) ).toBeVisible(); } } // clean up await page.dispatchEvent( '.wc-shipping-class-delete >> nth=0', 'click' ); await page.dispatchEvent( '.wc-shipping-class-delete >> nth=0', 'click' ); await page.dispatchEvent( 'text=Save shipping classes', 'click' ); } ); } );
[-] product-settings.spec.js
[edit]
[-] order-status-filter.spec.js
[edit]
[-] order-emails.spec.js
[edit]
[-] customer-payment-page.spec.js
[edit]
[-] product-search.spec.js
[edit]
[+]
..
[-] settings-tax.spec.js
[edit]
[-] create-variable-product.spec.js
[edit]
[-] order-edit.spec.js
[edit]
[-] order-coupon.spec.js
[edit]
[-] product-import-csv.spec.js
[edit]
[-] create-shipping-classes.spec.js
[edit]
[-] create-coupon.spec.js
[edit]
[-] create-simple-product.spec.js
[edit]
[-] order-refund.spec.js
[edit]
[-] create-shipping-zones.spec.js
[edit]
[-] settings-general.spec.js
[edit]
[-] create-order.spec.js
[edit]
[-] page-loads.spec.js
[edit]
[-] product-edit.spec.js
[edit]
[-] order-search.spec.js
[edit]