diff options
Diffstat (limited to 'spec')
-rw-r--r-- | spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb | 22 | ||||
-rw-r--r-- | spec/frontend/groups/components/app_spec.js | 3 | ||||
-rw-r--r-- | spec/frontend/groups/components/overview_tabs_spec.js | 1 | ||||
-rw-r--r-- | spec/frontend/ide/lib/alerts/environment_spec.js | 21 | ||||
-rw-r--r-- | spec/frontend/ide/services/index_spec.js | 33 | ||||
-rw-r--r-- | spec/frontend/ide/stores/actions/alert_spec.js | 46 | ||||
-rw-r--r-- | spec/frontend/ide/stores/getters/alert_spec.js | 46 | ||||
-rw-r--r-- | spec/frontend/ide/stores/mutations/alert_spec.js | 26 | ||||
-rw-r--r-- | spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.js | 13 | ||||
-rw-r--r-- | spec/helpers/groups_helper_spec.rb | 1 | ||||
-rw-r--r-- | spec/helpers/ide_helper_spec.rb | 33 | ||||
-rw-r--r-- | spec/support/rspec_order_todo.yml | 1 |
12 files changed, 19 insertions, 227 deletions
diff --git a/spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb b/spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb deleted file mode 100644 index d616672173e..00000000000 --- a/spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb +++ /dev/null @@ -1,22 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe InProductGuidanceEnvironmentsWebideExperiment, :experiment do - subject { described_class.new(project: project) } - - let(:project) { create(:project, :repository) } - - before do - stub_experiments(in_product_guidance_environments_webide: :candidate) - end - - it 'excludes projects with environments' do - create(:environment, project: project) - expect(subject).to exclude(project: project) - end - - it 'does not exlude projects without environments' do - expect(subject).not_to exclude(project: project) - end -end diff --git a/spec/frontend/groups/components/app_spec.js b/spec/frontend/groups/components/app_spec.js index 8ac410c87b1..027c1709e0b 100644 --- a/spec/frontend/groups/components/app_spec.js +++ b/spec/frontend/groups/components/app_spec.js @@ -58,6 +58,9 @@ describe('AppComponent', () => { mocks: { $toast, }, + provide: { + emptySearchIllustration: '/assets/illustrations/empty-state/empty-search-md.svg', + }, }); vm = wrapper.vm; }; diff --git a/spec/frontend/groups/components/overview_tabs_spec.js b/spec/frontend/groups/components/overview_tabs_spec.js index 6bed744685f..0ca59e9c6bf 100644 --- a/spec/frontend/groups/components/overview_tabs_spec.js +++ b/spec/frontend/groups/components/overview_tabs_spec.js @@ -44,6 +44,7 @@ describe('OverviewTabs', () => { newProjectIllustration: '', emptyProjectsIllustration: '', emptySubgroupIllustration: '', + emptySearchIllustration: '', canCreateSubgroups: false, canCreateProjects: false, initialSort: 'name_asc', diff --git a/spec/frontend/ide/lib/alerts/environment_spec.js b/spec/frontend/ide/lib/alerts/environment_spec.js deleted file mode 100644 index d645209345c..00000000000 --- a/spec/frontend/ide/lib/alerts/environment_spec.js +++ /dev/null @@ -1,21 +0,0 @@ -import { GlLink } from '@gitlab/ui'; -import { mount } from '@vue/test-utils'; -import Environments from '~/ide/lib/alerts/environments.vue'; - -describe('~/ide/lib/alerts/environment.vue', () => { - let wrapper; - - beforeEach(() => { - wrapper = mount(Environments); - }); - - it('shows a message regarding environments', () => { - expect(wrapper.text()).toBe( - "No deployments detected. Use environments to control your software's continuous deployment. Learn more about deployment jobs.", - ); - }); - - it('links to the help page on environments', () => { - expect(wrapper.findComponent(GlLink).attributes('href')).toBe('/help/ci/environments/index.md'); - }); -}); diff --git a/spec/frontend/ide/services/index_spec.js b/spec/frontend/ide/services/index_spec.js index cd099e60070..8e63b5801e8 100644 --- a/spec/frontend/ide/services/index_spec.js +++ b/spec/frontend/ide/services/index_spec.js @@ -2,12 +2,10 @@ import axios from 'axios'; import MockAdapter from 'axios-mock-adapter'; import getIdeProject from 'ee_else_ce/ide/queries/get_ide_project.query.graphql'; import Api from '~/api'; -import dismissUserCallout from '~/graphql_shared/mutations/dismiss_user_callout.mutation.graphql'; import services from '~/ide/services'; -import { query, mutate } from '~/ide/services/gql'; +import { query } from '~/ide/services/gql'; import { HTTP_STATUS_OK } from '~/lib/utils/http_status'; import { escapeFileUrl } from '~/lib/utils/url_utility'; -import ciConfig from '~/ci/pipeline_editor/graphql/queries/ci_config.query.graphql'; import { projectData } from '../mock_data'; jest.mock('~/api'); @@ -276,35 +274,6 @@ describe('IDE services', () => { }); }); }); - describe('getCiConfig', () => { - const TEST_PROJECT_PATH = 'foo/bar'; - const TEST_CI_CONFIG = 'test config'; - - it('queries with the given CI config and project', () => { - const result = { data: { ciConfig: { test: 'data' } } }; - query.mockResolvedValue(result); - return services.getCiConfig(TEST_PROJECT_PATH, TEST_CI_CONFIG).then((data) => { - expect(data).toEqual(result.data.ciConfig); - expect(query).toHaveBeenCalledWith({ - query: ciConfig, - variables: { projectPath: TEST_PROJECT_PATH, content: TEST_CI_CONFIG }, - }); - }); - }); - }); - describe('dismissUserCallout', () => { - it('mutates the callout to dismiss', () => { - const result = { data: { callouts: { test: 'data' } } }; - mutate.mockResolvedValue(result); - return services.dismissUserCallout('test').then((data) => { - expect(data).toEqual(result.data); - expect(mutate).toHaveBeenCalledWith({ - mutation: dismissUserCallout, - variables: { input: { featureName: 'test' } }, - }); - }); - }); - }); describe('getProjectPermissionsData', () => { const TEST_PROJECT_PATH = 'foo/bar'; diff --git a/spec/frontend/ide/stores/actions/alert_spec.js b/spec/frontend/ide/stores/actions/alert_spec.js deleted file mode 100644 index 1321c402ebb..00000000000 --- a/spec/frontend/ide/stores/actions/alert_spec.js +++ /dev/null @@ -1,46 +0,0 @@ -import testAction from 'helpers/vuex_action_helper'; -import service from '~/ide/services'; -import { - detectEnvironmentsGuidance, - dismissEnvironmentsGuidance, -} from '~/ide/stores/actions/alert'; -import * as types from '~/ide/stores/mutation_types'; - -jest.mock('~/ide/services'); - -describe('~/ide/stores/actions/alert', () => { - describe('detectEnvironmentsGuidance', () => { - it('should try to fetch CI info', () => { - const stages = ['a', 'b', 'c']; - service.getCiConfig.mockResolvedValue({ stages }); - - return testAction( - detectEnvironmentsGuidance, - 'the content', - { currentProjectId: 'gitlab/test' }, - [{ type: types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT, payload: stages }], - [], - () => expect(service.getCiConfig).toHaveBeenCalledWith('gitlab/test', 'the content'), - ); - }); - }); - describe('dismissCallout', () => { - it('should try to dismiss the given callout', () => { - const callout = { featureName: 'test', dismissedAt: 'now' }; - - service.dismissUserCallout.mockResolvedValue({ userCalloutCreate: { userCallout: callout } }); - - return testAction( - dismissEnvironmentsGuidance, - undefined, - {}, - [{ type: types.DISMISS_ENVIRONMENTS_GUIDANCE_ALERT }], - [], - () => - expect(service.dismissUserCallout).toHaveBeenCalledWith( - 'web_ide_ci_environments_guidance', - ), - ); - }); - }); -}); diff --git a/spec/frontend/ide/stores/getters/alert_spec.js b/spec/frontend/ide/stores/getters/alert_spec.js deleted file mode 100644 index 7068b8e637f..00000000000 --- a/spec/frontend/ide/stores/getters/alert_spec.js +++ /dev/null @@ -1,46 +0,0 @@ -import { getAlert } from '~/ide/lib/alerts'; -import EnvironmentsMessage from '~/ide/lib/alerts/environments.vue'; -import { createStore } from '~/ide/stores'; -import * as getters from '~/ide/stores/getters/alert'; -import { file } from '../../helpers'; - -describe('IDE store alert getters', () => { - let localState; - let localStore; - - beforeEach(() => { - localStore = createStore(); - localState = localStore.state; - }); - - describe('alerts', () => { - describe('shows an alert about environments', () => { - let alert; - - beforeEach(() => { - const f = file('.gitlab-ci.yml'); - localState.openFiles.push(f); - localState.currentActivityView = 'repo-commit-section'; - localState.environmentsGuidanceAlertDetected = true; - localState.environmentsGuidanceAlertDismissed = false; - - const alertKey = getters.getAlert(localState)(f); - alert = getAlert(alertKey); - }); - - it('has a message suggesting to use environments', () => { - expect(alert.message).toEqual(EnvironmentsMessage); - }); - - it('dispatches to dismiss the callout on dismiss', () => { - jest.spyOn(localStore, 'dispatch').mockImplementation(); - alert.dismiss(localStore); - expect(localStore.dispatch).toHaveBeenCalledWith('dismissEnvironmentsGuidance'); - }); - - it('should be a tip alert', () => { - expect(alert.props).toEqual({ variant: 'tip' }); - }); - }); - }); -}); diff --git a/spec/frontend/ide/stores/mutations/alert_spec.js b/spec/frontend/ide/stores/mutations/alert_spec.js deleted file mode 100644 index 2840ec4ebb7..00000000000 --- a/spec/frontend/ide/stores/mutations/alert_spec.js +++ /dev/null @@ -1,26 +0,0 @@ -import * as types from '~/ide/stores/mutation_types'; -import mutations from '~/ide/stores/mutations/alert'; - -describe('~/ide/stores/mutations/alert', () => { - const state = {}; - - describe(types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT, () => { - it('checks the stages for any that configure environments', () => { - mutations[types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT](state, { - nodes: [{ groups: { nodes: [{ jobs: { nodes: [{}] } }] } }], - }); - expect(state.environmentsGuidanceAlertDetected).toBe(true); - mutations[types.DETECT_ENVIRONMENTS_GUIDANCE_ALERT](state, { - nodes: [{ groups: { nodes: [{ jobs: { nodes: [{ environment: {} }] } }] } }], - }); - expect(state.environmentsGuidanceAlertDetected).toBe(false); - }); - }); - - describe(types.DISMISS_ENVIRONMENTS_GUIDANCE_ALERT, () => { - it('stops environments guidance', () => { - mutations[types.DISMISS_ENVIRONMENTS_GUIDANCE_ALERT](state); - expect(state.environmentsGuidanceAlertDismissed).toBe(true); - }); - }); -}); diff --git a/spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.js b/spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.js index adbf4e1d371..c9cc34e2cfc 100644 --- a/spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.js +++ b/spec/frontend/vue_merge_request_widget/components/states/mr_widget_ready_to_merge_spec.js @@ -212,6 +212,19 @@ describe('ReadyToMerge', () => { expect(findMergeButton().text()).toBe('Set to auto-merge'); expect(findMergeHelperText().text()).toBe('Merge when pipeline succeeds'); }); + + it('should show merge help text when pipeline has failed and has an auto merge strategy', () => { + createComponent({ + mr: { + pipeline: { status: 'FAILED' }, + availableAutoMergeStrategies: MWPS_MERGE_STRATEGY, + hasCI: true, + }, + }); + + expect(findMergeButton().text()).toBe('Set to auto-merge'); + expect(findMergeHelperText().text()).toBe('Merge when pipeline succeeds'); + }); }); describe('merge immediately dropdown', () => { diff --git a/spec/helpers/groups_helper_spec.rb b/spec/helpers/groups_helper_spec.rb index 5f192701b33..807898884a1 100644 --- a/spec/helpers/groups_helper_spec.rb +++ b/spec/helpers/groups_helper_spec.rb @@ -490,6 +490,7 @@ RSpec.describe GroupsHelper, feature_category: :groups_and_projects do new_project_illustration: including('illustrations/project-create-new-sm'), empty_projects_illustration: including('illustrations/empty-state/empty-projects-md'), empty_subgroup_illustration: including('illustrations/empty-state/empty-subgroup-md'), + empty_search_illustration: including('illustrations/empty-state/empty-search-md'), render_empty_state: 'true', can_create_subgroups: 'true', can_create_projects: 'true' diff --git a/spec/helpers/ide_helper_spec.rb b/spec/helpers/ide_helper_spec.rb index d5d7f8f72b3..99ef0998fda 100644 --- a/spec/helpers/ide_helper_spec.rb +++ b/spec/helpers/ide_helper_spec.rb @@ -61,39 +61,6 @@ RSpec.describe IdeHelper, feature_category: :web_ide do end end - context 'with environments guidance experiment', :experiment do - before do - stub_experiments(in_product_guidance_environments_webide: :candidate) - end - - context 'when project has no enviornments' do - it 'enables environment guidance' do - expect(helper.ide_data(project: project, fork_info: fork_info, params: params)) - .to include('enable-environments-guidance' => 'true') - end - - context 'and the callout has been dismissed' do - it 'disables environment guidance' do - callout = create(:callout, feature_name: :web_ide_ci_environments_guidance, user: user) - callout.update!(dismissed_at: Time.now - 1.week) - allow(helper).to receive(:current_user).and_return(User.find(user.id)) - - expect(helper.ide_data(project: project, fork_info: fork_info, params: params)) - .to include('enable-environments-guidance' => 'false') - end - end - end - - context 'when the project has environments' do - it 'disables environment guidance' do - create(:environment, project: project) - - expect(helper.ide_data(project: project, fork_info: fork_info, params: params)) - .to include('enable-environments-guidance' => 'false') - end - end - end - context 'with vscode_web_ide=true' do let(:base_data) do { diff --git a/spec/support/rspec_order_todo.yml b/spec/support/rspec_order_todo.yml index cb6cffd064f..b93442a87a9 100644 --- a/spec/support/rspec_order_todo.yml +++ b/spec/support/rspec_order_todo.yml @@ -3338,7 +3338,6 @@ - './spec/db/schema_spec.rb' - './spec/dependencies/omniauth_saml_spec.rb' - './spec/experiments/application_experiment_spec.rb' -- './spec/experiments/in_product_guidance_environments_webide_experiment_spec.rb' - './spec/features/abuse_report_spec.rb' - './spec/features/action_cable_logging_spec.rb' - './spec/features/admin/admin_abuse_reports_spec.rb' |