blob: a64d3f241f6124477e97cf590d3d32294d6496cb (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin Mode Logout', :js, feature_category: :system_access do
include TermsHelper
include UserLoginHelper
include Features::TopNavSpecHelpers
let(:user) { create(:admin) }
before do
# TODO: This used to use gitlab_sign_in, instead of sign_in, but that is buggy. See
# this issue to look into why: https://gitlab.com/gitlab-org/gitlab/-/issues/331851
sign_in(user)
gitlab_enable_admin_mode_sign_in(user)
visit admin_root_path
end
it 'disable removes admin mode and redirects to root page' do
gitlab_disable_admin_mode
expect(page).to have_current_path root_path, ignore_query: true
open_top_nav
within_top_nav do
expect(page).to have_link(href: new_admin_session_path)
end
end
it 'disable shows flash notice' do
gitlab_disable_admin_mode
expect(page).to have_selector('[data-testid="alert-info"]')
end
context 'on a read-only instance' do
before do
allow(Gitlab::Database).to receive(:read_only?).and_return(true)
end
it 'disable removes admin mode and redirects to root page' do
gitlab_disable_admin_mode
expect(page).to have_current_path root_path, ignore_query: true
open_top_nav
within_top_nav do
expect(page).to have_link(href: new_admin_session_path)
end
end
end
end
|