Skip to content

Commit

Permalink
[FIX] Fix flaky embargo tests
Browse files Browse the repository at this point in the history
**ISSUE**
The embargo specs fail intermittently when run in the full suite.

**DIAGNOSIS**
Depending on the randomized test order, the admin tests may run
before the regular user tests. In some test orders, the admin
user may remain logged in while the tests for regular users are run
resulting in admin-only data being rendered in the views.

**FIX**
Explicitly log out any user from a previous test when testing
regular or unauthenticated user views.
  • Loading branch information
mark-dce committed Sep 26, 2024
1 parent 41043dc commit 1d5af52
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions spec/system/embargo_show_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
end

scenario "base etd has expected embargo values after creation", :aggregate_failures do
logout
expect(etd.degree_awarded).to eq nil
expect(etd.embargo.embargo_release_date).to eq many_years_from_today
expect(etd.embargo_length).to eq "6 months"
Expand Down Expand Up @@ -121,6 +122,7 @@
etd.reload # to clear cached data in memory after approval & graudation processes

# viewed by any user - logged in or not
logout # ensure we're not still logged in as an admin from another test
visit("/concern/etds/#{etd.id}")
expect(page).to have_content "Abstract"
expect(page).to have_content "This abstract is under embargo until #{formatted_embargo_release_date(etd)}"
Expand Down

0 comments on commit 1d5af52

Please sign in to comment.