Skip to content

Commit

Permalink
i3371: Get RUN_IN_BROWSER working
Browse files Browse the repository at this point in the history
  • Loading branch information
sandbergja committed Jan 19, 2023
1 parent 15beed7 commit 276f9bc
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 16 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Testing
rake servers:start
```
*Note: You can stop everything with `rake servers:stop`
```

1. Run the all the tests
```
rake spec
Expand All @@ -87,6 +87,15 @@ Testing
```bash
rake spec SPEC=path/to/your_spec.rb:linenumber
```

#### Running system specs in the browser

```bash
RUN_IN_BROWSER=true bundle exec rspec spec/system
```

The browser will only display for system specs with `js: true`.

#### Building the browselists
```ruby
RAILS_ENV=test bundle exec rake browse:all
Expand Down
10 changes: 0 additions & 10 deletions spec/rails_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,6 @@
Warden.test_reset!
end

## Start to migrate to system specs.
# See https://medium.com/table-xi/a-quick-guide-to-rails-system-tests-in-rspec-b6e9e8a8b5f6
config.before(:each, type: :system) do
driven_by :rack_test
end

config.before(:each, type: :system, js: true) do
driven_by :selenium_chrome_headless
end

config.before(:suite) { Rails.cache.clear }
config.after { Rails.cache.clear }
end
Expand Down
7 changes: 3 additions & 4 deletions spec/support/system_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,12 @@

config.before(:each, type: :system, js: true) do
if ENV["RUN_IN_BROWSER"]
driven_by(:selenium)
driven_by(:selenium_chrome)
else
driven_by(:selenium_headless)
driven_by(:selenium_chrome_headless)
end
end

config.before(:each, type: :system, js: true, in_browser: true) do
driven_by(:selenium)
driven_by(:selenium_chrome)
end
end
2 changes: 1 addition & 1 deletion spec/system/numismatics_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require 'rails_helper'

describe 'Numismatics show page', type: :system, js: false do
describe 'Numismatics show page', type: :system do
before do
stub_holding_locations
visit '/catalog/coin-3750'
Expand Down

0 comments on commit 276f9bc

Please sign in to comment.