diff options
Diffstat (limited to 'qa/spec/spec_helper.rb')
-rw-r--r-- | qa/spec/spec_helper.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/qa/spec/spec_helper.rb b/qa/spec/spec_helper.rb index 363980acc33..ed29bfa41dd 100644 --- a/qa/spec/spec_helper.rb +++ b/qa/spec/spec_helper.rb @@ -23,6 +23,24 @@ RSpec.configure do |config| QA::Runtime::Logger.debug("Starting test: #{example.full_description}") if QA::Runtime::Env.debug? end + config.after(:context) do + if !QA::Runtime::Browser.blank_page? && QA::Page::Main::Menu.perform(&:signed_in?) + QA::Page::Main::Menu.perform(&:sign_out) + raise( + <<~ERROR + The test left the browser signed in. + + Usually, Capybara prevents this from happening but some things can + interfere. For example, if it has an `after(:context)` block that logs + in, the browser will stay logged in and this will cause the next test + to fail. + + Please make sure the test does not leave the browser signed in. + ERROR + ) + end + end + config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end |