Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'spec/features/projects/pipeline_schedules_spec.rb')
-rw-r--r--spec/features/projects/pipeline_schedules_spec.rb484
1 files changed, 200 insertions, 284 deletions
diff --git a/spec/features/projects/pipeline_schedules_spec.rb b/spec/features/projects/pipeline_schedules_spec.rb
index 358c55376d4..322d25ed052 100644
--- a/spec/features/projects/pipeline_schedules_spec.rb
+++ b/spec/features/projects/pipeline_schedules_spec.rb
@@ -12,389 +12,301 @@ RSpec.describe 'Pipeline Schedules', :js, feature_category: :groups_and_projects
let!(:user) { create(:user) }
let!(:maintainer) { create(:user) }
- context 'with pipeline_schedules_vue feature flag turned off' do
+ context 'logged in as the pipeline schedule owner' do
before do
- stub_feature_flags(pipeline_schedules_vue: false)
+ project.add_developer(user)
+ pipeline_schedule.update!(owner: user)
+ gitlab_sign_in(user)
end
- context 'logged in as the pipeline schedule owner' do
+ describe 'GET /projects/pipeline_schedules' do
before do
- project.add_developer(user)
- pipeline_schedule.update!(owner: user)
- gitlab_sign_in(user)
+ visit_pipelines_schedules
end
- describe 'GET /projects/pipeline_schedules' do
- before do
- visit_pipelines_schedules
- end
-
- it 'edits the pipeline' do
- page.within('.pipeline-schedule-table-row') do
- click_link 'Edit'
- end
+ it 'edits the pipeline' do
+ page.find('[data-testid="edit-pipeline-schedule-btn"]').click
- expect(page).to have_content('Edit Pipeline Schedule')
- end
+ expect(page).to have_content(s_('PipelineSchedules|Edit pipeline schedule'))
end
+ end
- describe 'PATCH /projects/pipelines_schedules/:id/edit' do
- before do
- edit_pipeline_schedule
- end
-
- it 'displays existing properties' do
- description = find_field('schedule_description').value
- expect(description).to eq('pipeline schedule')
- expect(page).to have_button('master')
- expect(page).to have_button('Select timezone')
- end
+ describe 'PATCH /projects/pipelines_schedules/:id/edit' do
+ before do
+ edit_pipeline_schedule
+ end
- it 'edits the scheduled pipeline' do
- fill_in 'schedule_description', with: 'my brand new description'
+ it 'displays existing properties' do
+ description = find_field('schedule-description').value
+ expect(description).to eq('pipeline schedule')
+ expect(page).to have_button('master')
+ expect(page).to have_button(_('Select timezone'))
+ end
- save_pipeline_schedule
+ it 'edits the scheduled pipeline' do
+ fill_in 'schedule-description', with: 'my brand new description'
- expect(page).to have_content('my brand new description')
- end
+ save_pipeline_schedule
- context 'when ref is nil' do
- before do
- pipeline_schedule.update_attribute(:ref, nil)
- edit_pipeline_schedule
- end
+ expect(page).to have_content('my brand new description')
+ end
- it 'shows the pipeline schedule with default ref' do
- page.within('[data-testid="schedule-target-ref"]') do
- expect(first('.gl-button-text').text).to eq('master')
- end
- end
+ context 'when ref is nil' do
+ before do
+ pipeline_schedule.update_attribute(:ref, nil)
+ edit_pipeline_schedule
end
- context 'when ref is empty' do
- before do
- pipeline_schedule.update_attribute(:ref, '')
- edit_pipeline_schedule
- end
-
- it 'shows the pipeline schedule with default ref' do
- page.within('[data-testid="schedule-target-ref"]') do
- expect(first('.gl-button-text').text).to eq('master')
- end
+ it 'shows the pipeline schedule with default ref' do
+ page.within('#schedule-target-branch-tag') do
+ expect(first('.gl-button-text').text).to eq('master')
end
end
end
- end
-
- context 'logged in as a project maintainer' do
- before do
- project.add_maintainer(user)
- gitlab_sign_in(user)
- end
- describe 'GET /projects/pipeline_schedules' do
+ context 'when ref is empty' do
before do
- visit_pipelines_schedules
+ pipeline_schedule.update_attribute(:ref, '')
+ edit_pipeline_schedule
end
- describe 'The view' do
- it 'displays the required information description' do
- page.within('.pipeline-schedule-table-row') do
- expect(page).to have_content('pipeline schedule')
- expect(find("[data-testid='next-run-cell'] time")['title'])
- .to include(pipeline_schedule.real_next_run.strftime('%b %-d, %Y'))
- expect(page).to have_link('master')
- expect(page).to have_link("##{pipeline.id}")
- end
- end
-
- it 'creates a new scheduled pipeline' do
- click_link 'New schedule'
-
- expect(page).to have_content('Schedule a new pipeline')
- end
-
- it 'changes ownership of the pipeline' do
- click_button 'Take ownership'
-
- page.within('#pipeline-take-ownership-modal') do
- click_link 'Take ownership'
- end
-
- page.within('.pipeline-schedule-table-row') do
- expect(page).not_to have_content('No owner')
- expect(page).to have_link('Sidney Jones')
- end
- end
-
- it 'deletes the pipeline' do
- click_link 'Delete'
-
- accept_gl_confirm(button_text: 'Delete pipeline schedule')
-
- expect(page).not_to have_css(".pipeline-schedule-table-row")
+ it 'shows the pipeline schedule with default ref' do
+ page.within('#schedule-target-branch-tag') do
+ expect(first('.gl-button-text').text).to eq('master')
end
end
+ end
+ end
+ end
- context 'when ref is nil' do
- before do
- pipeline_schedule.update_attribute(:ref, nil)
- visit_pipelines_schedules
- end
-
- it 'shows a list of the pipeline schedules with empty ref column' do
- expect(first('.branch-name-cell').text).to eq('')
- end
- end
+ context 'logged in as a project maintainer' do
+ before do
+ project.add_maintainer(user)
+ pipeline_schedule.update!(owner: maintainer)
+ gitlab_sign_in(user)
+ end
- context 'when ref is empty' do
- before do
- pipeline_schedule.update_attribute(:ref, '')
- visit_pipelines_schedules
- end
+ describe 'GET /projects/pipeline_schedules' do
+ before do
+ visit_pipelines_schedules
- it 'shows a list of the pipeline schedules with empty ref column' do
- expect(first('.branch-name-cell').text).to eq('')
- end
- end
+ wait_for_requests
end
- describe 'POST /projects/pipeline_schedules/new' do
- before do
- visit_new_pipeline_schedule
- end
-
- it 'sets defaults for timezone and target branch' do
- expect(page).to have_button('master')
- expect(page).to have_button('Select timezone')
+ describe 'The view' do
+ it 'displays the required information description' do
+ page.within('[data-testid="pipeline-schedule-table-row"]') do
+ expect(page).to have_content('pipeline schedule')
+ expect(find('[data-testid="next-run-cell"] time')['title'])
+ .to include(pipeline_schedule.real_next_run.strftime('%b %-d, %Y'))
+ expect(page).to have_link('master')
+ expect(find("[data-testid='last-pipeline-status'] a")['href']).to include(pipeline.id.to_s)
+ end
end
it 'creates a new scheduled pipeline' do
- fill_in_schedule_form
- save_pipeline_schedule
+ click_link 'New schedule'
- expect(page).to have_content('my fancy description')
+ expect(page).to have_content('Schedule a new pipeline')
end
- it 'prevents an invalid form from being submitted' do
- save_pipeline_schedule
+ it 'changes ownership of the pipeline' do
+ find("[data-testid='take-ownership-pipeline-schedule-btn']").click
- expect(page).to have_content('This field is required')
- end
- end
+ page.within('#pipeline-take-ownership-modal') do
+ click_button s_('PipelineSchedules|Take ownership')
- context 'when user creates a new pipeline schedule with variables' do
- before do
- visit_pipelines_schedules
- click_link 'New schedule'
- fill_in_schedule_form
- all('[name="schedule[variables_attributes][][key]"]')[0].set('AAA')
- all('[name="schedule[variables_attributes][][secret_value]"]')[0].set('AAA123')
- all('[name="schedule[variables_attributes][][key]"]')[1].set('BBB')
- all('[name="schedule[variables_attributes][][secret_value]"]')[1].set('BBB123')
- save_pipeline_schedule
- end
+ wait_for_requests
+ end
- it 'user sees the new variable in edit window', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/397040' do
- find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
- page.within('.ci-variable-list') do
- expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-key").value).to eq('AAA')
- expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-value", visible: false).value).to eq('AAA123')
- expect(find(".ci-variable-row:nth-child(2) .js-ci-variable-input-key").value).to eq('BBB')
- expect(find(".ci-variable-row:nth-child(2) .js-ci-variable-input-value", visible: false).value).to eq('BBB123')
+ page.within('[data-testid="pipeline-schedule-table-row"]') do
+ expect(page).not_to have_content('No owner')
+ expect(page).to have_link('Sidney Jones')
end
end
- end
- context 'when user edits a variable of a pipeline schedule' do
- before do
- create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
- create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule)
+ it 'deletes the pipeline' do
+ page.within('[data-testid="pipeline-schedule-table-row"]') do
+ click_button s_('PipelineSchedules|Delete pipeline schedule')
end
- visit_pipelines_schedules
- find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
- find('.js-ci-variable-list-section .js-secret-value-reveal-button').click
- first('.js-ci-variable-input-key').set('foo')
- first('.js-ci-variable-input-value').set('bar')
- click_button 'Save pipeline schedule'
- end
+ accept_gl_confirm(button_text: s_('PipelineSchedules|Delete pipeline schedule'))
- it 'user sees the updated variable in edit window' do
- find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
- page.within('.ci-variable-list') do
- expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-key").value).to eq('foo')
- expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-value", visible: false).value).to eq('bar')
- end
+ expect(page).not_to have_css('[data-testid="pipeline-schedule-table-row"]')
end
end
- context 'when user removes a variable of a pipeline schedule' do
+ context 'when ref is nil' do
before do
- create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
- create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule)
- end
-
+ pipeline_schedule.update_attribute(:ref, nil)
visit_pipelines_schedules
- find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
- find('.ci-variable-list .ci-variable-row-remove-button').click
- click_button 'Save pipeline schedule'
+ wait_for_requests
end
- it 'user does not see the removed variable in edit window' do
- find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
- page.within('.ci-variable-list') do
- expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-key").value).to eq('')
- expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-value", visible: false).value).to eq('')
+ it 'shows a list of the pipeline schedules with empty ref column' do
+ target = find('[data-testid="pipeline-schedule-target"]')
+
+ page.within('[data-testid="pipeline-schedule-table-row"]') do
+ expect(target.text).to eq(s_('PipelineSchedules|None'))
end
end
end
- context 'when active is true and next_run_at is NULL' do
+ context 'when ref is empty' do
before do
- create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
- pipeline_schedule.update_attribute(:next_run_at, nil) # Consequently next_run_at will be nil
- end
+ pipeline_schedule.update_attribute(:ref, '')
+ visit_pipelines_schedules
+ wait_for_requests
end
- it 'user edit and recover the problematic pipeline schedule' do
- visit_pipelines_schedules
- find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
- fill_in 'schedule_cron', with: '* 1 2 3 4'
- click_button 'Save pipeline schedule'
+ it 'shows a list of the pipeline schedules with empty ref column' do
+ target = find('[data-testid="pipeline-schedule-target"]')
- page.within('.pipeline-schedule-table-row:nth-child(1)') do
- expect(page).to have_css("[data-testid='next-run-cell'] time")
- end
+ expect(target.text).to eq(s_('PipelineSchedules|None'))
end
end
end
- context 'logged in as non-member' do
+ describe 'POST /projects/pipeline_schedules/new' do
before do
- gitlab_sign_in(user)
+ visit_new_pipeline_schedule
end
- describe 'GET /projects/pipeline_schedules' do
- before do
- visit_pipelines_schedules
- end
+ it 'sets defaults for timezone and target branch' do
+ expect(page).to have_button('master')
+ expect(page).to have_button('Select timezone')
+ end
- describe 'The view' do
- it 'does not show create schedule button' do
- expect(page).not_to have_link('New schedule')
- end
- end
+ it 'creates a new scheduled pipeline' do
+ fill_in_schedule_form
+ create_pipeline_schedule
+
+ expect(page).to have_content('my fancy description')
end
- end
- context 'not logged in' do
- describe 'GET /projects/pipeline_schedules' do
- before do
- visit_pipelines_schedules
- end
+ it 'prevents an invalid form from being submitted' do
+ create_pipeline_schedule
- describe 'The view' do
- it 'does not show create schedule button' do
- expect(page).not_to have_link('New schedule')
- end
- end
+ expect(page).to have_content("Cron timezone can't be blank")
end
end
- end
- context 'with pipeline_schedules_vue feature flag turned on' do
- context 'logged in as a project maintainer' do
+ context 'when user creates a new pipeline schedule with variables' do
before do
- project.add_maintainer(maintainer)
- pipeline_schedule.update!(owner: user)
- gitlab_sign_in(maintainer)
+ visit_pipelines_schedules
+ click_link 'New schedule'
+ fill_in_schedule_form
+ all('[name="schedule[variables_attributes][][key]"]')[0].set('AAA')
+ all('[name="schedule[variables_attributes][][secret_value]"]')[0].set('AAA123')
+ all('[name="schedule[variables_attributes][][key]"]')[1].set('BBB')
+ all('[name="schedule[variables_attributes][][secret_value]"]')[1].set('BBB123')
+ create_pipeline_schedule
end
- describe 'GET /projects/pipeline_schedules' do
- before do
- visit_pipelines_schedules
-
- wait_for_requests
+ it 'user sees the new variable in edit window', quarantine: 'https://gitlab.com/gitlab-org/gitlab/-/issues/397040' do
+ find(".content-list .pipeline-schedule-table-row:nth-child(1) .btn-group a[title='Edit']").click
+ page.within('.ci-variable-list') do
+ expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-key").value).to eq('AAA')
+ expect(find(".ci-variable-row:nth-child(1) .js-ci-variable-input-value", visible: false).value).to eq('AAA123')
+ expect(find(".ci-variable-row:nth-child(2) .js-ci-variable-input-key").value).to eq('BBB')
+ expect(find(".ci-variable-row:nth-child(2) .js-ci-variable-input-value", visible: false).value).to eq('BBB123')
end
+ end
+ end
- describe 'The view' do
- it 'displays the required information description' do
- page.within('[data-testid="pipeline-schedule-table-row"]') do
- expect(page).to have_content('pipeline schedule')
- expect(find("[data-testid='next-run-cell'] time")['title'])
- .to include(pipeline_schedule.real_next_run.strftime('%b %-d, %Y'))
- expect(page).to have_link('master')
- expect(find("[data-testid='last-pipeline-status'] a")['href']).to include(pipeline.id.to_s)
- end
- end
-
- it 'changes ownership of the pipeline' do
- click_button 'Take ownership'
+ context 'when user edits a variable of a pipeline schedule' do
+ before do
+ create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
+ create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule)
+ end
- page.within('#pipeline-take-ownership-modal') do
- click_button 'Take ownership'
+ visit_pipelines_schedules
+ first('[data-testid="edit-pipeline-schedule-btn"]').click
+ click_button _('Reveal values')
+ first('[data-testid="pipeline-form-ci-variable-key"]').set('foo')
+ first('[data-testid="pipeline-form-ci-variable-value"]').set('bar')
+ save_pipeline_schedule
+ end
- wait_for_requests
- end
+ it 'user sees the updated variable' do
+ first('[data-testid="edit-pipeline-schedule-btn"]').click
- page.within('[data-testid="pipeline-schedule-table-row"]') do
- expect(page).not_to have_content('No owner')
- expect(page).to have_link('Sidney Jones')
- end
- end
+ expect(first('[data-testid="pipeline-form-ci-variable-key"]').value).to eq('foo')
+ expect(first('[data-testid="pipeline-form-ci-variable-value"]').value).to eq('')
- it 'runs the pipeline' do
- click_button 'Run pipeline schedule'
+ click_button _('Reveal values')
- wait_for_requests
+ expect(first('[data-testid="pipeline-form-ci-variable-value"]').value).to eq('bar')
+ end
+ end
- expect(page).to have_content("Successfully scheduled a pipeline to run. Go to the Pipelines page for details.")
- end
+ context 'when user removes a variable of a pipeline schedule' do
+ before do
+ create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
+ create(:ci_pipeline_schedule_variable, key: 'AAA', value: 'AAA123', pipeline_schedule: pipeline_schedule)
+ end
- it 'deletes the pipeline' do
- click_button 'Delete pipeline schedule'
+ visit_pipelines_schedules
+ first('[data-testid="edit-pipeline-schedule-btn"]').click
+ find('[data-testid="remove-ci-variable-row"]').click
+ save_pipeline_schedule
+ end
- accept_gl_confirm(button_text: 'Delete pipeline schedule')
+ it 'user does not see the removed variable in edit window' do
+ first('[data-testid="edit-pipeline-schedule-btn"]').click
- expect(page).not_to have_css('[data-testid="pipeline-schedule-table-row"]')
- end
- end
+ expect(first('[data-testid="pipeline-form-ci-variable-key"]').value).to eq('')
+ expect(first('[data-testid="pipeline-form-ci-variable-value"]').value).to eq('')
end
end
- context 'logged in as non-member' do
+ context 'when active is true and next_run_at is NULL' do
before do
- gitlab_sign_in(user)
+ create(:ci_pipeline_schedule, project: project, owner: user).tap do |pipeline_schedule|
+ pipeline_schedule.update_attribute(:next_run_at, nil) # Consequently next_run_at will be nil
+ end
end
- describe 'GET /projects/pipeline_schedules' do
- before do
- visit_pipelines_schedules
+ it 'user edit and recover the problematic pipeline schedule' do
+ visit_pipelines_schedules
+ first('[data-testid="edit-pipeline-schedule-btn"]').click
+ fill_in 'schedule_cron', with: '* 1 2 3 4'
+ save_pipeline_schedule
- wait_for_requests
- end
-
- describe 'The view' do
- it 'does not show create schedule button' do
- expect(page).not_to have_link('New schedule')
- end
+ page.within(first('[data-testid="pipeline-schedule-table-row"]')) do
+ expect(page).to have_css("[data-testid='next-run-cell'] time")
end
end
end
+ end
- context 'not logged in' do
- describe 'GET /projects/pipeline_schedules' do
- before do
- visit_pipelines_schedules
+ context 'logged in as non-member' do
+ before do
+ gitlab_sign_in(user)
+ end
- wait_for_requests
+ describe 'GET /projects/pipeline_schedules' do
+ before do
+ visit_pipelines_schedules
+ end
+
+ describe 'The view' do
+ it 'does not show create schedule button' do
+ expect(page).not_to have_link('New schedule')
end
+ end
+ end
+ end
- describe 'The view' do
- it 'does not show create schedule button' do
- expect(page).not_to have_link('New schedule')
- end
+ context 'not logged in' do
+ describe 'GET /projects/pipeline_schedules' do
+ before do
+ visit_pipelines_schedules
+ end
+
+ describe 'The view' do
+ it 'does not show create schedule button' do
+ expect(page).not_to have_link('New schedule')
end
end
end
@@ -413,7 +325,7 @@ RSpec.describe 'Pipeline Schedules', :js, feature_category: :groups_and_projects
end
def select_timezone
- find('[data-testid="schedule-timezone"] .gl-new-dropdown-toggle').click
+ find('#schedule-timezone .gl-new-dropdown-toggle').click
find("li", text: "Arizona").click
end
@@ -421,12 +333,16 @@ RSpec.describe 'Pipeline Schedules', :js, feature_category: :groups_and_projects
click_button 'master'
end
+ def create_pipeline_schedule
+ click_button s_('PipelineSchedules|Create pipeline schedule')
+ end
+
def save_pipeline_schedule
- click_button 'Save pipeline schedule'
+ click_button s_('PipelineSchedules|Edit pipeline schedule')
end
def fill_in_schedule_form
- fill_in 'schedule_description', with: 'my fancy description'
+ fill_in 'schedule-description', with: 'my fancy description'
fill_in 'schedule_cron', with: '* 1 2 3 4'
select_timezone