tests: fixed OS-locale specific failing test (#3863)

This commit is contained in:
Max Schmitt 2020-09-14 16:53:25 +02:00 committed by GitHub
parent 1d8d89dcfa
commit d7f3812123
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View File

@ -19,25 +19,25 @@ import { it, expect } from './playwright.fixtures';
it('should work', async ({ browser }) => {
const func = () => new Date(1479579154987).toString();
{
const context = await browser.newContext({ timezoneId: 'America/Jamaica' });
const context = await browser.newContext({ locale: 'en-US', timezoneId: 'America/Jamaica' });
const page = await context.newPage();
expect(await page.evaluate(func)).toBe('Sat Nov 19 2016 13:12:34 GMT-0500 (Eastern Standard Time)');
await context.close();
}
{
const context = await browser.newContext({ timezoneId: 'Pacific/Honolulu' });
const context = await browser.newContext({ locale: 'en-US', timezoneId: 'Pacific/Honolulu' });
const page = await context.newPage();
expect(await page.evaluate(func)).toBe('Sat Nov 19 2016 08:12:34 GMT-1000 (Hawaii-Aleutian Standard Time)');
await context.close();
}
{
const context = await browser.newContext({ timezoneId: 'America/Buenos_Aires' });
const context = await browser.newContext({ locale: 'en-US', timezoneId: 'America/Buenos_Aires' });
const page = await context.newPage();
expect(await page.evaluate(func)).toBe('Sat Nov 19 2016 15:12:34 GMT-0300 (Argentina Standard Time)');
await context.close();
}
{
const context = await browser.newContext({ timezoneId: 'Europe/Berlin' });
const context = await browser.newContext({ locale: 'en-US', timezoneId: 'Europe/Berlin' });
const page = await context.newPage();
expect(await page.evaluate(func)).toBe('Sat Nov 19 2016 19:12:34 GMT+0100 (Central European Standard Time)');
await context.close();

View File

@ -42,7 +42,7 @@ it('should support colorScheme option', async ({launchPersistent}) => {
});
it('should support timezoneId option', async ({launchPersistent}) => {
const {page} = await launchPersistent({timezoneId: 'America/Jamaica'});
const {page} = await launchPersistent({locale: 'en-US', timezoneId: 'America/Jamaica'});
expect(await page.evaluate(() => new Date(1479579154987).toString())).toBe('Sat Nov 19 2016 13:12:34 GMT-0500 (Eastern Standard Time)');
});