1
0
зеркало из https://github.com/glebtv/yookassa.git synced 2026-08-28 15:16:18 +03:00

Fix browser tests: add CI flags and use setup-chrome output for CHROME_PATH

Этот коммит содержится в:
Gleb Tv
2026-03-06 17:50:54 +03:00
родитель b592cff079
Коммит 5b002870b7
2 изменённых файлов: 32 добавлений и 4 удалений

6
.github/workflows/main.yml поставляемый
Просмотреть файл

@@ -30,9 +30,6 @@ jobs:
browser-tests:
runs-on: ubuntu-latest
env:
CHROME_PATH: /usr/bin/google-chrome
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
@@ -42,5 +39,8 @@ jobs:
bundler-cache: true
- name: Set up Chrome
uses: browser-actions/setup-chrome@v1
id: setup-chrome
- name: Browser specs (Cuprite)
run: bundle exec rspec --tag browser
env:
CHROME_PATH: ${{ steps.setup-chrome.outputs.chrome-path }}

Просмотреть файл

@@ -78,7 +78,35 @@ if defined?(Rails)
Capybara.server = :webrick
Capybara.default_max_wait_time = 5
Capybara.register_driver(:cuprite) do |app|
Capybara::Cuprite::Driver.new(app, headless: true)
browser_options = {
"no-sandbox" => nil,
"disable-dev-shm-usage" => nil,
"disable-gpu" => nil,
"disable-software-rasterizer" => nil,
"disable-setuid-sandbox" => nil
}
if ENV["CI"]
browser_options.merge!(
"disable-background-timer-throttling" => nil,
"disable-backgrounding-occluded-windows" => nil,
"disable-renderer-backgrounding" => nil,
"disable-ipc-flooding-protection" => nil
)
end
options = {
window_size: [1280, 1024],
browser_options: browser_options,
timeout: ENV.fetch("FERRUM_TIMEOUT", 30).to_i,
headless: true,
process_timeout: ENV.fetch("FERRUM_PROCESS_TIMEOUT", ENV["CI"] ? 120 : 30).to_i
}
chrome_path = ENV.fetch("CHROME_PATH", nil)
options[:browser_path] = chrome_path if chrome_path
Capybara::Cuprite::Driver.new(app, **options)
end
RSpec.configure do |config|