0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【playwright】chromiumでのタイムゾーン設定

Posted at

playwrightでの日時表示

playwrightでテストを書いている時、日時のチェックをするテストがあったのですが、MM/DD/YYYYの形式になっており正常に成功しませんでした。
{AC461FD1-6C66-4A64-AC9C-A28C18F736B9}.png

chromeで開くと以下の様にYYYY/MM/DDの形式になっています。
{C08F6FE0-B383-4832-89FA-5E50606569D8}.png

タイムゾーン設定

そこでplaywright.config.jsにタイムゾーンを設定してあげることによってこちらの問題が解決されました。

name:'chromium'のところにlocaletimezoneIdを指定あげることにより変更されます。

    projects: [
        {
            name: 'chromium',
            use: {
                ...devices['Desktop Chrome'],
                viewport: { width: 1920, height: 1080 },
                locale: 'ja-JP',
                timezoneId: 'Asia/Tokyo',
            },
        },
    ],

再度実行してみると、chromium上でもYYYY/MM/DDの形式になっていることが確認できました。
{602DB114-A7B3-4244-B529-8CE477332752}.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?