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

Added config to run selenium and capybara e2e tests in gitpod. #2

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
27 changes: 27 additions & 0 deletions .gitpod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,30 @@ COPY --chown=gitpod:gitpod .ruby-version /tmp
RUN echo "rvm_gems_path=/home/gitpod/.rvm" > ~/.rvmrc
RUN bash -lc "rvm reinstall ruby-$(cat /tmp/.ruby-version) && rvm use ruby-$(cat /tmp/.ruby-version) --default && gem install rails"
RUN echo "rvm_gems_path=/workspace/.rvm" > ~/.rvmrc

# Install dependencies
RUN sudo apt-get -q update \
&& sudo apt-get install -y openjdk-8-jre-headless xvfb libxi6 libgconf-2-4 libnss3-dev \
&& sudo rm -rf /var/lib/apt/lists/*

# Install Chrome
RUN sudo wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - \
&& echo 'deb http://dl.google.com/linux/chrome/deb/ stable main' | sudo tee /etc/apt/sources.list.d/google-chrome.list \
&& sudo apt-get -y update \
&& sudo apt-get -y install google-chrome-stable

# Install ChromeDriver
RUN CHROME_DRIVER_VERSION=`curl -sS https://chromedriver.storage.googleapis.com/LATEST_RELEASE` \
&& sudo wget -N https://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/ \
&& unzip ~/chromedriver_linux64.zip -d ~/ \
&& sudo mv -f ~/chromedriver /usr/local/bin/chromedriver \
&& sudo chown root:root /usr/local/bin/chromedriver \
&& sudo chmod 0755 /usr/local/bin/chromedriver

# Install Selenium
RUN SELENIUM_STANDALONE_VERSION=3.9.1 \
&& SELENIUM_SUBDIR=$(echo "$SELENIUM_STANDALONE_VERSION" | cut -d"." -f-2) \
&& wget -N https://selenium-release.storage.googleapis.com/$SELENIUM_SUBDIR/selenium-server-standalone-$SELENIUM_STANDALONE_VERSION.jar -P ~/ \
&& sudo mv -f ~/selenium-server-standalone-$SELENIUM_STANDALONE_VERSION.jar /usr/local/bin/selenium-server-standalone.jar \
&& sudo chown root:root /usr/local/bin/selenium-server-standalone.jar \
&& sudo chmod 0755 /usr/local/bin/selenium-server-standalone.jar
7 changes: 5 additions & 2 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
require "test_helper"
require 'test_helper'

class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by :selenium, using: :chrome, screen_size: [1400, 1400]
driven_by :selenium, using: :headless_chrome, screen_size: [1400, 1400]
end

# Remove messy "Capybara starting Puma..." test logs
Capybara.server = :puma, { Silent: true }