blob: 2dffef93600370ef843ff7c234dcde34219c8eea (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Admin uses repository checks', :request_store do
include StubENV
include Spec::Support::Helpers::ModalHelpers
let(:admin) { create(:admin) }
before do
stub_env('IN_MEMORY_APPLICATION_SETTINGS', 'false')
sign_in(admin)
end
context 'when admin mode is disabled' do
it 'admin project page requires admin mode' do
project = create(:project)
visit_admin_project_page(project)
expect(page).not_to have_css('.repository-check')
expect(page).to have_content('Enter Admin Mode')
end
end
context 'when admin mode is enabled' do
before do
gitlab_enable_admin_mode_sign_in(admin)
end
it 'to trigger a single check', :js do
project = create(:project)
visit_admin_project_page(project)
page.within('.repository-check') do
click_button 'Trigger repository check'
end
expect(page).to have_content('Repository check was triggered')
end
it 'to see a single failed repository check', :js do
project = create(:project)
project.update_columns(
last_repository_check_failed: true,
last_repository_check_at: Time.zone.now
)
visit_admin_project_page(project)
page.within('[data-testid="last-repository-check-failed-alert"]') do
expect(page.text).to match(/Last repository check \(just now\) failed/)
end
end
it 'to clear all repository checks', :js do
visit repository_admin_application_settings_path
expect(RepositoryCheck::ClearWorker).to receive(:perform_async)
accept_gl_confirm(button_text: 'Clear repository checks') do
find(:link, 'Clear all repository checks').send_keys(:return)
end
expect(page).to have_content('Started asynchronous removal of all repository check states.')
end
end
def visit_admin_project_page(project)
visit admin_project_path(project)
end
end
|