Skip to content

Commit

Permalink
fix(core): prepend locale for redirected urls in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgemoya committed Sep 16, 2024
1 parent be4eaf8 commit 1d7524c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .changeset/clever-fans-tickle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@bigcommerce/catalyst-core": patch
---

Prepend locale for redirected urls in tests.
More info: https://github.com/amannn/next-intl/issues/1335
4 changes: 3 additions & 1 deletion core/tests/fixtures/utils/account/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export class Account {
await this.page.getByLabel('Email').fill(this.email);
await this.page.getByLabel('Password').fill(this.password);
await this.page.getByRole('button', { name: 'Log in' }).click();
await this.page.waitForURL('/account/');
// Prepending locale to URL as a workaround for bug in next-intl
// More info: https://github.com/amannn/next-intl/issues/1335
await this.page.waitForURL('/en/account/');
}

async logout() {
Expand Down
4 changes: 3 additions & 1 deletion core/tests/ui/e2e/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ test('Account login and logout', async ({ page, account }) => {
await page.getByLabel('Password').fill(customer.password);
await page.getByRole('button', { name: 'Log in' }).click();

await page.waitForURL('/account/');
await page.waitForURL('/en/account/');

await expect(page.getByRole('heading', { name: 'My Account' })).toBeVisible();

await customer.logout();

// Prepending locale to URL as a workaround for bug in next-intl
// More info: https://github.com/amannn/next-intl/issues/1335
await page.waitForURL('/en/login/');

await expect(page.getByRole('heading', { name: 'Log in' })).toBeVisible();
Expand Down

0 comments on commit 1d7524c

Please sign in to comment.