Commit 9013797c authored by Tiffany Rea's avatar Tiffany Rea Committed by Dan Davison

Apply review suggestions

Remove unused selector
Remove unused element check logic
Remove superfluous checkand unused tags
parent cb324fc8
......@@ -295,9 +295,13 @@ export default {
<div
class="gl-border-t-solid gl-border-gray-100 gl-border-t-1 gl-p-5 gl-bg-gray-10 gl-display-flex gl-justify-content-space-between"
>
<gl-button type="submit" category="primary" variant="success">{{
s__('Pipeline|Run Pipeline')
}}</gl-button>
<gl-button
type="submit"
category="primary"
variant="success"
data-qa-selector="run_pipeline_button"
>{{ s__('Pipeline|Run Pipeline') }}</gl-button
>
<gl-button :href="pipelinesPath">{{ __('Cancel') }}</gl-button>
</div>
</gl-form>
......
......@@ -47,6 +47,7 @@ export default {
category="primary"
class="js-run-pipeline"
data-testid="run-pipeline-button"
data-qa-selector="run_pipeline_button"
>
{{ s__('Pipelines|Run Pipeline') }}
</gl-button>
......
......@@ -260,6 +260,7 @@ module QA
module Pipeline
autoload :Index, 'qa/page/project/pipeline/index'
autoload :Show, 'qa/page/project/pipeline/show'
autoload :New, 'qa/page/project/pipeline/new'
end
module Tag
......
......@@ -14,6 +14,10 @@ module QA
element :pipeline_retry_button
end
view 'app/assets/javascripts/pipelines/components/pipelines_list/nav_controls.vue' do
element :run_pipeline_button
end
def click_on_latest_pipeline
all_elements(:pipeline_url_link, minimum: 1, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME).first.click
end
......@@ -40,6 +44,14 @@ module QA
wait_for_latest_pipeline_success
end
end
def has_pipeline?
has_element? :pipeline_url_link
end
def click_run_pipeline_button
click_element :run_pipeline_button, Page::Project::Pipeline::New
end
end
end
end
......
# frozen_string_literal: true
module QA
module Page
module Project
module Pipeline
class New < QA::Page::Base
view 'app/assets/javascripts/pipeline_new/components/pipeline_new_form.vue' do
element :run_pipeline_button, required: true
end
def click_run_pipeline_button
click_element :run_pipeline_button
end
end
end
end
end
end
# frozen_string_literal: true
module QA
RSpec.describe 'Verify' do
describe 'Run pipeline', :requires_admin, :skip_live_env do
# [TODO]: Developer to remove :requires_admin and :skip_live_env once FF is removed in https://gitlab.com/gitlab-org/gitlab/-/issues/229632
context 'with web only rule' do
let(:feature_flag) { 'new_pipeline_form' }
let(:job_name) { 'test_job' }
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'web-only-pipeline'
end
end
let!(:ci_file) do
Resource::Repository::Commit.fabricate_via_api! do |commit|
commit.project = project
commit.commit_message = 'Add .gitlab-ci.yml'
commit.add_files(
[
{
file_path: '.gitlab-ci.yml',
content: <<~YAML
#{job_name}:
tags:
- #{project.name}
script: echo 'OK'
only:
- web
YAML
}
]
)
end
end
before do
Runtime::Feature.enable_and_verify(feature_flag) # [TODO]: Developer to remove when feature flag is removed
Flow::Login.sign_in
project.visit!
Page::Project::Menu.perform(&:click_ci_cd_pipelines)
end
after do
Runtime::Feature.disable_and_verify(feature_flag) # [TODO]: Developer to remove when feature flag is removed
end
it 'can trigger pipeline', testcase: 'https://gitlab.com/gitlab-org/quality/testcases/-/issues/946' do
Page::Project::Pipeline::Index.perform do |index|
expect(index).not_to have_pipeline # should not auto trigger pipeline
index.click_run_pipeline_button
end
Page::Project::Pipeline::New.perform(&:click_run_pipeline_button)
Page::Project::Pipeline::Show.perform do |pipeline|
expect(pipeline).to have_job(job_name)
end
end
end
end
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