Skip to content

Commit

Permalink
add system tests CI
Browse files Browse the repository at this point in the history
  • Loading branch information
syphax-bouazzouni committed Nov 20, 2023
1 parent 56d9047 commit a9c0ca4
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 18 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ jobs:
push_to_registry:
name: Push Docker branch image to Docker Hub
runs-on: ubuntu-latest
strategy:
matrix:
platform: [ linux/amd64, linux/arm64 ]

steps:
- name: Check out the repo
Expand Down Expand Up @@ -52,7 +49,7 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
platforms: ${{ matrix.platform }}
platforms: linux/amd64,linux/arm64
build-args: |
RUBY_VERSION=2.7.8
push: true
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/tests-system.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
name: "Run system tests CI"

on:
push:
pull_request_target:
types: [ opened, reopened ]
env:
API_URL: http://localhost:9393
REMOTE_API_KEY: 8b5b7825-538d-40e0-9e9e-5ab9274a9aeb
REMOTE_API_URL: https://data.bioontology.org
BIOMIXER_URL: ${{ secrets.BIOMIXER_URL }}
FAIRNESS_URL: ${{ secrets.FAIRNESS_URL }}
ANNOTATOR_URL: ${{ secrets.ANNOTATOR_URL }}
DB_HOST: 127.0.0.1
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
image: mysql:8.0
ports:
- "3306:3306"
env:
MYSQL_ROOT_PASSWORD: root
memcached:
image: memcached:1.6
ports:
- 11211:11211
chrome-server:
image: selenium/standalone-chrome:112.0-chromedriver-112.0-grid-4.9.0-20230421
options: "--shm-size=2g"
ports:
- "4444:4444"

steps:
- name: Checkout code
uses: actions/checkout@v3
# Add or replace dependency steps here
- name: Install Ruby and gems
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.7.8
bundler-cache: true

- name: Run OntoPortal API
run: bin/run_api -k ${{ env.REMOTE_API_KEY }} -r agroportal -t stage -s STY -u ${{ env.REMOTE_API_URL }}

# Add or replace database setup steps here
- name: set up config file
run: cp config/database.yml.sample config/database.yml
- name: Set up database schema
run: RAILS_ENV=test bin/rails db:setup
- name: Set up yarn
run: yarn install
# Add or replace test runners here
- name: Run integration tests
run: CI=true RAILS_ENV=test bin/rails test -v test/system/*
17 changes: 8 additions & 9 deletions test/application_system_test_case.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
include ApplicationTestHelpers::Categories
include ApplicationTestHelpers::Groups

driven_by :selenium, using: :chrome, options: {
browser: :remote,
url: "http://localhost:4444"

driven_by :selenium, using: ENV['CI'].present? ? :headless_chrome : :chrome , screen_size: [1400, 1400] , options: {
browser: :remote,
url: "http://localhost:4444"
}


def login_in_as(user)
visit login_index_url

Expand All @@ -23,15 +25,16 @@ def login_in_as(user)
# Click the login button
click_button 'Login'
end

def tom_select(selector, values)

multiple = values.is_a?(Array)


real_select = "[name='#{selector}']"

# Click on the Tom Select input to open the dropdown
assert_selector "#{real_select} + div", visible: true, wait: 2
scroll_to find("#{real_select} + div")
find("#{real_select} + div").click
sleep 1

Expand All @@ -42,15 +45,11 @@ def tom_select(selector, values)
all("#{real_select} + div > .ts-control > .item .remove").each do |element|
element.click
end

page.execute_script("document.querySelector(\"#{real_select} + div > .ts-control\").innerHTML = '';")
else
values = Array(values)
end

within "#{real_select} + div > .ts-dropdown > .ts-dropdown-content" do


values.each do |value|
if page.has_selector?('.option', text: value)
find('.option', text: value).click
Expand Down
5 changes: 0 additions & 5 deletions test/system/submission_flows_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,4 @@ class SubmissionFlowsTest < ApplicationSystemTestCase

end

test "edit an ontology metadata" do
end

test "add new submission to an ontology" do
end
end

0 comments on commit a9c0ca4

Please sign in to comment.