From 4d9156ebf72f258c2983e1e020e59d9912129de2 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Mon, 30 Sep 2019 16:08:44 +0200 Subject: [PATCH 1/3] Add chromium-driver patch from Alex --- Dockerfile | 7 ++++++- features/support/env.rb | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index bdbe7583d..417d4f432 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,11 @@ FROM ruby:2.6.4-buster MAINTAINER BioSistemika +RUN wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | apt-key add - && \ + echo 'deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' >> /etc/apt/sources.list && \ + wget -O /usr/bin/chromedriver_linux64.zip https://chromedriver.storage.googleapis.com/77.0.3865.40/chromedriver_linux64.zip && \ + unzip /usr/bin/chromedriver_linux64.zip -d /usr/bin/ + # additional dependecies # libSSL-1.0 is required by wkhtmltopdf binary # libreoffice for file preview generation @@ -18,7 +23,7 @@ RUN apt-get update -qq && \ sudo graphviz --no-install-recommends \ libreoffice \ libfile-mimeinfo-perl \ - chromium-driver && \ + google-chrome-stable=77.* && \ npm install -g yarn && \ ln -s /usr/lib/x86_64-linux-gnu/libvips.so.42 /usr/lib/x86_64-linux-gnu/libvips.so && \ rm -rf /var/lib/apt/lists/* diff --git a/features/support/env.rb b/features/support/env.rb index f402453ac..63ccb9c9e 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -58,7 +58,7 @@ ActionController::Base.allow_rescue = false begin require 'database_cleaner' require 'database_cleaner/cucumber' - DatabaseCleaner.strategy = :transaction + DatabaseCleaner.strategy = :truncation rescue NameError raise "You need to add database_cleaner to your Gemfile (in the :test group) if you wish to use it." end From 6db8b48d1692172d625937c65cad186dc2b786ce Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Mon, 30 Sep 2019 22:34:33 +0200 Subject: [PATCH 2/3] Fix cucumber tests Close SCI-3916 --- features/step_definitions/users_steps.rb | 3 ++- features/support/env.rb | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/features/step_definitions/users_steps.rb b/features/step_definitions/users_steps.rb index 1a575e9b9..633fbba2a 100644 --- a/features/step_definitions/users_steps.rb +++ b/features/step_definitions/users_steps.rb @@ -37,8 +37,9 @@ Given("I click on Reset Password link in the reset password email for user {stri visit new_user_password_path fill_in 'user_email', with: email click_button 'Send me reset password instruction' + Delayed::Worker.new.work_off - sleep 10 + sleep 1 open_email(email) current_email.click_link 'Change my password' end diff --git a/features/support/env.rb b/features/support/env.rb index 63ccb9c9e..e2f498242 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -6,6 +6,7 @@ # instead of editing this one. Cucumber will automatically load all features/**/*.rb # files. +ENV['RAILS_ENV'] = 'test' ENV['CR_REMOVE_RACK_TEST_HELPERS'] = 'true' require 'cucumber/rails' @@ -16,7 +17,7 @@ require 'capybara/email' include FirstTimeDataGenerator Capybara.default_max_wait_time = 30 -# Capybara.asset_host = 'http://localhost:3001' +#Capybara.asset_host = 'http://localhost:3001' Capybara.server_port = 3000 require 'selenium/webdriver' # enables email helper methods From 45aa057378d76fd7fca9eb5f8f33f6f76f3b3641 Mon Sep 17 00:00:00 2001 From: Jure Grabnar Date: Mon, 30 Sep 2019 22:35:15 +0200 Subject: [PATCH 3/3] Enable cucumber tests --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 5dbaaefaf..7e3a6484f 100644 --- a/Makefile +++ b/Makefile @@ -85,7 +85,7 @@ tests-ci: @docker-compose run --rm web bash -c "bundle install && yarn install" @docker-compose up -d webpack @docker-compose ps - @docker-compose run -e ENABLE_EMAIL_CONFIRMATIONS=false -e MAIL_FROM=MAIL_FROM -e MAIL_REPLYTO=MAIL_REPLYTO -e RAILS_ENV=test -e PAPERCLIP_HASH_SECRET=PAPERCLIP_HASH_SECRET -e MAIL_SERVER_URL=localhost:3000 -e ENABLE_RECAPTCHA=false -e ENABLE_USER_CONFIRMATION=false -e ENABLE_USER_REGISTRATION=true -e CORE_API_RATE_LIMIT=1000000 --rm web bash -c "rake db:create db:migrate && rake db:migrate && yarn install && bundle exec rspec" + @docker-compose run -e ENABLE_EMAIL_CONFIRMATIONS=false -e MAIL_FROM=MAIL_FROM -e MAIL_REPLYTO=MAIL_REPLYTO -e RAILS_ENV=test -e PAPERCLIP_HASH_SECRET=PAPERCLIP_HASH_SECRET -e MAIL_SERVER_URL=localhost:3000 -e ENABLE_RECAPTCHA=false -e ENABLE_USER_CONFIRMATION=false -e ENABLE_USER_REGISTRATION=true -e CORE_API_RATE_LIMIT=1000000 --rm web bash -c "rake db:create db:migrate && rake db:migrate && yarn install && bundle exec rspec && bundle exec cucumber" console: @$(MAKE) rails cmd="rails console"