Commit 940b986e authored by Tiffany Rea's avatar Tiffany Rea Committed by Anastasia McDonald

Complete adding new E2E test

Add new qa selector job_group_dropdown.vue
Edit qa selector name job_item.vue
Add new qa selector stage_column_component.vue
Add new pipeline wait method
Add new interactions with job group
Add expectations to test
parent 16bd2926
...@@ -59,7 +59,11 @@ export default { ...@@ -59,7 +59,11 @@ export default {
</script> </script>
<template> <template>
<!-- eslint-disable @gitlab/vue-no-data-toggle --> <!-- eslint-disable @gitlab/vue-no-data-toggle -->
<div :id="computedJobId" class="ci-job-dropdown-container dropdown dropright"> <div
:id="computedJobId"
class="ci-job-dropdown-container dropdown dropright"
data-qa-selector="job_dropdown_container"
>
<button <button
type="button" type="button"
data-toggle="dropdown" data-toggle="dropdown"
...@@ -79,7 +83,10 @@ export default { ...@@ -79,7 +83,10 @@ export default {
</div> </div>
</button> </button>
<ul class="dropdown-menu big-pipeline-graph-dropdown-menu js-grouped-pipeline-dropdown"> <ul
class="dropdown-menu big-pipeline-graph-dropdown-menu js-grouped-pipeline-dropdown"
data-qa-selector="jobs_dropdown_menu"
>
<li class="scrollable-menu"> <li class="scrollable-menu">
<ul> <ul>
<li v-for="job in group.jobs" :key="job.id"> <li v-for="job in group.jobs" :key="job.id">
......
...@@ -260,7 +260,7 @@ export default { ...@@ -260,7 +260,7 @@ export default {
:link="status.action.path" :link="status.action.path"
:action-icon="status.action.icon" :action-icon="status.action.icon"
class="gl-mr-1" class="gl-mr-1"
data-qa-selector="action_button" data-qa-selector="job_action_button"
@pipelineActionRequestComplete="pipelineActionRequestComplete" @pipelineActionRequestComplete="pipelineActionRequestComplete"
/> />
<action-component <action-component
......
...@@ -33,6 +33,10 @@ module QA ...@@ -33,6 +33,10 @@ module QA
wait_for_latest_pipeline_status { has_selector?(".ci-status-icon-success") || has_selector?(".ci-status-icon-failed") } wait_for_latest_pipeline_status { has_selector?(".ci-status-icon-success") || has_selector?(".ci-status-icon-failed") }
end end
def wait_for_latest_pipeline_skipped
wait_for_latest_pipeline_status { has_text?('skipped') }
end
def wait_for_latest_pipeline_status def wait_for_latest_pipeline_status
wait_until(max_duration: 90, reload: true, sleep_interval: 5) { has_pipeline? } wait_until(max_duration: 90, reload: true, sleep_interval: 5) { has_pipeline? }
......
...@@ -18,7 +18,7 @@ module QA ...@@ -18,7 +18,7 @@ module QA
view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do view 'app/assets/javascripts/pipelines/components/graph/job_item.vue' do
element :job_item_container element :job_item_container
element :job_link element :job_link
element :action_button element :job_action_button
end end
view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do view 'app/assets/javascripts/pipelines/components/graph/linked_pipeline.vue' do
...@@ -38,6 +38,11 @@ module QA ...@@ -38,6 +38,11 @@ module QA
element :pipeline_badges element :pipeline_badges
end end
view 'app/assets/javascripts/pipelines/components/graph/job_group_dropdown.vue' do
element :job_dropdown_container
element :jobs_dropdown_menu
end
def running?(wait: 0) def running?(wait: 0)
within_element(:pipeline_header) do within_element(:pipeline_header) do
page.has_content?('running', wait: wait) page.has_content?('running', wait: wait)
...@@ -47,7 +52,7 @@ module QA ...@@ -47,7 +52,7 @@ module QA
def has_build?(name, status: :success, wait: nil) def has_build?(name, status: :success, wait: nil)
if status if status
within_element(:job_item_container, text: name) do within_element(:job_item_container, text: name) do
has_selector?(".ci-status-icon-#{status}", { wait: wait }.compact) has_selector?(".ci-status-icon-#{status}", **{ wait: wait }.compact)
end end
else else
has_element?(:job_item_container, text: name) has_element?(:job_item_container, text: name)
...@@ -110,8 +115,22 @@ module QA ...@@ -110,8 +115,22 @@ module QA
end end
def click_job_action(job_name) def click_job_action(job_name)
wait_for_requests
within_element(:job_item_container, text: job_name) do within_element(:job_item_container, text: job_name) do
click_element(:action_button) click_element(:job_action_button)
end
end
def click_job_dropdown(job_dropdown_name)
click_element(:job_dropdown_container, text: job_dropdown_name)
end
def has_skipped_job_in_group?
within_element(:jobs_dropdown_menu) do
all_elements(:job_item_container, minimum: 1).all? do
has_selector?('.ci-status-icon-skipped')
end
end end
end end
end end
......
# frozen_string_literal: true
module QA
RSpec.describe 'Verify', :runner do
describe 'Run pipeline with manual jobs' do
let(:project) do
Resource::Project.fabricate_via_api! do |project|
project.name = 'pipeline-with-manual-job'
project.description = 'Project for pipeline with manual job'
end
end
let!(:runner) do
Resource::Runner.fabricate! do |runner|
runner.project = project
runner.name = "qa-runner-#{SecureRandom.hex(3)}"
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
stages:
- Stage1
- Stage2
- Stage3
Prep:
stage: Stage1
script: exit 0
when: manual
Build:
stage: Stage2
needs: ['Prep']
script: exit 0
parallel: 6
Test:
stage: Stage3
needs: ['Build']
script: exit 0
Deploy:
stage: Stage3
needs: ['Test']
script: exit 0
parallel: 6
YAML
}
]
)
end
end
before do
Flow::Login.sign_in
project.visit!
Flow::Pipeline.visit_latest_pipeline(pipeline_condition: 'skipped')
end
after do
[runner, project].each(&:remove_via_api!)
end
it 'does not leave any job in skipped state', testcase: 'https://gitlab.com/gitlab-org/gitlab/-/quality/test_cases/349158' do
Page::Project::Pipeline::Show.perform do |show|
show.click_job_action('Prep') # Trigger pipeline manually
show.wait_until(max_duration: 120, sleep_interval: 2, reload: false) do
project.pipelines.last[:status] == 'success'
end
aggregate_failures do
expect(show).to have_build('Test', status: :success)
show.click_job_dropdown('Build')
expect(show).not_to have_skipped_job_in_group
show.click_job_dropdown('Build') # Close Build dropdown
show.click_job_dropdown('Deploy')
expect(show).not_to have_skipped_job_in_group
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