Skip to content

Commit

Permalink
fix: flaky spec
Browse files Browse the repository at this point in the history
 Motivation
 ----------
 Also this took me way too long to fix. #1729 suffers under some unrelated failing spec. On my machine, even when I `git switch main` on the 07694a6 I will see sometimes a failing spec, sometimes it passes.

Here is an example:
```

  1) Configuring Onboarding Channels allows activating and deactivating onboarding channels
     Failure/Error: expect(page).to have_current_path(settings_path(as: admin))
       expected "/settings" to equal "/settings?as=177"

     [Screenshot Image]: tmp/screenshots/failures_r_spec_example_groups_configuring_onboarding_channels_allows_activating_and_deactivating_onboarding_channels_617.png

     # ./spec/system/settings/onboarding_channels_spec.rb:26:in `block (2 levels) in <main>'
     # ./spec/support/better_rails_system_tests.rb:26:in `block (2 levels) in <main>'
     # -e:1:in `<main>'
```

I don't think it is necessary to check the query params here, maybe it was even an oversight. What I still don't understand: What is `some_route_path(as: some_user)` even doing? And why did it work in the past?

 How to test
 -----------
 1. `git switch main`
 2. `bin/rspec spec/system/settings/onboarding_channels_spec.rb` multiple (!) times
 3. Sometims green, sometimes red

 This should not happen on this branch anymore.
  • Loading branch information
roschaefer committed Jan 9, 2024
1 parent 4ea4001 commit 63269d4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion spec/system/settings/onboarding_channels_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
end

click_on 'Speichern'
expect(page).to have_current_path(settings_path(as: admin))
expect(page).to have_current_path(settings_path, ignore_query: true)

within('.OnboardingChannelsCheckboxes') do
Setting.channels.keys.map(&:to_sym).each do |key|
Expand Down

0 comments on commit 63269d4

Please sign in to comment.