PhoenixTest.Playwright.Config (PhoenixTestPlaywright v0.10.0-rc.0)

View Source

Configuration options for the Playwright driver.

Most should be set globally in config/tests.exs. Some can be overridden per test.

All options:

  • :accept_dialogs (boolean/0) - Accept browser dialogs (alert(), confirm(), prompt()). The default value is true.

  • :assets_dir (binary/0) - The directory where the JS assets are located and the Playwright CLI is installed. Playwright version 1.55.0 or newer is recommended. The default value is "./assets".

  • :browser (:android | :chromium | :electron | :firefox | :webkit) - The default value is :chromium.

  • :browser_context_opts - Additional arguments passed to Playwright Browser.newContext. E.g. [http_credentials: %{username: "a", password: "b"}]. The default value is [].

  • :browser_launch_timeout (non_neg_integer/0) - The default value is 4000.

  • :browser_page_opts - Additional arguments passed to Playwright Browser.newPage. (E.g. [accept_downloads: false]. The default value is [].

  • :browser_pool (atom/0) - Reuse a browser from this pool instead of launching a new browser per test suite. The default value is :default_pool.

  • :browser_pool_checkout_timeout (non_neg_integer/0) - The default value is 60000.

  • :browser_pools (list of non-empty keyword/0) - Supported keys:

    • :id (atom/0) - Required.

    • :size (integer/0) - The default value is System.schedulers_online() / 2.

    • :browser (:android | :chromium | :electron | :firefox | :webkit) - The default value is :chromium.

    • :browser_launch_timeout (non_neg_integer/0) - The default value is 4000.

    • :executable_path (String.t/0) - Path to a browser executable to run instead of the bundled one. Use at your own risk.

    • :headless (boolean/0) - The default value is true.

    • :slow_mo (non_neg_integer/0) - The default value is 0.

    The default value is [[id: :default_pool]].

  • :cli - This option is deprecated. Use assets_dir instead.

  • :ecto_sandbox_stop_owner_delay (non_neg_integer/0) - Delay in milliseconds before shutting down the Ecto sandbox owner after a test ends. Use this to allow LiveViews and other processes in your app time to stop using database connections before the sandbox owner is terminated. The default value is 0.

  • :executable_path (String.t/0) - Path to a browser executable to run instead of the bundled one. Use at your own risk.

  • :headless (boolean/0) - The default value is true.

  • :js_logger (module | false) - false to disable, or a module that implements the PlaywrightEx.JsLogger behaviour. The default value is PhoenixTest.Playwright.JsLogger.

  • :runner (binary/0) - The JS package runner to use to run the Playwright CLI. Accepts either a binary executable exposed in PATH or the absolute path to it. The default value is "npx".

  • :screenshot (boolean/0 | Keyword.t/0) - Either a boolean or a keyword list:

    • :full_page (boolean/0) - The default value is true.

    • :omit_background (boolean/0) - The default value is false.

    The default value is false.

  • :screenshot_dir (String.t/0) - The default value is "screenshots".

  • :selector_engines - Define custom Playwright selector engines. The default value is [].

  • :slow_mo (non_neg_integer/0) - The default value is 0.

  • :timeout (non_neg_integer/0) - The default value is 2000.

  • :trace (boolean/0 | :open) - The default value is false.

  • :trace_dir (String.t/0) - The default value is "traces".

Options that be overridden per test module via the use PhoenixTest.Playwright.Case opts:

  • :browser_pool
  • :browser
  • :browser_launch_timeout
  • :executable_path
  • :headless
  • :slow_mo

Options that be overridden per test via ExUnit @tag:

  • :accept_dialogs
  • :ecto_sandbox_stop_owner_delay
  • :screenshot
  • :trace
  • :browser_context_opts
  • :browser_page_opts