Skip to content

How to specify Playwright configuration? #82

@adamreisnz

Description

@adamreisnz

Hello, thanks for making this Playwright/Capybara driver!

I might be doing something wrong, but I'm having a hard time to figure out how to pass basic Playwright configuration when initializing the driver.

For example, I would like to modify the testIdAttribute configuration param.
When normally using Playwright, you would define this in your config like so:

export default defineConfig({
  use: {
    testIdAttribute: 'test-id',
  },
})

How does this translate to the Capybara driver? How can I include these settings when initalizing?

Capybara.register_driver :playwright do |app|
  Capybara::Playwright::Driver.new(app,
    playwright_cli_executable_path: './node_modules/.bin/playwright',
    browser_type: ENV["PLAYWRIGHT_BROWSER"]&.to_sym || :chromium,
    headless: true,
    timeout: 10
  )
end

Or better yet, can the Capybara driver use my local playwright.config.js somehow?

I could not find any answers in the documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions