summaryrefslogtreecommitdiff
path: root/qa/qa/specs/features/browser_ui/1_manage/login/maintain_log_in_mixed_env_spec.rb
blob: 2b1c956039f755c95a9c72d1fff3468e429a0e93 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# frozen_string_literal: true

module QA
  RSpec.describe 'Manage', :mixed_env, :smoke, only: { subdomain: :staging } do
    describe 'basic user' do
      it 'remains logged in when redirected from canary to non-canary node', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/quality/test_cases/2251' do
        Runtime::Browser.visit(:gitlab, Page::Main::Login)

        Support::Retrier.retry_until(sleep_interval: 0.5) do
          Page::Main::Login.perform(&:can_sign_in?)
        end

        Runtime::Browser::Session.target_canary(true)
        Flow::Login.sign_in

        verify_session_on_canary(true)

        Runtime::Browser::Session.target_canary(false)

        verify_session_on_canary(false)

        Support::Retrier.retry_until(sleep_interval: 0.5) do
          Page::Main::Menu.perform(&:sign_out)

          Page::Main::Login.perform(&:can_sign_in?)
        end
      end

      def verify_session_on_canary(enable_canary)
        Page::Main::Menu.perform do |menu|
          aggregate_failures 'testing session log in' do
            expect(menu.canary?).to be(enable_canary)
            expect(menu).to have_personal_area
          end
        end
      end
    end
  end
end