blob: 4d549dde8584eb5e2d309559939e4be3509a941c (
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
|
# frozen_string_literal: true
module QA
context 'Verify', :docker, :runner do
describe 'Code coverage statistics' do
let(:simplecov) { '\(\d+.\d+\%\) covered' }
let(:executor) { "qa-runner-#{Time.now.to_i}" }
let(:runner) do
Resource::Runner.fabricate_via_api! do |runner|
runner.name = executor
runner.tags = ['e2e-test']
end
end
let(:merge_request) do
Resource::MergeRequest.fabricate_via_api! do |mr|
mr.project = runner.project
mr.file_name = '.gitlab-ci.yml'
mr.file_content = <<~EOF
test:
tags: [e2e-test]
script:
- echo '(66.67%) covered'
EOF
end
end
before do
Flow::Login.sign_in
end
after do
runner.remove_via_api!
end
it 'creates an MR with code coverage statistics' do
runner.project.visit!
configure_code_coverage(simplecov)
merge_request.visit!
Page::MergeRequest::Show.perform do |mr_widget|
Support::Retrier.retry_until(max_attempts: 5, sleep_interval: 5) do
mr_widget.has_pipeline_status?(/Pipeline #\d+ passed/)
end
expect(mr_widget).to have_content('Coverage 66.67%')
end
end
end
private
def configure_code_coverage(coverage_tool_pattern)
Page::Project::Menu.perform(&:go_to_ci_cd_settings)
Page::Project::Settings::CICD.perform do |settings|
settings.expand_general_pipelines do |coverage|
coverage.configure_coverage_regex(coverage_tool_pattern)
end
end
end
end
end
|