Skip to content

Commit

Permalink
Add playwrite (experimentation)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomas-stefano committed Dec 24, 2024
1 parent 3b94be5 commit a1799a3
Show file tree
Hide file tree
Showing 8 changed files with 11,125 additions and 1,273 deletions.
27 changes: 20 additions & 7 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tests: [ unit_models, unit_services, unit_forms, unit_components, unit_other, integration_auth, integration_find, integration_publish, integration_support, integration_other ]
tests: [ unit_models, unit_services, unit_forms, unit_components, unit_other, integration_auth, integration_find, integration_publish, integration_support, integration_other, system_specs ]
include:
- tests: unit_models
include-pattern: spec/models/.*_spec.rb
Expand All @@ -211,7 +211,9 @@ jobs:
include-pattern: spec/components/.*_spec.rb
- tests: unit_other
include-pattern: spec/.*_spec.rb
exclude-pattern: spec/(features|smoke|models|services|forms|components)/.*_spec.rb
exclude-pattern: spec/(system|features|smoke|models|services|forms|components)/.*_spec.rb
- tests: system_specs
include-pattern: spec/system/.*_spec.rb
- tests: integration_auth
include-pattern: spec/features/auth/.*_spec.rb
- tests: integration_find
Expand Down Expand Up @@ -240,13 +242,24 @@ jobs:
docker compose up --no-build -d
docker compose exec -T web /bin/sh -c "./wait-for-command.sh -c 'nc -z db 5432' -s 0 -t 20"
docker compose exec -T web /bin/sh -c 'bundle config --local disable_exec_load true'
docker compose exec -T web /bin/sh -c 'apk add --no-cache xvfb xauth nss'
# docker compose exec -T web /bin/sh -c "echo 'Checking if chromedriver is installed...'; which chromium; which chromedriver; ls -l /usr/bin/chromium; ls -l /usr/bin/chromedriver; chromium --version; chromedriver --version"
# Ensure that xvfb is set up to allow GUI-based apps like Chromium to run headlessly
docker compose exec -T web /bin/sh -c 'Xvfb :99 -ac &'
docker compose exec -T web /bin/sh -c 'export DISPLAY=:99'
docker compose exec -T web /bin/sh -c 'bundle exec rake parallel:setup'
- name: Install Playwright (system_specs only)
if: matrix.tests == 'system_specs'
run: |
docker compose exec -T web /bin/sh -c 'apk add --no-cache \
chromium \
nss \
harfbuzz \
libxcomposite \
libxrandr \
libxdamage \
libxshmfence \
udev \
ttf-freefont \
fonts-noto-cjk'
docker compose exec -T web /bin/sh -c 'npx playwright install --with-deps'
- name: ${{ matrix.tests }} tests
run: |
docker compose exec -T web /bin/sh -c 'bundle exec --verbose parallel_rspec --pattern "${{ env.INCLUDE_PATTERN }}" --exclude-pattern "${{ env.EXCLUDE_PATTERN }}"'
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ group :development, :test do
# Test framework
gem 'rspec-rails', '7.1.0'

gem 'selenium-webdriver'
gem 'capybara-playwright-driver'

# Make diffs of Ruby objects much more readable
gem 'super_diff'
Expand Down
21 changes: 12 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ GEM
rack-test (>= 0.6.3)
regexp_parser (>= 1.5, < 3.0)
xpath (~> 3.2)
capybara-playwright-driver (0.5.4)
addressable
capybara
playwright-ruby-client (>= 1.16.0)
case_transform (0.2)
activesupport
chartkick (5.1.0)
Expand Down Expand Up @@ -404,6 +408,10 @@ GEM
marcel (1.0.4)
matrix (0.4.2)
method_source (1.1.0)
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1203)
mini_mime (1.1.5)
minitest (5.25.4)
mock_redis (0.46.0)
Expand Down Expand Up @@ -475,6 +483,9 @@ GEM
pg_search (2.3.7)
activerecord (>= 6.1)
activesupport (>= 6.1)
playwright-ruby-client (1.49.0)
concurrent-ruby (>= 1.1.6)
mime-types (>= 3.0)
propshaft (1.1.0)
actionpack (>= 7.0.0)
activesupport (>= 7.0.0)
Expand Down Expand Up @@ -637,17 +648,10 @@ GEM
ruby-progressbar (1.13.0)
ruby2_keywords (0.0.5)
rubypants (0.7.1)
rubyzip (2.3.2)
safely_block (0.4.1)
schema_to_scaffold (0.8.0)
activesupport (>= 3.2.1)
securerandom (0.4.1)
selenium-webdriver (4.26.0)
base64 (~> 0.2)
logger (~> 1.4)
rexml (~> 3.2, >= 3.2.5)
rubyzip (>= 1.2.2, < 3.0)
websocket (~> 1.0)
semantic_logger (4.16.0)
concurrent-ruby (~> 1.0)
sentry-rails (5.22.1)
Expand Down Expand Up @@ -731,7 +735,6 @@ GEM
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.9.1)
websocket (1.2.11)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand All @@ -758,6 +761,7 @@ DEPENDENCIES
bullet
byebug
capybara (>= 2.15)
capybara-playwright-driver
colorize
config
cssbundling-rails (~> 1.4)
Expand Down Expand Up @@ -829,7 +833,6 @@ DEPENDENCIES
rubocop-rspec_rails
rubypants
schema_to_scaffold
selenium-webdriver
sentry-rails
sentry-ruby
sentry-sidekiq
Expand Down
Loading

0 comments on commit a1799a3

Please sign in to comment.