Skip to content

Migrate pipeline editor QA spec to feature specs

Frédéric Caplette requested to merge fc-pipeline-editor-spec-migration into master

What does this MR do and why?

In the effort of shifting left to improve test coverages and test pipeline run time https://gitlab.com/gitlab-com/gitlab-OKRs/-/work_items/2542 , merging pipeline_editor_can_create_merge_request_spec.rb and update_ci_file_with_pipeline_editor_spec.rb is part of this work.

This MR focuses on pipeline_editor_can_create_merge_request_spec.rb, we have coverage for Pipeline Editor in empty state and the merge request workflow.

Page::Project::PipelineEditor::New.perform(&:create_new_ci)

Page::Project::PipelineEditor::Show.perform do |show|
  # Editor should display default content when project does not have CI file yet
  # New MR checkbox should not be rendered when a new target branch is yet to be provided
  aggregate_failures 'check editor default conditions' do
    expect(show.editing_content).not_to be_empty
    expect(show).to have_no_new_mr_checkbox
  end

  # The new MR checkbox is visible after a new branch name is set
  show.set_source_branch(SecureRandom.hex(10))
  expect(show).to have_new_mr_checkbox

  ...
end

We move these checks down to feature test level. I.e. in editor_spec.rb:

  • Add context 'when there is not CI config file'
  • Verify empty state content is rendered
    • Verify create new CI button is present
  • Verify when click on create new CI button
    • #source-editor is rendered
    • #source-editor has default content
  • Under Commit Form
    • Add example for when setting a new source branch, new MR checkbox is displayed
    • New MR checkbox is not present when source branch is main

Screenshots or screen recordings

Green pipeline = all is well!

How to set up and validate locally

none!

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Frédéric Caplette

Merge request reports

Loading