diff options
Diffstat (limited to 'spec')
3 files changed, 135 insertions, 30 deletions
diff --git a/spec/features/admin/admin_dev_ops_report_spec.rb b/spec/features/admin/admin_dev_ops_report_spec.rb index c201011cbea..cc98a275b74 100644 --- a/spec/features/admin/admin_dev_ops_report_spec.rb +++ b/spec/features/admin/admin_dev_ops_report_spec.rb @@ -2,59 +2,163 @@ require 'spec_helper' -RSpec.describe 'DevOps Report page' do +RSpec.describe 'DevOps Report page', :js do + tabs_selector = '.js-devops-tabs' + tab_item_selector = '.js-devops-tab-item' + active_tab_selector = '.nav-link.active' + before do sign_in(create(:admin)) end - it 'has dismissable intro callout', :js do - visit admin_dev_ops_report_path - - expect(page).to have_content 'Introducing Your DevOps Report' - - find('.js-close-callout').click - - expect(page).not_to have_content 'Introducing Your DevOps Report' - end - - context 'when usage ping is disabled' do + context 'with devops_adoption feature flag disabled' do before do - stub_application_setting(usage_ping_enabled: false) + stub_feature_flags(devops_adoption: false) end - it 'shows empty state', :js do + it 'does not show the tabbed layout' do visit admin_dev_ops_report_path - expect(page).to have_selector(".js-empty-state") + expect(page).not_to have_selector tabs_selector end - it 'hides the intro callout' do + it 'has dismissable intro callout' do visit admin_dev_ops_report_path + expect(page).to have_content 'Introducing Your DevOps Report' + + find('.js-close-callout').click + expect(page).not_to have_content 'Introducing Your DevOps Report' end + + context 'when usage ping is disabled' do + before do + stub_application_setting(usage_ping_enabled: false) + end + + it 'shows empty state' do + visit admin_dev_ops_report_path + + expect(page).to have_selector(".js-empty-state") + end + + it 'hides the intro callout' do + visit admin_dev_ops_report_path + + expect(page).not_to have_content 'Introducing Your DevOps Report' + end + end + + context 'when there is no data to display' do + it 'shows empty state' do + stub_application_setting(usage_ping_enabled: true) + + visit admin_dev_ops_report_path + + expect(page).to have_content('Data is still calculating') + end + end + + context 'when there is data to display' do + it 'shows numbers for each metric' do + stub_application_setting(usage_ping_enabled: true) + create(:dev_ops_report_metric) + + visit admin_dev_ops_report_path + + expect(page).to have_content( + 'Issues created per active user 1.2 You 9.3 Lead 13.3%' + ) + end + end end - context 'when there is no data to display' do - it 'shows empty state' do - stub_application_setting(usage_ping_enabled: true) + context 'with devops_adoption feature flag enabled' do + it 'shows the tabbed layout' do + visit admin_dev_ops_report_path + + expect(page).to have_selector tabs_selector + end + it 'shows the correct tabs' do visit admin_dev_ops_report_path - expect(page).to have_content('Data is still calculating') + within tabs_selector do + expect(page.all(:css, tab_item_selector).length).to be(2) + expect(page).to have_text 'DevOps Score Adoption' + end end - end - context 'when there is data to display' do - it 'shows numbers for each metric' do - stub_application_setting(usage_ping_enabled: true) - create(:dev_ops_report_metric) + it 'defaults to the DevOps Score tab' do + visit admin_dev_ops_report_path + + within tabs_selector do + expect(page).to have_selector active_tab_selector, text: 'DevOps Score' + end + end + it 'displays the Adoption tab content when selected' do visit admin_dev_ops_report_path - expect(page).to have_content( - 'Issues created per active user 1.2 You 9.3 Lead 13.3%' - ) + click_link 'Adoption' + + within tabs_selector do + expect(page).to have_selector active_tab_selector, text: 'Adoption' + end + end + + context 'the devops score tab' do + it 'has dismissable intro callout' do + visit admin_dev_ops_report_path + + expect(page).to have_content 'Introducing Your DevOps Report' + + find('.js-close-callout').click + + expect(page).not_to have_content 'Introducing Your DevOps Report' + end + + context 'when usage ping is disabled' do + before do + stub_application_setting(usage_ping_enabled: false) + end + + it 'shows empty state' do + visit admin_dev_ops_report_path + + expect(page).to have_selector(".js-empty-state") + end + + it 'hides the intro callout' do + visit admin_dev_ops_report_path + + expect(page).not_to have_content 'Introducing Your DevOps Report' + end + end + + context 'when there is no data to display' do + it 'shows empty state' do + stub_application_setting(usage_ping_enabled: true) + + visit admin_dev_ops_report_path + + expect(page).to have_content('Data is still calculating') + end + end + + context 'when there is data to display' do + it 'shows numbers for each metric' do + stub_application_setting(usage_ping_enabled: true) + create(:dev_ops_report_metric) + + visit admin_dev_ops_report_path + + expect(page).to have_content( + 'Issues created per active user 1.2 You 9.3 Lead 13.3%' + ) + end + end end end end diff --git a/spec/frontend/issue_show/issue_spec.js b/spec/frontend/issue_show/issue_spec.js index c0175e774a2..91cacb4601c 100644 --- a/spec/frontend/issue_show/issue_spec.js +++ b/spec/frontend/issue_show/issue_spec.js @@ -5,6 +5,7 @@ import axios from '~/lib/utils/axios_utils'; import initIssuableApp from '~/issue_show/issue'; import * as parseData from '~/issue_show/utils/parse_data'; import { appProps } from './mock_data'; +import createStore from '~/notes/stores'; const mock = new MockAdapter(axios); mock.onGet().reply(200); @@ -30,7 +31,7 @@ describe('Issue show index', () => { }); const issuableData = parseData.parseIssuableData(); - initIssuableApp(issuableData); + initIssuableApp(issuableData, createStore()); await waitForPromises(); diff --git a/spec/frontend/projects/components/__snapshots__/project_delete_button_spec.js.snap b/spec/frontend/projects/components/__snapshots__/project_delete_button_spec.js.snap index a0fd6012546..4eb5060cb0a 100644 --- a/spec/frontend/projects/components/__snapshots__/project_delete_button_spec.js.snap +++ b/spec/frontend/projects/components/__snapshots__/project_delete_button_spec.js.snap @@ -57,7 +57,7 @@ exports[`Project remove modal initialized matches the snapshot 1`] = ` </gl-alert-stub> <p> - This action cannot be undone. You will lose the project's repository and all content: issues, merge requests, etc. + This action cannot be undone. You will lose this project's repository and all content: issues, merge requests, etc. </p> <p |