Commit 41a43001 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '300860-jobs-empty-state-successful-cleanup' into 'master'

Resolve "[Jobs empty state] Successful Cleanup" [RUN ALL RSPEC] [RUN AS-IF-FOSS]

See merge request gitlab-org/gitlab!53240
parents e3581b40 61c8de8c
import Vue from 'vue';
import GlCountdown from '~/vue_shared/components/gl_countdown.vue';
import Tracking from '~/tracking';
document.addEventListener('DOMContentLoaded', () => {
const remainingTimeElements = document.querySelectorAll('.js-remaining-time');
......@@ -17,13 +16,4 @@ document.addEventListener('DOMContentLoaded', () => {
},
}),
);
const trackButtonClick = () => {
if (gon.tracking_data) {
const { category, action, ...data } = gon.tracking_data;
Tracking.event(category, action, data);
}
};
const buttons = document.querySelectorAll('.js-empty-state-button');
buttons.forEach((button) => button.addEventListener('click', trackButtonClick));
});
......@@ -15,9 +15,6 @@ class Projects::JobsController < Projects::ApplicationController
before_action :verify_api_request!, only: :terminal_websocket_authorize
before_action :authorize_create_proxy_build!, only: :proxy_websocket_authorize
before_action :verify_proxy_request!, only: :proxy_websocket_authorize
before_action only: :index do
frontend_experimentation_tracking_data(:jobs_empty_state, 'click_button')
end
layout 'project'
......
- admin = local_assigns.fetch(:admin, false)
- if builds.blank?
- if experiment_enabled?(:jobs_empty_state)
- if @project
.row.empty-state
.col-12
.svg-content.svg-250
......@@ -12,7 +12,7 @@
= s_('Jobs|Use jobs to automate your tasks')
%p
= s_('Jobs|Jobs are the building blocks of a GitLab CI/CD pipeline. Each job has a specific task, like testing code. To set up jobs in a CI/CD pipeline, add a CI/CD configuration file to your project.')
= link_to s_('Jobs|Create CI/CD configuration file'), help_page_path('ci/quick_start/README'), class: 'btn gl-button btn-info js-empty-state-button'
= link_to s_('Jobs|Create CI/CD configuration file'), @project.present(current_user: current_user).add_ci_yml_path, class: 'btn gl-button btn-info js-empty-state-button'
- else
.nothing-here-block= s_('Jobs|No jobs to show')
- else
......
......@@ -7,9 +7,6 @@
.nav-controls
- if can?(current_user, :update_build, @project)
- if !@repository.gitlab_ci_yml && !experiment_enabled?(:jobs_empty_state)
= link_to s_('Pipelines|Get started with Pipelines'), help_page_path('ci/quick_start/README'), class: 'btn gl-button btn-info js-empty-state-button'
= link_to project_ci_lint_path(@project), class: 'btn gl-button btn-default' do
%span
= _('CI Lint')
......
---
title: Add empty jobs page with link to editor
merge_request: 53240
author:
type: added
---
name: jobs_empty_state_experiment_percentage
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/48686
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/281054
milestone: '13.7'
type: experiment
group: group::activation
default_enabled: false
......@@ -66,9 +66,6 @@ module Gitlab
tracking_category: 'Growth::Conversion::Experiment::GroupOnlyTrials',
use_backwards_compatible_subject_index: true
},
jobs_empty_state: {
tracking_category: 'Growth::Activation::Experiment::JobsEmptyState'
},
remove_known_trial_form_fields: {
tracking_category: 'Growth::Conversion::Experiment::RemoveKnownTrialFormFields'
},
......
......@@ -21514,9 +21514,6 @@ msgstr ""
msgid "Pipelines|Get started with CI/CD"
msgstr ""
msgid "Pipelines|Get started with Pipelines"
msgstr ""
msgid "Pipelines|GitLab CI/CD can automatically build, test, and deploy your code. Let GitLab take care of time consuming tasks, so you can spend more time creating."
msgstr ""
......
......@@ -15,54 +15,6 @@ RSpec.describe Projects::JobsController, :clean_gitlab_redis_shared_state do
end
describe 'GET index' do
describe 'pushing tracking_data to Gon' do
before do
stub_experiment(jobs_empty_state: experiment_active)
stub_experiment_for_subject(jobs_empty_state: in_experiment_group)
get_index
end
context 'when experiment not active' do
let(:experiment_active) { false }
let(:in_experiment_group) { false }
it 'does not push tracking_data to Gon' do
expect(Gon.tracking_data).to be_nil
end
end
context 'when experiment active and user in control group' do
let(:experiment_active) { true }
let(:in_experiment_group) { false }
it 'pushes tracking_data to Gon' do
expect(Gon.tracking_data).to match(
{
category: 'Growth::Activation::Experiment::JobsEmptyState',
action: 'click_button',
label: anything,
property: 'control_group'
}
)
end
end
context 'when experiment active and user in experimental group' do
let(:experiment_active) { true }
let(:in_experiment_group) { true }
it 'pushes tracking_data to gon' do
expect(Gon.tracking_data).to match(
category: 'Growth::Activation::Experiment::JobsEmptyState',
action: 'click_button',
label: anything,
property: 'experimental_group'
)
end
end
end
context 'when scope is pending' do
before do
create(:ci_build, :pending, pipeline: pipeline)
......
......@@ -27,40 +27,12 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
describe "GET /:project/jobs" do
context 'with no jobs' do
before do
stub_experiment(jobs_empty_state: experiment_active)
stub_experiment_for_subject(jobs_empty_state: in_experiment_group)
visit project_jobs_path(project)
end
context 'when experiment not active' do
let(:experiment_active) { false }
let(:in_experiment_group) { false }
it 'shows the empty state control page' do
expect(page).to have_content('No jobs to show')
expect(page).to have_link('Get started with Pipelines')
end
end
context 'when experiment active and user in control group' do
let(:experiment_active) { true }
let(:in_experiment_group) { false }
it 'shows the empty state control page' do
expect(page).to have_content('No jobs to show')
expect(page).to have_link('Get started with Pipelines')
end
end
context 'when experiment active and user in experimental group' do
let(:experiment_active) { true }
let(:in_experiment_group) { true }
it 'shows the empty state experiment page' do
it 'shows the empty state page' do
expect(page).to have_content('Use jobs to automate your tasks')
expect(page).to have_link('Create CI/CD configuration file')
end
expect(page).to have_link('Create CI/CD configuration file', href: project.present(current_user: user).add_ci_yml_path)
end
end
......@@ -102,7 +74,7 @@ RSpec.describe 'Jobs', :clean_gitlab_redis_shared_state do
it "shows Finished tab jobs" do
expect(page).to have_selector('.nav-links li.active', text: 'Finished')
expect(page).to have_content 'No jobs to show'
expect(page).to have_content('Use jobs to automate your tasks')
end
end
......
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