28 lines
723 B
Ruby
28 lines
723 B
Ruby
# frozen_string_literal: true
|
|
|
|
require 'playwright'
|
|
|
|
RSpec.configure do |config|
|
|
config.before(:suite) do
|
|
puts "Starting Playwright..."
|
|
@playwright = Playwright.create(playwright_cli_executable_path: './node_modules/.bin/playwright')
|
|
@browser = @playwright.chromium.launch(headless: true)
|
|
end
|
|
|
|
config.after(:suite) do
|
|
@browser.close
|
|
@playwright.stop
|
|
puts "Playwright stopped."
|
|
end
|
|
|
|
# Make Playwright available to all specs
|
|
config.before(:all) do
|
|
@playwright = Playwright.create(playwright_cli_executable_path: './node_modules/.bin/playwright')
|
|
@browser = @playwright.chromium.launch(headless: true)
|
|
end
|
|
|
|
config.after(:all) do
|
|
@browser.close
|
|
@playwright.stop
|
|
end
|
|
end |