blob: 7fe1c63f490b047a81f17831dc766e4e8974d846 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe 'Pipeline Editor', :js do
include Spec::Support::Helpers::Features::SourceEditorSpecHelpers
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
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
|