diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-30 21:09:08 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-30 21:09:08 +0300 |
commit | 861cc0c363283c359becb153d0f6e88393cd3e79 (patch) | |
tree | b338ffd187d52d5ffdf7ae6ab08ccce0e45236a4 /spec/features/projects/ci/editor_spec.rb | |
parent | 0daaf2c2ba5a0537094a53e7f84386616dbcbff0 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/projects/ci/editor_spec.rb')
-rw-r--r-- | spec/features/projects/ci/editor_spec.rb | 40 |
1 files changed, 39 insertions, 1 deletions
diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index c0cc12eac66..192bccd6f6e 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -5,17 +5,55 @@ require 'spec_helper' RSpec.describe 'Pipeline Editor', :js do include Spec::Support::Helpers::Features::SourceEditorSpecHelpers - let(:project) { create(:project, :repository) } + let(:project) { create(:project_empty_repo, :public) } let(:user) { create(:user) } + let(:default_branch) { 'main' } + let(:other_branch) { 'test' } + before do sign_in(user) project.add_developer(user) + project.repository.create_file(user, project.ci_config_path_or_default, 'Default Content', message: 'Create CI file for main', branch_name: default_branch) + project.repository.create_file(user, project.ci_config_path_or_default, 'Other Content', message: 'Create CI file for test', branch_name: other_branch) + visit project_ci_pipeline_editor_path(project) + wait_for_requests end it 'user sees the Pipeline Editor page' do expect(page).to have_content('Pipeline Editor') end + + context 'branch switcher' do + before do + stub_feature_flags(pipeline_editor_branch_switcher: true) + end + + def switch_to_branch(branch) + find('[data-testid="branch-selector"]').click + + page.within '[data-testid="branch-selector"]' do + click_button branch + wait_for_requests + end + end + + it 'displays current branch' do + page.within('[data-testid="branch-selector"]') do + expect(page).to have_content(default_branch) + expect(page).not_to have_content(other_branch) + end + end + + it 'displays updated current branch after switching branches' do + switch_to_branch(other_branch) + + page.within('[data-testid="branch-selector"]') do + expect(page).to have_content(other_branch) + expect(page).not_to have_content(default_branch) + end + end + end end |