Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright #1265

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions .github/workflows/assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,12 @@ on:
jobs:
assets:
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Build assets
run: |
bundle install --jobs 4 --retry 3
bundle exec rake assets:precompile
run: bin/rails assets:precompile
13 changes: 5 additions & 8 deletions .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ on:
jobs:
migrations:
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:11
image: postgres:14
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand Down Expand Up @@ -51,9 +51,8 @@ jobs:
OXA_DB_USER: postgres
OXA_DB_PASS: postgres
run: |
bundle install --jobs 4 --retry 3
bundle exec rake db:create db:schema:load db:seed --trace
bundle exec rails runner '3.times { FactoryBot.create :user }'
bin/rails db:setup
bin/rails runner '3.times { FactoryBot.create :user }'
git checkout --force -

# Install PR ruby version
Expand All @@ -66,6 +65,4 @@ jobs:
env:
OXA_DB_USER: postgres
OXA_DB_PASS: postgres
run: |
bundle install --jobs 4 --retry 3
bundle exec rake db:migrate
run: bin/rails db:migrate
43 changes: 38 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ on:
jobs:
tests:
timeout-minutes: 30
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
services:
postgres:
image: postgres:11
image: postgres:14
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
Expand All @@ -35,8 +35,41 @@ jobs:
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- run: yarn
- name: Ensure capybara-playwright-driver and package.json Playwright versions match
run: |
capybara_playwright_version=$(
bundle exec ruby -e 'require "playwright"; puts Playwright::COMPATIBLE_PLAYWRIGHT_VERSION.strip'
)
echo "Playwright version compatible with capybara-playwright-driver: $capybara_playwright_version"

package_json_playwright_version=$(
yarn list --pattern @playwright/test --json | jq '.data.trees[].name | .[17:]' -r
)
echo "Playwright version in package.json: $package_json_playwright_version"

if [[ $capybara_playwright_version = $package_json_playwright_version ]]; then
echo 'Versions match.'
else
echo "Versions don't match. Aborting..."
exit 1
fi
# https://justin.searls.co/posts/running-rails-system-tests-with-playwright-instead-of-selenium/
- name: Cache Playwright Chromium browser
id: playwright-cache
uses: actions/cache@v4
with:
path: ~/.cache/ms-playwright
key: playwright-browsers-${{ runner.os }}-${{ hashFiles('yarn.lock') }}
- name: Install Playwright Chromium browser (with deps)
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: yarn playwright install --with-deps chromium
- name: Install Playwright Chromium browser deps
if: steps.playwright-cache.outputs.cache-hit == 'true'
run: yarn playwright install-deps chromium
- name: Test
env:
WORKERS: 4
run: |
bundle install --jobs 4 --retry 3
bundle exec rake parallel:create parallel:load_schema parallel:seed --trace
WORKERS=4 bundle exec rake parallel:spec
bin/rake parallel:setup
bin/rake parallel:spec
66 changes: 21 additions & 45 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,62 +4,38 @@
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile ~/.gitignore_global

# Ignore bundler config.
# Bundler config and custom gem path
/.bundle

# Ignore environment variables
.env

# Ignore the default SQLite database.
/db/*.sqlite3
/db/*.sqlite3-journal

# Ignore all logfiles and tempfiles.
/log/*
!/log/.keep
/tmp

# Ignore public precompiled assets
/public/assets

# Ignore precompiled static error pages
/public/404.html
/public/422.html
/public/500.html
/public/503.html

# Ignore
/vendor/bundle

# Ignore yaml_db database files
/db/data.yml*

# Ignore Cucumber and RSpec failure information
cucumber_rerun.txt
.rspec_last_failures

# Ignore byebug history files
# Byebug history files
.byebug_history

# Ignore webdrivers lock file
.webdrivers_update
# Codecov coverage reports
/coverage

# Ignore Coverage reports
coverage/*
# Environment variables
.env

# Ignore Brakeman security scan results
brakeman.html
# Logfiles and tempfiles
/log
/tmp

# Ignore OS X's Desktop Service Store files
# OS X's Desktop Service Store and Unix editor temp files
*.DS_Store
*~

.generators
.rakeTasks
# Node modules (Playwright)
node_modules/

# Ignore unix editor temp files
*~
# Public precompiled assets and static error pages
/public/assets
/public/404.html
/public/500.html
/public/503.html

# Ignore binary created by redis-server
# Redis-server DB dump
dump.rdb

.idea
# RSpec failure information
.rspec_last_failures
4 changes: 2 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -274,10 +274,10 @@ group :test do

gem 'db-query-matchers'

# Run feature tests with Capybara + Selenium; choose which driver gems to use
# Run feature tests with Capybara + Playwright; choose which driver gems to use
# based on test environment.
gem 'capybara'
gem 'selenium-webdriver', require: false
gem 'capybara-playwright-driver'
gem 'webdrivers', require: false

# Testing emails
Expand Down
13 changes: 12 additions & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,10 @@ GEM
capybara-email (3.0.2)
capybara (>= 2.4, < 4.0)
mail
capybara-playwright-driver (0.5.2)
addressable
capybara
playwright-ruby-client (>= 1.16.0)
capybara-screenshot (1.0.26)
capybara (>= 1.0, < 4)
launchy
Expand Down Expand Up @@ -444,6 +448,10 @@ GEM
rack-contrib (>= 1.1, < 3)
railties (>= 3.0.0, < 8)
method_source (1.1.0)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1001)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
mini_racer (0.16.0)
Expand Down Expand Up @@ -556,6 +564,9 @@ GEM
ast (~> 2.4.1)
racc
pg (1.5.8)
playwright-ruby-client (1.47.0)
concurrent-ruby (>= 1.1.6)
mime-types (>= 3.0)
premailer (1.27.0)
addressable
css_parser (>= 1.19.0)
Expand Down Expand Up @@ -832,6 +843,7 @@ DEPENDENCIES
byebug
capybara
capybara-email
capybara-playwright-driver
capybara-screenshot
cgi
chronic
Expand Down Expand Up @@ -911,7 +923,6 @@ DEPENDENCIES
sass (= 3.4.19)
sass-rails
sd_notify
selenium-webdriver
sentry-delayed_job
sentry-rails
sentry-ruby
Expand Down
Loading
Loading