Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Regression]: Intl.DateTimeFormat().resolvedOptions().locale doesn't work as expected on latest playwright browsers #32781

Closed
vishalshrm539 opened this issue Sep 24, 2024 · 3 comments

Comments

@vishalshrm539
Copy link

vishalshrm539 commented Sep 24, 2024

Last Good Version

NA

First Bad Version

latest

Basically with any @Playwright/test version, with the latest browsers(installed using npx playwright install)

Steps to reproduce

  1. Install the latest playwright browsers using: npx playwright install
  2. Execute Intl.DateTimeFormat().resolvedOptions().locale on the console, it doesn't work as expected.

Expected behavior

Execute Intl.DateTimeFormat().resolvedOptions().locale on the console, it doesn't work as expected. It should return 'en-GB' for me but returns 'en-US' rather. This used to work fine with the older browsers.

Actual behavior

Intl.DateTimeFormat().resolvedOptions().locale should return 'en-GB' which is what my Chrome browser returns.

Additional context

No response

Environment

OS: MAC
@yury-s
Copy link
Member

yury-s commented Sep 24, 2024

Please follow our bug template and share a reproducible example which we could run locally. I was not able to reproduce the issue with the following test:

import { expect, test } from '@playwright/test';

test.use({ locale: 'en-GB' });

test('locale', async ({ page }) => {
  expect(await page.evaluate(() => Intl.DateTimeFormat().resolvedOptions().locale)).toBe('en-GB');
});

@yury-s
Copy link
Member

yury-s commented Sep 30, 2024

Closing per the response above, feel free to open a new issue if it doesn't work.

@yury-s yury-s closed this as completed Sep 30, 2024
@vishalshrm539
Copy link
Author

vishalshrm539 commented Oct 4, 2024

@yury-s My concern was if I run a playwright test in Chromium browser then the Intl.DateTimeFormat().resolvedOptions().locale API doesn't return en-GB(but return en-US rather) which is what I expect as my Chrome browser returns that(i.e. en-GB).

I don't want to set the locale using test.use({ locale: 'en-GB' });.

In other words, why the Intl.DateTimeFormat().resolvedOptions().locale behaves differently in the Playwright Chromium browser and the Chrome in my machine. Shouldn't the two behave the same?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants