2019-09-04 21:01:54 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
require 'spec_helper'
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
RSpec.describe 'DevOps Report page', :js do
|
2017-09-10 17:25:29 +05:30
|
|
|
before do
|
2021-02-22 17:27:13 +05:30
|
|
|
admin = create(:admin)
|
|
|
|
sign_in(admin)
|
|
|
|
gitlab_enable_admin_mode_sign_in(admin)
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'with devops_adoption feature flag disabled' do
|
|
|
|
before do
|
|
|
|
stub_feature_flags(devops_adoption: false)
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
it 'has dismissable intro callout' do
|
2022-06-21 17:19:12 +05:30
|
|
|
visit admin_dev_ops_reports_path
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
expect(page).to have_content 'Introducing Your DevOps Report'
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
page.within(find('[data-testid="devops-score-container"]')) do
|
|
|
|
find('[data-testid="close-icon"]').click
|
|
|
|
end
|
2018-11-18 11:00:15 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
expect(page).not_to have_content 'Introducing Your DevOps Report'
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when usage ping is disabled' do
|
|
|
|
before do
|
|
|
|
stub_application_setting(usage_ping_enabled: false)
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
it 'shows empty state' do
|
2022-06-21 17:19:12 +05:30
|
|
|
visit admin_dev_ops_reports_path
|
2018-11-20 20:47:30 +05:30
|
|
|
|
2021-09-30 23:02:18 +05:30
|
|
|
expect(page).to have_text('Service ping is off')
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
2018-11-20 20:47:30 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
it 'hides the intro callout' do
|
2022-06-21 17:19:12 +05:30
|
|
|
visit admin_dev_ops_reports_path
|
2021-01-29 00:20:46 +05:30
|
|
|
|
|
|
|
expect(page).not_to have_content 'Introducing Your DevOps Report'
|
|
|
|
end
|
2018-11-20 20:47:30 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when there is no data to display' do
|
|
|
|
it 'shows empty state' do
|
|
|
|
stub_application_setting(usage_ping_enabled: true)
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
visit admin_dev_ops_reports_path
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
expect(page).to have_content('Data is still calculating')
|
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
|
2021-01-29 00:20:46 +05:30
|
|
|
context 'when there is data to display' do
|
2021-06-08 01:23:25 +05:30
|
|
|
it 'shows the DevOps Score app' do
|
2021-01-29 00:20:46 +05:30
|
|
|
stub_application_setting(usage_ping_enabled: true)
|
|
|
|
create(:dev_ops_report_metric)
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2022-06-21 17:19:12 +05:30
|
|
|
visit admin_dev_ops_reports_path
|
2017-09-10 17:25:29 +05:30
|
|
|
|
2021-06-08 01:23:25 +05:30
|
|
|
expect(page).to have_selector('[data-testid="devops-score-app"]')
|
2021-01-29 00:20:46 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|