diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 91113b686f..bbfa5b97a8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ env: DISABLE_KNAPSACK: true jobs: - test-models: + test-non-spree-models: runs-on: ubuntu-18.04 services: postgres: @@ -47,7 +47,48 @@ jobs: bundle exec rake db:schema:load RAILS_ENV=test - name: Run tests - run: bundle exec rspec spec/models + run: bundle exec rspec spec/models --exclude-pattern "spec/models/spree/*" + + test-spree-models: + runs-on: ubuntu-18.04 + services: + postgres: + image: postgres:10 + ports: ["5432:5432"] + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + env: + POSTGRES_DB: open_food_network_test + POSTGRES_USER: ofn + POSTGRES_PASSWORD: f00d + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - uses: actions/setup-node@v2 + with: + node-version: '14.15.5' + + - name: Install JS dependencies + run: yarn install --frozen-lockfile + + - name: Set up application.yml + run: cp config/application.yml.example config/application.yml + + - name: Set up database + run: | + bundle exec rake db:create RAILS_ENV=test + bundle exec rake db:schema:load RAILS_ENV=test + + - name: Run tests + run: bundle exec rspec spec/models/spree test-admin-features: runs-on: ubuntu-18.04 diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 56e6253921..406ea10cd4 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -59,9 +59,11 @@ Capybara.register_driver :chrome do |app| options = Selenium::WebDriver::Chrome::Options.new( args: %w[headless disable-gpu no-sandbox window-size=1280,768] ) + options.add_preference(:download, default_directory: Rails.root.join("tmp", "downloads").to_s) + Capybara::Selenium::Driver .new(app, browser: :chrome, options: options) - .tap { |driver| driver.browser.download_path = DownloadsHelper.path.to_s } + .tap { |driver| driver.browser.download_path = Rails.root.join("tmp", "downloads").to_s } end Capybara.default_max_wait_time = 30