summaryrefslogtreecommitdiff
path: root/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
committerRobert Speicher <rspeicher@gmail.com>2021-01-20 13:34:23 -0600
commit6438df3a1e0fb944485cebf07976160184697d72 (patch)
tree00b09bfd170e77ae9391b1a2f5a93ef6839f2597 /spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
parent42bcd54d971da7ef2854b896a7b34f4ef8601067 (diff)
downloadgitlab-ce-6438df3a1e0fb944485cebf07976160184697d72.tar.gz
Add latest changes from gitlab-org/gitlab@13-8-stable-eev13.8.0-rc42
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.rb56
1 files changed, 56 insertions, 0 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
new file mode 100644
index 00000000000..6308acb41f5
--- /dev/null
+++ b/spec/features/projects/files/gitlab_ci_syntax_yml_dropdown_spec.rb
@@ -0,0 +1,56 @@
+# frozen_string_literal: true
+
+require 'spec_helper'
+
+RSpec.describe 'Projects > Files > User wants to add a .gitlab-ci.yml file' do
+ 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)
+
+ visit project_new_blob_path(project, 'master', file_name: '.gitlab-ci.yml')
+ end
+
+ context 'when experiment is not active' do
+ let(:experiment_active) { false }
+ 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
+
+ context 'when experiment is active and the user is in the control group' 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')
+ 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 }
+
+ it 'allows the user to pick a "Learn CI/CD syntax" template from the dropdown', :js,
+ { quarantine: { issue: 'https://gitlab.com/gitlab-org/gitlab/-/issues/297347' } } do
+ expect(page).to have_css('.gitlab-ci-syntax-yml-selector')
+
+ find('.js-gitlab-ci-syntax-yml-selector').click
+
+ 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
+
+ wait_for_requests
+
+ expect(page).to have_css('.gitlab-ci-syntax-yml-selector .dropdown-toggle-text', text: 'Learn CI/CD syntax')
+ expect(page).to have_content('You can use artifacts to pass data to jobs in later stages.')
+ end
+ end
+end