summaryrefslogtreecommitdiff
path: root/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb')
-rw-r--r--spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb54
1 files changed, 33 insertions, 21 deletions
diff --git a/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb b/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
index ca6f03472dd..cd796d45aba 100644
--- a/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
+++ b/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
@@ -5,11 +5,13 @@ require 'spec_helper'
RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
include Spec::Support::Helpers::Features::EditorLiteSpecHelpers
+ let_it_be(:namespace) { create(:namespace) }
+ let(:project) { create(:project, :repository, namespace: namespace) }
+
before do
- project = create(:project, :repository)
sign_in project.owner
- stub_experiment(ci_syntax_templates: experiment_active)
- stub_experiment_for_subject(ci_syntax_templates: in_experiment_group)
+ stub_experiment(ci_syntax_templates_b: experiment_active)
+ stub_experiment_for_subject(ci_syntax_templates_b: in_experiment_group)
visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml')
end
@@ -23,35 +25,45 @@ RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
end
end
- context 'when experiment is active and the user is in the control group' do
+ context 'when experiment is active' do
let(:experiment_active) { true }
- let(:in_experiment_group) { false }
- it 'does not show the "Learn CI/CD syntax" template dropdown' do
- expect(page).not_to have_css('.gitlab-ci-syntax-yml-selector')
+ context 'when the user is in the control group' do
+ let(:in_experiment_group) { false }
+
+ it 'does not show the "Learn CI/CD syntax" template dropdown' do
+ expect(page).not_to have_css('.gitlab-ci-syntax-yml-selector')
+ end
end
- end
- context 'when experiment is active and the user is in the experimental group' do
- let(:experiment_active) { true }
- let(:in_experiment_group) { true }
+ context 'when the user is in the experimental group' do
+ let(:in_experiment_group) { true }
+
+ it 'allows the user to pick a "Learn CI/CD syntax" template from the dropdown', :js do
+ expect(page).to have_css('.gitlab-ci-syntax-yml-selector')
- it 'allows the user to pick a "Learn CI/CD syntax" template from the dropdown', :js do
- expect(page).to have_css('.gitlab-ci-syntax-yml-selector')
+ find('.js-gitlab-ci-syntax-yml-selector').click
- find('.js-gitlab-ci-syntax-yml-selector').click
+ wait_for_requests
- wait_for_requests
+ within '.gitlab-ci-syntax-yml-selector' do
+ find('.dropdown-input-field').set('Artifacts example')
+ find('.dropdown-content .is-focused', text: 'Artifacts example').click
+ end
- within '.gitlab-ci-syntax-yml-selector' do
- find('.dropdown-input-field').set('Artifacts example')
- find('.dropdown-content .is-focused', text: 'Artifacts example').click
+ wait_for_requests
+
+ expect(page).to have_css('.gitlab-ci-syntax-yml-selector .dropdown-toggle-text', text: 'Learn CI/CD syntax')
+ expect(editor_get_value).to have_content('You can use artifacts to pass data to jobs in later stages.')
end
- wait_for_requests
+ context 'when the group is created longer than 90 days ago' do
+ let(:namespace) { create(:namespace, created_at: 91.days.ago) }
- expect(page).to have_css('.gitlab-ci-syntax-yml-selector .dropdown-toggle-text', text: 'Learn CI/CD syntax')
- expect(editor_get_value).to have_content('You can use artifacts to pass data to jobs in later stages.')
+ it 'does not show the "Learn CI/CD syntax" template dropdown' do
+ expect(page).not_to have_css('.gitlab-ci-syntax-yml-selector')
+ end
+ end
end
end
end