Skip to content

Commit

Permalink
test(core): fix playwright tests
Browse files Browse the repository at this point in the history
  • Loading branch information
chanceaclark committed Nov 11, 2024
1 parent a8da829 commit 08d8c32
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
9 changes: 8 additions & 1 deletion core/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,14 @@ export default defineConfig({
projects: [
{
name: 'tests-chromium',
use: { ...devices['Desktop Chrome'] },
use: {
...devices['Desktop Chrome'],
launchOptions: {
// When redirected to checkout, BigCommerce blocks preflight requests from a HeadlessChrome user agent.
// We need to disable web security to allow the preflight request to go through.
args: ['--disable-web-security'],
},
},
},
],
});
2 changes: 1 addition & 1 deletion core/tests/ui/e2e/cart.spec.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { expect, Page, test } from '~/tests/fixtures';
import { expect, test } from '~/tests/fixtures';

const sampleProduct = '[Sample] Able Brewing System';

Expand Down
7 changes: 5 additions & 2 deletions core/tests/ui/e2e/checkout.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ test.describe('desktop', () => {
).toBeVisible();
});

test('Complete checkout as a logged in shopper', async ({ page, isMobile, account }) => {
test('Complete checkout as a logged in shopper', async ({ page, account }) => {
const customer = await account.create();

await customer.login();
Expand All @@ -97,7 +97,10 @@ test.describe('desktop', () => {
await page.getByRole('heading', { level: 1, name: 'Your cart' }).click();
await page.getByRole('button', { name: 'Proceed to checkout' }).click();

await waitForShippingForm(page, isMobile);
await page.waitForRequest('**/internalapi/v1/store/countries');
await page
.locator('.checkout-step--shipping .checkout-view-content[aria-busy="false"]')
.waitFor();

await page.getByText(customer.email).isVisible();
await page.getByRole('heading', { name: 'Payment', exact: true }).waitFor();
Expand Down

0 comments on commit 08d8c32

Please sign in to comment.