Commit 4efb2b11 authored by eugielimpin's avatar eugielimpin

Add pipeline editor walkthrough feature permanently

The pipeline editor walkthrough experiment has been deemed a success.
Clean up the experiment code and update the feature implementation to
make the candidate path the default behavior in the application.

Changelog: changed
parent bccd75c8
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
import { GlButton, GlIcon } from '@gitlab/ui'; import { GlButton, GlIcon } from '@gitlab/ui';
import { __ } from '~/locale'; import { __ } from '~/locale';
import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue'; import LocalStorageSync from '~/vue_shared/components/local_storage_sync.vue';
import { experiment } from '~/experimentation/utils';
import { DRAWER_EXPANDED_KEY } from '../../constants'; import { DRAWER_EXPANDED_KEY } from '../../constants';
import FirstPipelineCard from './cards/first_pipeline_card.vue'; import FirstPipelineCard from './cards/first_pipeline_card.vue';
import GettingStartedCard from './cards/getting_started_card.vue'; import GettingStartedCard from './cards/getting_started_card.vue';
...@@ -50,29 +49,8 @@ export default { ...@@ -50,29 +49,8 @@ export default {
}, },
mounted() { mounted() {
this.setTopPosition(); this.setTopPosition();
this.setInitialExpandState();
}, },
methods: { methods: {
setInitialExpandState() {
let isExpanded;
experiment('pipeline_editor_walkthrough', {
control: () => {
isExpanded = true;
},
candidate: () => {
isExpanded = false;
},
});
// We check in the local storage and if no value is defined, we want the default
// to be true. We want to explicitly set it to true here so that the drawer
// animates to open on load.
const localValue = localStorage.getItem(this.$options.localDrawerKey);
if (localValue === null) {
this.isExpanded = isExpanded;
}
},
setTopPosition() { setTopPosition() {
const navbarEl = document.querySelector('.js-navbar'); const navbarEl = document.querySelector('.js-navbar');
......
...@@ -4,7 +4,6 @@ import { s__ } from '~/locale'; ...@@ -4,7 +4,6 @@ import { s__ } from '~/locale';
import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue'; import PipelineGraph from '~/pipelines/components/pipeline_graph/pipeline_graph.vue';
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { getParameterValues, setUrlParams, updateHistory } from '~/lib/utils/url_utility'; import { getParameterValues, setUrlParams, updateHistory } from '~/lib/utils/url_utility';
import GitlabExperiment from '~/experimentation/components/gitlab_experiment.vue';
import { import {
CREATE_TAB, CREATE_TAB,
EDITOR_APP_STATUS_EMPTY, EDITOR_APP_STATUS_EMPTY,
...@@ -66,7 +65,6 @@ export default { ...@@ -66,7 +65,6 @@ export default {
GlTabs, GlTabs,
PipelineGraph, PipelineGraph,
TextEditor, TextEditor,
GitlabExperiment,
WalkthroughPopover, WalkthroughPopover,
}, },
mixins: [glFeatureFlagsMixin()], mixins: [glFeatureFlagsMixin()],
...@@ -158,11 +156,7 @@ export default { ...@@ -158,11 +156,7 @@ export default {
data-testid="editor-tab" data-testid="editor-tab"
@click="setCurrentTab($options.tabConstants.CREATE_TAB)" @click="setCurrentTab($options.tabConstants.CREATE_TAB)"
> >
<gitlab-experiment name="pipeline_editor_walkthrough">
<template #candidate>
<walkthrough-popover v-if="isNewCiConfigFile" v-on="$listeners" /> <walkthrough-popover v-if="isNewCiConfigFile" v-on="$listeners" />
</template>
</gitlab-experiment>
<ci-editor-header /> <ci-editor-header />
<text-editor :commit-sha="commitSha" :value="ciFileContent" v-on="$listeners" /> <text-editor :commit-sha="commitSha" :value="ciFileContent" v-on="$listeners" />
</editor-tab> </editor-tab>
......
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class Projects::Ci::PipelineEditorController < Projects::ApplicationController class Projects::Ci::PipelineEditorController < Projects::ApplicationController
before_action :check_can_collaborate! before_action :check_can_collaborate!
before_action :setup_walkthrough_experiment, only: :show
before_action do before_action do
push_frontend_feature_flag(:schema_linting, @project, default_enabled: :yaml) push_frontend_feature_flag(:schema_linting, @project, default_enabled: :yaml)
end end
...@@ -19,11 +18,4 @@ class Projects::Ci::PipelineEditorController < Projects::ApplicationController ...@@ -19,11 +18,4 @@ class Projects::Ci::PipelineEditorController < Projects::ApplicationController
def check_can_collaborate! def check_can_collaborate!
render_404 unless can_collaborate_with_project?(@project) render_404 unless can_collaborate_with_project?(@project)
end end
def setup_walkthrough_experiment
experiment(:pipeline_editor_walkthrough, namespace: @project.namespace, sticky_to: current_user) do |e|
e.candidate {}
e.publish_to_database
end
end
end end
---
name: pipeline_editor_walkthrough
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/73050
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/345558
milestone: '14.5'
type: experiment
group: group::activation
default_enabled: false
...@@ -36,17 +36,5 @@ RSpec.describe Projects::Ci::PipelineEditorController do ...@@ -36,17 +36,5 @@ RSpec.describe Projects::Ci::PipelineEditorController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
end end
describe 'pipeline_editor_walkthrough experiment' do
before do
project.add_developer(user)
end
subject(:action) { show_request }
it_behaves_like 'tracks assignment and records the subject', :pipeline_editor_walkthrough, :namespace do
subject { project.namespace }
end
end
end end
end end
...@@ -42,9 +42,6 @@ RSpec.describe 'Merge request > User sees suggest pipeline', :js do ...@@ -42,9 +42,6 @@ RSpec.describe 'Merge request > User sees suggest pipeline', :js do
wait_for_requests wait_for_requests
# Drawer is open
expect(page).to have_content('This template creates a simple test pipeline. To use it:')
# Editor shows template # Editor shows template
expect(page).to have_content('This file is a template, and might need editing before it works on your project.') expect(page).to have_content('This file is a template, and might need editing before it works on your project.')
......
...@@ -81,8 +81,6 @@ RSpec.describe 'Pipeline Editor', :js do ...@@ -81,8 +81,6 @@ RSpec.describe 'Pipeline Editor', :js do
context 'when a change is made' do context 'when a change is made' do
before do before do
click_button 'Collapse'
page.within('#source-editor-') do page.within('#source-editor-') do
find('textarea').send_keys '123' find('textarea').send_keys '123'
# It takes some time after sending keys for the vue # It takes some time after sending keys for the vue
...@@ -127,8 +125,6 @@ RSpec.describe 'Pipeline Editor', :js do ...@@ -127,8 +125,6 @@ RSpec.describe 'Pipeline Editor', :js do
describe 'Editor content' do describe 'Editor content' do
it 'user can reset their CI configuration' do it 'user can reset their CI configuration' do
click_button 'Collapse'
page.within('#source-editor-') do page.within('#source-editor-') do
find('textarea').send_keys '123' find('textarea').send_keys '123'
end end
...@@ -151,8 +147,6 @@ RSpec.describe 'Pipeline Editor', :js do ...@@ -151,8 +147,6 @@ RSpec.describe 'Pipeline Editor', :js do
end end
it 'user can cancel reseting their CI configuration' do it 'user can cancel reseting their CI configuration' do
click_button 'Collapse'
page.within('#source-editor-') do page.within('#source-editor-') do
find('textarea').send_keys '123' find('textarea').send_keys '123'
end end
......
import { GlButton } from '@gitlab/ui'; import { GlButton } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils'; import { shallowMount } from '@vue/test-utils';
import { nextTick } from 'vue'; import { nextTick } from 'vue';
import { stubExperiments } from 'helpers/experimentation_helper';
import { useLocalStorageSpy } from 'helpers/local_storage_helper'; import { useLocalStorageSpy } from 'helpers/local_storage_helper';
import FirstPipelineCard from '~/pipeline_editor/components/drawer/cards/first_pipeline_card.vue'; import FirstPipelineCard from '~/pipeline_editor/components/drawer/cards/first_pipeline_card.vue';
import GettingStartedCard from '~/pipeline_editor/components/drawer/cards/getting_started_card.vue'; import GettingStartedCard from '~/pipeline_editor/components/drawer/cards/getting_started_card.vue';
...@@ -38,7 +37,6 @@ describe('Pipeline editor drawer', () => { ...@@ -38,7 +37,6 @@ describe('Pipeline editor drawer', () => {
beforeEach(() => { beforeEach(() => {
originalObjects.push(window.gon, window.gl); originalObjects.push(window.gon, window.gl);
stubExperiments({ pipeline_editor_walkthrough: 'control' });
}); });
afterEach(() => { afterEach(() => {
...@@ -48,33 +46,15 @@ describe('Pipeline editor drawer', () => { ...@@ -48,33 +46,15 @@ describe('Pipeline editor drawer', () => {
}); });
describe('default expanded state', () => { describe('default expanded state', () => {
describe('when experiment control', () => {
it('sets the drawer to be opened by default', async () => {
createComponent();
expect(findDrawerContent().exists()).toBe(false);
await nextTick();
expect(findDrawerContent().exists()).toBe(true);
});
});
describe('when experiment candidate', () => {
beforeEach(() => {
stubExperiments({ pipeline_editor_walkthrough: 'candidate' });
});
it('sets the drawer to be closed by default', async () => { it('sets the drawer to be closed by default', async () => {
createComponent(); createComponent();
expect(findDrawerContent().exists()).toBe(false); expect(findDrawerContent().exists()).toBe(false);
await nextTick();
expect(findDrawerContent().exists()).toBe(false);
});
}); });
}); });
describe('when the drawer is collapsed', () => { describe('when the drawer is collapsed', () => {
beforeEach(async () => { beforeEach(async () => {
createComponent(); createComponent();
await clickToggleBtn();
}); });
it('shows the left facing arrow icon', () => { it('shows the left facing arrow icon', () => {
...@@ -101,6 +81,7 @@ describe('Pipeline editor drawer', () => { ...@@ -101,6 +81,7 @@ describe('Pipeline editor drawer', () => {
describe('when the drawer is expanded', () => { describe('when the drawer is expanded', () => {
beforeEach(async () => { beforeEach(async () => {
createComponent(); createComponent();
await clickToggleBtn();
}); });
it('shows the right facing arrow icon', () => { it('shows the right facing arrow icon', () => {
......
...@@ -7,7 +7,6 @@ import WalkthroughPopover from '~/pipeline_editor/components/walkthrough_popover ...@@ -7,7 +7,6 @@ import WalkthroughPopover from '~/pipeline_editor/components/walkthrough_popover
import CiLint from '~/pipeline_editor/components/lint/ci_lint.vue'; import CiLint from '~/pipeline_editor/components/lint/ci_lint.vue';
import PipelineEditorTabs from '~/pipeline_editor/components/pipeline_editor_tabs.vue'; import PipelineEditorTabs from '~/pipeline_editor/components/pipeline_editor_tabs.vue';
import EditorTab from '~/pipeline_editor/components/ui/editor_tab.vue'; import EditorTab from '~/pipeline_editor/components/ui/editor_tab.vue';
import { stubExperiments } from 'helpers/experimentation_helper';
import { import {
CREATE_TAB, CREATE_TAB,
EDITOR_APP_STATUS_EMPTY, EDITOR_APP_STATUS_EMPTY,
...@@ -245,24 +244,7 @@ describe('Pipeline editor tabs component', () => { ...@@ -245,24 +244,7 @@ describe('Pipeline editor tabs component', () => {
}); });
}); });
describe('pipeline_editor_walkthrough experiment', () => { describe('pipeline editor walkthrough', () => {
describe('when in control path', () => {
beforeEach(() => {
stubExperiments({ pipeline_editor_walkthrough: 'control' });
});
it('does not show walkthrough popover', async () => {
createComponent({ mountFn: mount });
await nextTick();
expect(findWalkthroughPopover().exists()).toBe(false);
});
});
describe('when in candidate path', () => {
beforeEach(() => {
stubExperiments({ pipeline_editor_walkthrough: 'candidate' });
});
describe('when isNewCiConfigFile prop is true (default)', () => { describe('when isNewCiConfigFile prop is true (default)', () => {
beforeEach(async () => { beforeEach(async () => {
createComponent({ createComponent({
...@@ -284,11 +266,8 @@ describe('Pipeline editor tabs component', () => { ...@@ -284,11 +266,8 @@ describe('Pipeline editor tabs component', () => {
}); });
}); });
}); });
});
it('sets listeners on walkthrough popover', async () => { it('sets listeners on walkthrough popover', async () => {
stubExperiments({ pipeline_editor_walkthrough: 'candidate' });
const handler = jest.fn(); const handler = jest.fn();
createComponent({ createComponent({
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment