summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-09-05 18:12:16 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2022-09-05 18:12:16 +0000
commit28515f6389dbf6feda2e489a3c7253fc56177a33 (patch)
tree0a377a85dc8cae3a85817b6148a4e631d4a53dba /spec/features
parentd298c12de58b4d0a28358d38ed3f5762ed1550a0 (diff)
downloadgitlab-ce-28515f6389dbf6feda2e489a3c7253fc56177a33.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/populate_new_pipeline_vars_with_params_spec.rb42
-rw-r--r--spec/features/projects/pipelines/legacy_pipelines_spec.rb1
-rw-r--r--spec/features/projects/pipelines/pipelines_spec.rb61
3 files changed, 79 insertions, 25 deletions
diff --git a/spec/features/populate_new_pipeline_vars_with_params_spec.rb b/spec/features/populate_new_pipeline_vars_with_params_spec.rb
index 744543d1252..75fa8561235 100644
--- a/spec/features/populate_new_pipeline_vars_with_params_spec.rb
+++ b/spec/features/populate_new_pipeline_vars_with_params_spec.rb
@@ -7,24 +7,42 @@ RSpec.describe "Populate new pipeline CI variables with url params", :js do
let(:project) { create(:project) }
let(:page_path) { new_project_pipeline_path(project) }
- before do
- sign_in(user)
- project.add_maintainer(user)
+ shared_examples 'form pre-filled with URL params' do
+ before do
+ sign_in(user)
+ project.add_maintainer(user)
- visit "#{page_path}?var[key1]=value1&file_var[key2]=value2"
+ visit "#{page_path}?var[key1]=value1&file_var[key2]=value2"
+ end
+
+ it "var[key1]=value1 populates env_var variable correctly" do
+ page.within(all("[data-testid='ci-variable-row']")[0]) do
+ expect(find("[data-testid='pipeline-form-ci-variable-key']").value).to eq('key1')
+ expect(find("[data-testid='pipeline-form-ci-variable-value']").value).to eq('value1')
+ end
+ end
+
+ it "file_var[key2]=value2 populates file variable correctly" do
+ page.within(all("[data-testid='ci-variable-row']")[1]) do
+ expect(find("[data-testid='pipeline-form-ci-variable-key']").value).to eq('key2')
+ expect(find("[data-testid='pipeline-form-ci-variable-value']").value).to eq('value2')
+ end
+ end
end
- it "var[key1]=value1 populates env_var variable correctly" do
- page.within(all("[data-testid='ci-variable-row']")[0]) do
- expect(find("[data-testid='pipeline-form-ci-variable-key']").value).to eq('key1')
- expect(find("[data-testid='pipeline-form-ci-variable-value']").value).to eq('value1')
+ context 'when feature flag is disabled' do
+ before do
+ stub_feature_flags(run_pipeline_graphql: false)
end
+
+ it_behaves_like 'form pre-filled with URL params'
end
- it "file_var[key2]=value2 populates file variable correctly" do
- page.within(all("[data-testid='ci-variable-row']")[1]) do
- expect(find("[data-testid='pipeline-form-ci-variable-key']").value).to eq('key2')
- expect(find("[data-testid='pipeline-form-ci-variable-value']").value).to eq('value2')
+ context 'when feature flag is enabled' do
+ before do
+ stub_feature_flags(run_pipeline_graphql: true)
end
+
+ it_behaves_like 'form pre-filled with URL params'
end
end
diff --git a/spec/features/projects/pipelines/legacy_pipelines_spec.rb b/spec/features/projects/pipelines/legacy_pipelines_spec.rb
index c903fe60fdb..2b3a6569c56 100644
--- a/spec/features/projects/pipelines/legacy_pipelines_spec.rb
+++ b/spec/features/projects/pipelines/legacy_pipelines_spec.rb
@@ -674,6 +674,7 @@ RSpec.describe 'Pipelines', :js do
let(:project) { create(:project, :repository) }
before do
+ stub_feature_flags(run_pipeline_graphql: false)
visit new_project_pipeline_path(project)
end
diff --git a/spec/features/projects/pipelines/pipelines_spec.rb b/spec/features/projects/pipelines/pipelines_spec.rb
index d4f58813534..d5705d1da04 100644
--- a/spec/features/projects/pipelines/pipelines_spec.rb
+++ b/spec/features/projects/pipelines/pipelines_spec.rb
@@ -656,19 +656,7 @@ RSpec.describe 'Pipelines', :js do
describe 'POST /:project/-/pipelines' do
let(:project) { create(:project, :repository) }
- before do
- visit new_project_pipeline_path(project)
- end
-
- context 'for valid commit', :js do
- before do
- click_button project.default_branch
- wait_for_requests
-
- find('p', text: 'master').click
- wait_for_requests
- end
-
+ shared_examples 'run pipeline form with gitlab-ci.yml' do
context 'with gitlab-ci.yml', :js do
before do
stub_ci_pipeline_to_return_yaml_file
@@ -702,7 +690,9 @@ RSpec.describe 'Pipelines', :js do
end
end
end
+ end
+ shared_examples 'run pipeline form without gitlab-ci.yml' do
context 'without gitlab-ci.yml' do
before do
click_on 'Run pipeline'
@@ -722,6 +712,51 @@ RSpec.describe 'Pipelines', :js do
end
end
end
+
+ # Run Pipeline form with REST endpoints
+ # TODO: Clean up tests when run_pipeline_graphql is enabled
+ context 'with feature flag disabled' do
+ before do
+ stub_feature_flags(run_pipeline_graphql: false)
+ visit new_project_pipeline_path(project)
+ end
+
+ context 'for valid commit', :js do
+ before do
+ click_button project.default_branch
+ wait_for_requests
+
+ find('p', text: 'master').click
+ wait_for_requests
+ end
+
+ it_behaves_like 'run pipeline form with gitlab-ci.yml'
+
+ it_behaves_like 'run pipeline form without gitlab-ci.yml'
+ end
+ end
+
+ # Run Pipeline form with GraphQL
+ context 'with feature flag enabled' do
+ before do
+ stub_feature_flags(run_pipeline_graphql: true)
+ visit new_project_pipeline_path(project)
+ end
+
+ context 'for valid commit', :js do
+ before do
+ click_button project.default_branch
+ wait_for_requests
+
+ find('p', text: 'master').click
+ wait_for_requests
+ end
+
+ it_behaves_like 'run pipeline form with gitlab-ci.yml'
+
+ it_behaves_like 'run pipeline form without gitlab-ci.yml'
+ end
+ end
end
describe 'Reset runner caches' do