Skip to content

Commit

Permalink
Fix bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon Lane committed Jun 26, 2023
1 parent 4f4016a commit 85f6a8c
Showing 1 changed file with 14 additions and 12 deletions.
Expand Up @@ -91,6 +91,8 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.filter( { hasText: 'Local pickup' } )
).toBeVisible();

await page.getByRole( 'button', { name: 'Save changes'} ).click();

await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping'
);
Expand Down Expand Up @@ -146,6 +148,8 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
.filter( { hasText: 'Free shipping' } )
).toBeVisible();

await page.getByRole( 'button', { name: 'Save changes'} ).click();

await page.goto(
'wp-admin/admin.php?page=wc-settings&tab=shipping'
);
Expand Down Expand Up @@ -175,22 +179,20 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
'wp-admin/admin.php?page=wc-settings&tab=shipping&zone_id=new',
{ waitUntil: 'networkidle' }
);
await page.locator( '#zone_name' ).fill( shippingZoneNameFlatRate );
await page.getByPlaceholder( 'Zone name' ).fill( shippingZoneNameFlatRate );

await page.locator( '.select2-search__field' ).click();
await page.locator( '.select2-search__field' ).type( 'Canada' );
await page.getByPlaceholder( 'Select regions within this zone' ).click();
await page.getByPlaceholder( 'Select regions within this zone' ).type( 'Canada' );
await page
.locator(
'.select2-results__option.select2-results__option--highlighted'
)
.getByText('Canada').last()
.click();

await page.locator( 'text=Add shipping method' ).click();
await page.getByRole( 'button', { name: 'Add shipping method' } ).click();

await page
.locator( 'select[name=add_method_id]' )
.selectOption( 'flat_rate' );
await page.locator( '#btn-ok' ).click();
.getByRole( 'combobox' )
.selectOption( { label: 'Flat rate' } );
await page.getByRole('button', { name: 'Add shipping method' } ).last().click();
await page.waitForLoadState( 'networkidle' );
await expect(
page
Expand All @@ -199,8 +201,8 @@ test.describe( 'WooCommerce Shipping Settings - Add new shipping zone', () => {
).toBeVisible();

await page.getByRole( 'link', { name: 'Flat rate' } ).click();
await page.locator( '#woocommerce_flat_rate_cost' ).fill( '10' );
await page.locator( '#btn-ok' ).click();
await page.getByLabel( 'Cost', { exact: true } ).fill( '10' );
await page.getByRole( 'button', { name: 'Save changes' } ).last().click();
await page.waitForLoadState( 'networkidle' );

await page.goto(
Expand Down

0 comments on commit 85f6a8c

Please sign in to comment.