1
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?

dockerコンテナでPlaywrightを実行した時のみダウンロードしたファイル名が「download」になってしまう

Last updated at Posted at 2024-08-23

概要

PlaywrightをDockerコンテナで実行すると、downloadという名前のファイル名で返却されてしまいこのようなエラーが発生した。
ローカルで実行すると想定どおりのファイル名が返ってくる。

Error: expect(received).toBe(expected) // Object.is equality

    Expected: "サンプルファイル.xlsx"
    Received: "download"

該当コード

daonwload.spec.js
      await expect(download.suggestedFilename()).toBe(
        'サンプルファイル.xlsx'
      )

原因

suggestedFilename()がロケールおよびタイムゾーンを取得できないがために日本語を認識できず、downloadという文字列を返していた。
なので、ロケールとタイムゾーンを設定させてあげることで解決。

playwright.config.js
    // 略
    locale: 'ja-JP',
    timezoneId: 'Asia/Tokyo'
  },

またDocker環境のLocaleも設定されているか確認してください。

参考記事

Thank you guys!

1
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
1
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?