mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Fix browser's download path configuration
The CI build can't find the downloaded file and fails like:
```
2) enterprise fee summaries csv downloads smoke test for generation of report based on permissions when logged in as enterprise user generates file with data for the enterprise
Failure/Error: sleep 0.1 until downloaded?
Timeout::Error:
execution expired
# ./spec/support/downloads_helper.rb:34:in `sleep'
# ./spec/support/downloads_helper.rb:34:in `block in wait_for_download'
# ./spec/support/downloads_helper.rb:33:in `wait_for_download'
# ./spec/support/downloads_helper.rb:11:in `downloaded_filename'
# ./engines/order_management/spec/features/order_management/reports/enterprise_fee_summaries_spec.rb:119:in `block (5 levels) in <top (required)>'
# ./engines/order_management/spec/features/order_management/reports/enterprise_fee_summaries_spec.rb:80:in `block (4 levels) in <top (required)>'
# ./spec/support/downloads_helper.rb:22:in `with_empty_downloads_folder'
# ./engines/order_management/spec/features/order_management/reports/enterprise_fee_summaries_spec.rb:80:in `block (3 levels) in <top (required)>'
```
This commit is contained in:
45
.github/workflows/build.yml
vendored
45
.github/workflows/build.yml
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user