Skip to content

Commit

Permalink
fix playwright
Browse files Browse the repository at this point in the history
  • Loading branch information
amannn committed Oct 1, 2024
1 parent 37b5872 commit a08271a
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions examples/example-app-router-playground/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
tsconfig.tsbuildinfo
*storybook.log
storybook-static
test-results
3 changes: 3 additions & 0 deletions examples/example-app-router-playground/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ import {devices} from '@playwright/test';
// Use a distinct port on CI to avoid conflicts during concurrent tests
const PORT = process.env.CI ? 3004 : 3000;

// Forward to specs
process.env.PORT = PORT.toString();

const config: PlaywrightTestConfig = {
retries: process.env.CI ? 1 : 0,
testMatch: process.env.TEST_MATCH || 'main.spec.ts',
Expand Down
4 changes: 2 additions & 2 deletions examples/example-app-router-playground/tests/domains.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ it('can use config based on the default locale on an unknown domain', async ({

it('can use a secondary locale unprefixed if the domain has specified it as the default locale', async () => {
const browser = await chromium.launch({
args: ['--host-resolver-rules=MAP example.de 127.0.0.1:3000']
args: ['--host-resolver-rules=MAP example.de 127.0.0.1:' + process.env.PORT]
});

const page = await browser.newPage();
await page.route('**/*', (route) =>
route.continue({
headers: {
'accept-language': 'de',
'x-forwarded-port': '80'
'x-forwarded-port': '80' // (playwright default)
}
})
);
Expand Down
6 changes: 3 additions & 3 deletions packages/next-intl/src/navigation/shared/BaseLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ function BaseLink(
// If there is an `unprefixed` prop, the
// `defaultLocale` might differ by domain
unprefixed &&
// Unprefix the pathname if a domain
// Unprefix the pathname if a domain matches
(unprefixed.domains[host] === linkLocale ||
// For unknown domains, remove the prefix for the global
// `defaultLocale` (e.g. on localhost)
// … and handle unknown domains by applying the
// global `defaultLocale` (e.g. on localhost)
(!Object.keys(unprefixed.domains).includes(host) &&
curLocale === defaultLocale &&
!locale))
Expand Down

0 comments on commit a08271a

Please sign in to comment.