diff --git a/.rubocop_todo/rspec/missing_feature_category.yml b/.rubocop_todo/rspec/missing_feature_category.yml index 36c4fc33345fff2885b2beab13ed17db063b1dd9..c0d6955ae88eaafd9fd69b92d2b30bc1683ea58d 100644 --- a/.rubocop_todo/rspec/missing_feature_category.yml +++ b/.rubocop_todo/rspec/missing_feature_category.yml @@ -3304,13 +3304,11 @@ RSpec/MissingFeatureCategory: - 'spec/lib/gitlab/ci/status/pipeline/factory_spec.rb' - 'spec/lib/gitlab/ci/status/preparing_spec.rb' - 'spec/lib/gitlab/ci/status/running_spec.rb' - - 'spec/lib/gitlab/ci/status/scheduled_spec.rb' - 'spec/lib/gitlab/ci/status/skipped_spec.rb' - 'spec/lib/gitlab/ci/status/stage/common_spec.rb' - 'spec/lib/gitlab/ci/status/stage/factory_spec.rb' - 'spec/lib/gitlab/ci/status/stage/play_manual_spec.rb' - 'spec/lib/gitlab/ci/status/success_spec.rb' - - 'spec/lib/gitlab/ci/status/success_warning_spec.rb' - 'spec/lib/gitlab/ci/status/waiting_for_resource_spec.rb' - 'spec/lib/gitlab/ci/tags/bulk_insert_spec.rb' - 'spec/lib/gitlab/ci/templates/AWS/deploy_ecs_gitlab_ci_yaml_spec.rb' diff --git a/app/assets/javascripts/commit/pipelines/pipelines_table.vue b/app/assets/javascripts/commit/pipelines/pipelines_table.vue index f2dac15a99eb2c4c089666bab8126d753cce71fd..8c8293eb09e8bb24291ce23b4f30c4883adb6820 100644 --- a/app/assets/javascripts/commit/pipelines/pipelines_table.vue +++ b/app/assets/javascripts/commit/pipelines/pipelines_table.vue @@ -41,7 +41,7 @@ export default { viewType: { type: String, required: false, - default: 'child', + default: 'root', }, canCreatePipelineInTargetProject: { type: Boolean, diff --git a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue index 7b5ded9348fdaa4004c2f284373efaf6363ce18a..9023807eba3a2044f909f03865ec30d8ebd445da 100644 --- a/app/assets/javascripts/vue_shared/components/ci_badge_link.vue +++ b/app/assets/javascripts/vue_shared/components/ci_badge_link.vue @@ -1,5 +1,5 @@ diff --git a/lib/gitlab/ci/status/scheduled.rb b/lib/gitlab/ci/status/scheduled.rb index e9068c326cfcb8c7aabc22c86c5aea1de594416e..8526becfef9cc80efd634f9a457f16eae05b7502 100644 --- a/lib/gitlab/ci/status/scheduled.rb +++ b/lib/gitlab/ci/status/scheduled.rb @@ -5,11 +5,11 @@ module Ci module Status class Scheduled < Status::Core def text - s_('CiStatusText|delayed') + s_('CiStatusText|scheduled') end def label - s_('CiStatusLabel|delayed') + s_('CiStatusLabel|scheduled') end def icon diff --git a/lib/gitlab/ci/status/success_warning.rb b/lib/gitlab/ci/status/success_warning.rb index 47623ad945fe68689dd46f8128dc1c108ae50682..84a0e52f51833734e763a6b174d62296085175cf 100644 --- a/lib/gitlab/ci/status/success_warning.rb +++ b/lib/gitlab/ci/status/success_warning.rb @@ -9,7 +9,7 @@ module Status # class SuccessWarning < Status::Extended def text - s_('CiStatusText|passed') + s_('CiStatusText|warning') end def label diff --git a/locale/gitlab.pot b/locale/gitlab.pot index d66a953275ec444c339fff5978cc0feeddb27218..733cf34aa102da2630bbe19d6997c79689bd5c98 100644 --- a/locale/gitlab.pot +++ b/locale/gitlab.pot @@ -9595,9 +9595,6 @@ msgstr "" msgid "CiStatusLabel|created" msgstr "" -msgid "CiStatusLabel|delayed" -msgstr "" - msgid "CiStatusLabel|failed" msgstr "" @@ -9616,6 +9613,9 @@ msgstr "" msgid "CiStatusLabel|preparing" msgstr "" +msgid "CiStatusLabel|scheduled" +msgstr "" + msgid "CiStatusLabel|skipped" msgstr "" @@ -9655,12 +9655,18 @@ msgstr "" msgid "CiStatusText|preparing" msgstr "" +msgid "CiStatusText|scheduled" +msgstr "" + msgid "CiStatusText|skipped" msgstr "" msgid "CiStatusText|waiting" msgstr "" +msgid "CiStatusText|warning" +msgstr "" + msgid "CiStatus|running" msgstr "" diff --git a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb index 7d024103943c3abddcab307fca4b3f6947f08e2e..ca12e0e2b655b49bbfac839275be460c2643029c 100644 --- a/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_merge_request_pipelines_spec.rb @@ -67,7 +67,7 @@ it 'sees branch pipelines and detached merge request pipelines in correct order' do page.within('.ci-table') do - expect(page).to have_selector('.ci-created', count: 2) + expect(page).to have_selector('[data-testid="ci-badge-created"]', count: 2) expect(first('[data-testid="pipeline-url-link"]')).to have_content("##{detached_merge_request_pipeline.id}") end end @@ -103,7 +103,7 @@ it 'sees branch pipelines and detached merge request pipelines in correct order' do page.within('.ci-table') do - expect(page).to have_selector('.ci-pending', count: 4) + expect(page).to have_selector('[data-testid="ci-badge-pending"]', count: 4) expect(all('[data-testid="pipeline-url-link"]')[0]) .to have_content("##{detached_merge_request_pipeline_2.id}") @@ -246,7 +246,7 @@ it 'sees a branch pipeline in pipeline tab' do page.within('.ci-table') do - expect(page).to have_selector('.ci-created', count: 1) + expect(page).to have_selector('[data-testid="ci-badge-created"]', count: 1) expect(first('[data-testid="pipeline-url-link"]')).to have_content("##{push_pipeline.id}") end end @@ -299,7 +299,7 @@ it 'sees branch pipelines and detached merge request pipelines in correct order' do page.within('.ci-table') do - expect(page).to have_selector('.ci-pending', count: 2) + expect(page).to have_selector('[data-testid="ci-badge-pending"]', count: 2) expect(first('[data-testid="pipeline-url-link"]')).to have_content("##{detached_merge_request_pipeline.id}") end end @@ -315,7 +315,7 @@ it 'sees pipeline list in forked project' do visit project_pipelines_path(forked_project) - expect(page).to have_selector('.ci-pending', count: 2) + expect(page).to have_selector('[data-testid="ci-badge-pending"]', count: 2) end context 'when a user updated a merge request from a forked project to the parent project' do @@ -341,7 +341,7 @@ it 'sees branch pipelines and detached merge request pipelines in correct order' do page.within('.ci-table') do - expect(page).to have_selector('.ci-pending', count: 4) + expect(page).to have_selector('[data-testid="ci-badge-pending"]', count: 4) expect(all('[data-testid="pipeline-url-link"]')[0]) .to have_content("##{detached_merge_request_pipeline_2.id}") @@ -384,7 +384,7 @@ it 'sees pipeline list in forked project' do visit project_pipelines_path(forked_project) - expect(page).to have_selector('.ci-pending', count: 4) + expect(page).to have_selector('[data-testid="ci-badge-pending"]', count: 4) end end diff --git a/spec/features/merge_request/user_sees_pipelines_spec.rb b/spec/features/merge_request/user_sees_pipelines_spec.rb index f92ce3865a958519438c402c4c7a08a1adcd3f49..a2796cd250bdf72b556c69f63339f72831713e84 100644 --- a/spec/features/merge_request/user_sees_pipelines_spec.rb +++ b/spec/features/merge_request/user_sees_pipelines_spec.rb @@ -42,7 +42,7 @@ wait_for_requests page.within('[data-testid="pipeline-table-row"]') do - expect(page).to have_selector('.ci-success') + expect(page).to have_selector('[data-testid="ci-badge-passed"]') expect(page).to have_content(pipeline.id) expect(page).to have_content('API') expect(page).to have_css('[data-testid="pipeline-mini-graph"]') diff --git a/spec/features/projects/commit/user_sees_pipelines_tab_spec.rb b/spec/features/projects/commit/user_sees_pipelines_tab_spec.rb index da83bbcb63aecdffeb81637f14d72175b2f5d47b..e44364c7f2db7c44b663a90549d25c958e17c120 100644 --- a/spec/features/projects/commit/user_sees_pipelines_tab_spec.rb +++ b/spec/features/projects/commit/user_sees_pipelines_tab_spec.rb @@ -36,7 +36,7 @@ wait_for_requests page.within('[data-testid="pipeline-table-row"]') do - expect(page).to have_selector('.ci-success') + expect(page).to have_selector('[data-testid="ci-badge-passed"]') expect(page).to have_content(pipeline.id) expect(page).to have_content('API') expect(page).to have_css('[data-testid="pipeline-mini-graph"]') diff --git a/spec/features/projects/jobs/user_browses_jobs_spec.rb b/spec/features/projects/jobs/user_browses_jobs_spec.rb index d74a3d28068ddad92d2e19a08abb71cfa9e8d8fc..aeba53c22b6abbd93a734929198a9ed697460f56 100644 --- a/spec/features/projects/jobs/user_browses_jobs_spec.rb +++ b/spec/features/projects/jobs/user_browses_jobs_spec.rb @@ -72,7 +72,7 @@ def visit_jobs_page wait_for_requests - expect(page).to have_selector('.ci-canceled') + expect(page).to have_selector('[data-testid="ci-badge-canceled"]') expect(page).not_to have_selector('[data-testid="jobs-table-error-alert"]') end end @@ -94,7 +94,7 @@ def visit_jobs_page wait_for_requests - expect(page).to have_selector('.ci-pending') + expect(page).to have_selector('[data-testid="ci-badge-pending"]') end end @@ -134,7 +134,7 @@ def visit_jobs_page wait_for_requests - expect(page).to have_selector('.ci-pending') + expect(page).to have_selector('[data-testid="ci-badge-pending"]') end it 'unschedules a job successfully' do @@ -142,7 +142,7 @@ def visit_jobs_page wait_for_requests - expect(page).to have_selector('.ci-manual') + expect(page).to have_selector('[data-testid="ci-badge-manual"]') end end diff --git a/spec/features/projects/jobs_spec.rb b/spec/features/projects/jobs_spec.rb index 01f8f2166ac8880eb49161516b736bdab9da366e..a16db71354c824eb51272b2d91d46d505eb32d34 100644 --- a/spec/features/projects/jobs_spec.rb +++ b/spec/features/projects/jobs_spec.rb @@ -66,7 +66,7 @@ wait_for_requests - expect(page).to have_css('.ci-status.ci-success', text: 'passed') + expect(page).to have_css('[data-testid="ci-badge-passed"]', text: 'passed') end it 'shows commit`s data', :js do diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb index b8bb81991fc64dffc35fc49ce4fb513e5ece2546..70f9961ced8ac45b2daa790d70849253cace35c0 100644 --- a/spec/features/projects/pipelines/pipelines_spec.rb +++ b/spec/features/projects/pipelines/pipelines_spec.rb @@ -120,7 +120,7 @@ it 'indicates that pipeline can be canceled' do expect(page).to have_selector('.js-pipelines-cancel-button') - expect(page).to have_selector('.ci-running') + expect(page).to have_selector('[data-testid="ci-badge-running"]') end context 'when canceling' do @@ -132,7 +132,7 @@ it 'indicated that pipelines was canceled', :sidekiq_might_not_need_inline do expect(page).not_to have_selector('.js-pipelines-cancel-button') - expect(page).to have_selector('.ci-canceled') + expect(page).to have_selector('[data-testid="ci-badge-canceled"]') end end end @@ -150,7 +150,7 @@ it 'indicates that pipeline can be retried' do expect(page).to have_selector('.js-pipelines-retry-button') - expect(page).to have_selector('.ci-failed') + expect(page).to have_selector('[data-testid="ci-badge-failed"]') end context 'when retrying' do @@ -161,7 +161,7 @@ it 'shows running pipeline that is not retryable' do expect(page).not_to have_selector('.js-pipelines-retry-button') - expect(page).to have_selector('.ci-running') + expect(page).to have_selector('[data-testid="ci-badge-running"]') end end end @@ -400,7 +400,7 @@ end it 'shows the pipeline as preparing' do - expect(page).to have_selector('.ci-preparing') + expect(page).to have_selector('[data-testid="ci-badge-preparing"]') end end @@ -421,7 +421,7 @@ end it 'has pipeline running' do - expect(page).to have_selector('.ci-running') + expect(page).to have_selector('[data-testid="ci-badge-running"]') end context 'when canceling' do @@ -432,7 +432,7 @@ it 'indicates that pipeline was canceled', :sidekiq_might_not_need_inline do expect(page).not_to have_selector('.js-pipelines-cancel-button') - expect(page).to have_selector('.ci-canceled') + expect(page).to have_selector('[data-testid="ci-badge-canceled"]') end end end @@ -454,7 +454,7 @@ end it 'has failed pipeline', :sidekiq_might_not_need_inline do - expect(page).to have_selector('.ci-failed') + expect(page).to have_selector('[data-testid="ci-badge-failed"]') end end end diff --git a/spec/frontend/vue_shared/components/ci_badge_link_spec.js b/spec/frontend/vue_shared/components/ci_badge_link_spec.js index afb509b9fe6138055b321289e0ff722662fc9880..8c860c9b06f6d00459e435cba1f2cbcad19a0d65 100644 --- a/spec/frontend/vue_shared/components/ci_badge_link_spec.js +++ b/spec/frontend/vue_shared/components/ci_badge_link_spec.js @@ -1,4 +1,4 @@ -import { GlLink } from '@gitlab/ui'; +import { GlBadge } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import CiBadgeLink from '~/vue_shared/components/ci_badge_link.vue'; import CiIcon from '~/vue_shared/components/ci_icon.vue'; @@ -46,6 +46,13 @@ describe('CI Badge Link Component', () => { icon: 'status_pending', details_path: 'status/pending', }, + preparing: { + text: 'preparing', + label: 'preparing', + group: 'preparing', + icon: 'status_preparing', + details_path: 'status/preparing', + }, running: { text: 'running', label: 'running', @@ -53,6 +60,13 @@ describe('CI Badge Link Component', () => { icon: 'status_running', details_path: 'status/running', }, + scheduled: { + text: 'scheduled', + label: 'scheduled', + group: 'scheduled', + icon: 'status_scheduled', + details_path: 'status/scheduled', + }, skipped: { text: 'skipped', label: 'skipped', @@ -61,8 +75,8 @@ describe('CI Badge Link Component', () => { details_path: 'status/skipped', }, success_warining: { - text: 'passed', - label: 'passed', + text: 'warning', + label: 'passed with warnings', group: 'success-with-warnings', icon: 'status_warning', details_path: 'status/warning', @@ -77,6 +91,8 @@ describe('CI Badge Link Component', () => { }; const findIcon = () => wrapper.findComponent(CiIcon); + const findBadge = () => wrapper.findComponent(GlBadge); + const findBadgeText = () => wrapper.find('[data-testid="ci-badge-text"'); const createComponent = (propsData) => { wrapper = shallowMount(CiBadgeLink, { propsData }); @@ -87,22 +103,50 @@ describe('CI Badge Link Component', () => { expect(wrapper.attributes('href')).toBe(statuses[status].details_path); expect(wrapper.text()).toBe(statuses[status].text); - expect(wrapper.classes()).toContain('ci-status'); - expect(wrapper.classes()).toContain(`ci-${statuses[status].group}`); + expect(findBadge().props('size')).toBe('md'); expect(findIcon().exists()).toBe(true); }); + it.each` + status | textColor | variant + ${statuses.success} | ${'gl-text-green-700'} | ${'success'} + ${statuses.success_warining} | ${'gl-text-orange-700'} | ${'warning'} + ${statuses.failed} | ${'gl-text-red-700'} | ${'danger'} + ${statuses.running} | ${'gl-text-blue-700'} | ${'info'} + ${statuses.pending} | ${'gl-text-orange-700'} | ${'warning'} + ${statuses.preparing} | ${'gl-text-gray-600'} | ${'muted'} + ${statuses.canceled} | ${'gl-text-gray-700'} | ${'neutral'} + ${statuses.scheduled} | ${'gl-text-gray-600'} | ${'muted'} + ${statuses.skipped} | ${'gl-text-gray-600'} | ${'muted'} + ${statuses.manual} | ${'gl-text-gray-700'} | ${'neutral'} + ${statuses.created} | ${'gl-text-gray-600'} | ${'muted'} + `( + 'should contain correct badge class and variant for status: $status.text', + ({ status, textColor, variant }) => { + createComponent({ status }); + + expect(findBadgeText().classes()).toContain(textColor); + expect(findBadge().props('variant')).toBe(variant); + }, + ); + it('should not render label', () => { createComponent({ status: statuses.canceled, showText: false }); expect(wrapper.text()).toBe(''); }); - it('should emit ciStatusBadgeClick event', async () => { + it('should emit ciStatusBadgeClick event', () => { createComponent({ status: statuses.success }); - await wrapper.findComponent(GlLink).vm.$emit('click'); + findBadge().vm.$emit('click'); expect(wrapper.emitted('ciStatusBadgeClick')).toEqual([[]]); }); + + it('should render dynamic badge size', () => { + createComponent({ status: statuses.success, badgeSize: 'lg' }); + + expect(findBadge().props('size')).toBe('lg'); + }); }); diff --git a/spec/lib/gitlab/ci/status/build/factory_spec.rb b/spec/lib/gitlab/ci/status/build/factory_spec.rb index 21eca97331ec8caaf00e7f42d9eb728a0e48e2dd..f71f3d474523becee372c903c209750933c08ff5 100644 --- a/spec/lib/gitlab/ci/status/build/factory_spec.rb +++ b/spec/lib/gitlab/ci/status/build/factory_spec.rb @@ -370,7 +370,7 @@ end it 'fabricates status with correct details' do - expect(status.text).to eq s_('CiStatusText|delayed') + expect(status.text).to eq s_('CiStatusText|scheduled') expect(status.group).to eq 'scheduled' expect(status.icon).to eq 'status_scheduled' expect(status.favicon).to eq 'favicon_status_scheduled' diff --git a/spec/lib/gitlab/ci/status/scheduled_spec.rb b/spec/lib/gitlab/ci/status/scheduled_spec.rb index 8a923faf3f97e7336cce8d5b768bc9475e43e304..df72455d3c1ab6515faac5134d45309f31d8391b 100644 --- a/spec/lib/gitlab/ci/status/scheduled_spec.rb +++ b/spec/lib/gitlab/ci/status/scheduled_spec.rb @@ -2,17 +2,17 @@ require 'spec_helper' -RSpec.describe Gitlab::Ci::Status::Scheduled do +RSpec.describe Gitlab::Ci::Status::Scheduled, feature_category: :continuous_integration do subject do described_class.new(double('subject'), double('user')) end describe '#text' do - it { expect(subject.text).to eq 'delayed' } + it { expect(subject.text).to eq 'scheduled' } end describe '#label' do - it { expect(subject.label).to eq 'delayed' } + it { expect(subject.label).to eq 'scheduled' } end describe '#icon' do diff --git a/spec/lib/gitlab/ci/status/success_warning_spec.rb b/spec/lib/gitlab/ci/status/success_warning_spec.rb index 86b826ad272b2ec11cfeb975741bbbbeb347b418..1725f90a0cffdb1fdcd3762c333358ac08001a0d 100644 --- a/spec/lib/gitlab/ci/status/success_warning_spec.rb +++ b/spec/lib/gitlab/ci/status/success_warning_spec.rb @@ -2,7 +2,7 @@ require 'spec_helper' -RSpec.describe Gitlab::Ci::Status::SuccessWarning do +RSpec.describe Gitlab::Ci::Status::SuccessWarning, feature_category: :continuous_integration do let(:status) { double('status') } subject do @@ -10,7 +10,7 @@ end describe '#test' do - it { expect(subject.text).to eq 'passed' } + it { expect(subject.text).to eq 'warning' } end describe '#label' do