diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index ad52ca7a86..cb39ea78ef 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -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 @@ -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 diff --git a/.github/workflows/tests-system.yml b/.github/workflows/tests-system.yml new file mode 100644 index 0000000000..30173b04cb --- /dev/null +++ b/.github/workflows/tests-system.yml @@ -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/* \ No newline at end of file diff --git a/test/application_system_test_case.rb b/test/application_system_test_case.rb index 572a099717..1c7def5929 100644 --- a/test/application_system_test_case.rb +++ b/test/application_system_test_case.rb @@ -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 @@ -23,15 +25,15 @@ 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", wait: 10 find("#{real_select} + div").click sleep 1 @@ -42,15 +44,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 diff --git a/test/system/submission_flows_test.rb b/test/system/submission_flows_test.rb index d3c923ae8e..5d77c000bc 100644 --- a/test/system/submission_flows_test.rb +++ b/test/system/submission_flows_test.rb @@ -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 \ No newline at end of file