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

Safari tests fix #1535

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
149 changes: 0 additions & 149 deletions .github/workflows/test_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,135 +5,6 @@ on:
- workflow_dispatch

jobs:
test:
env:
RACK_ENV: test
RAILS_ENV: test
runs-on: ubuntu-latest
services:
postgres:
ports:
- 5432:5432
image: postgres:10.15
env:
POSTGRES_DB: mumuki_test
POSTGRES_USER: mumuki
POSTGRES_PASSWORD: mumuki
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
with:
ruby-version: 2.6.3
bundler: 2.1.4
- name: Install dependencies
run: bundle install
- name: Load schema
run: bundle exec rake db:schema:load
- name: Run tests
run: bundle exec rake

test-firefox:
env:
MUMUKI_SELENIUM_DRIVER: firefox
RACK_ENV: test
RAILS_ENV: test
runs-on: ubuntu-latest
services:
postgres:
ports:
- 5432:5432
image: postgres:10.15
env:
POSTGRES_DB: mumuki_test
POSTGRES_USER: mumuki
POSTGRES_PASSWORD: mumuki
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
with:
ruby-version: 2.6.3
bundler: 2.1.4
- name: Setup Firefox
run: |
wget --no-verbose -O /tmp/firefox-79.0.tar.bz2 'https://download.mozilla.org/?product=firefox-79.0&lang=en-US&os=linux64'
tar xjf /tmp/firefox-79.0.tar.bz2 -C /opt/
sudo ln -sf /opt/firefox/firefox /usr/lib/firefox/firefox
- name: Install dependencies
run: bundle install
- name: Load schema
run: bundle exec rake db:schema:load
- name: Setup hosts
run: |
echo '

127.0.0.1 localmumuki.io
127.0.0.1 base.localmumuki.io
127.0.0.1 central.localmumuki.io
127.0.0.1 empty.localmumuki.io
127.0.0.1 foo.localmumuki.io
127.0.0.1 immersive-orga.localmumuki.io
127.0.0.1 private.localmumuki.io
127.0.0.1 someorga.localmumuki.io
127.0.0.1 test.localmumuki.io
127.0.0.1 the-public-org.localmumuki.io
' | sudo tee -a /etc/hosts
- name: Setup Xvfb
run: Xvfb :99 &
- name: Run web tests
run: bundle exec rake spec:web
env:
DISPLAY: :99

test-chrome:
env:
MUMUKI_SELENIUM_DRIVER: chrome
RACK_ENV: test
RAILS_ENV: test
runs-on: ubuntu-latest
services:
postgres:
ports:
- 5432:5432
image: postgres:10.15
env:
POSTGRES_DB: mumuki_test
POSTGRES_USER: mumuki
POSTGRES_PASSWORD: mumuki
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@21351ecc0a7c196081abca5dc55b08f085efe09a
with:
ruby-version: 2.6.3
bundler: 2.1.4
- name: Install dependencies
run: bundle install
- name: Load schema
run: bundle exec rake db:schema:load
- name: Setup hosts
run: |
echo '

127.0.0.1 localmumuki.io
127.0.0.1 base.localmumuki.io
127.0.0.1 central.localmumuki.io
127.0.0.1 empty.localmumuki.io
127.0.0.1 foo.localmumuki.io
127.0.0.1 immersive-orga.localmumuki.io
127.0.0.1 private.localmumuki.io
127.0.0.1 someorga.localmumuki.io
127.0.0.1 test.localmumuki.io
127.0.0.1 the-public-org.localmumuki.io
' | sudo tee -a /etc/hosts
- name: Setup Xvfb
run: Xvfb :99 &
- name: Run web tests
run: bundle exec rake spec:web
env:
DISPLAY: :99

test-safari:
env:
MUMUKI_SELENIUM_DRIVER: safari
Expand Down Expand Up @@ -182,24 +53,4 @@ jobs:
- name: Run web tests
run: bundle exec rake spec:web

deploy:
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
needs:
- test
- test-firefox
- test-chrome
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Deploy
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
run: |
mkdir -p $HOME/.gem
touch $HOME/.gem/credentials
chmod 0600 $HOME/.gem/credentials
printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
gem build *.gemspec
gem push *.gem
env:
GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"

11 changes: 10 additions & 1 deletion spec/capybara_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,17 @@ def run_with_selenium?

def register_safari_driver!
# No official docs for this, code was taken from https://github.com/teamcapybara/capybara/blob/master/spec/selenium_spec_safari.rb

safari_options = {
browser: :safari,
options: ::Selenium::WebDriver::Safari::Options.new,
clear_local_storage: true,
clear_session_storage: true,
timeout: 30
}

Capybara.register_driver :selenium_safari do |app|
Capybara::Selenium::Driver.new(app, browser: :safari, timeout: 30)
Capybara::Selenium::Driver.new(app, safari_options)
end
end

Expand Down