diff options
Diffstat (limited to 'spec/features/projects/ci/editor_spec.rb')
-rw-r--r-- | spec/features/projects/ci/editor_spec.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index 7fe1c63f490..16cfa9f5f84 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -51,5 +51,65 @@ RSpec.describe 'Pipeline Editor', :js do expect(page).not_to have_content(default_branch) end end + + it 'displays new branch as selected after commiting on a new branch' do + find('#target-branch-field').set('new_branch', clear: :backspace) + + click_button 'Commit changes' + + page.within('[data-testid="branch-selector"]') do + expect(page).to have_content('new_branch') + expect(page).not_to have_content(default_branch) + end + end + end + + context 'Editor content' do + it 'user can reset their CI configuration' do + click_button 'Collapse' + + page.within('#source-editor-') do + find('textarea').send_keys '123' + end + + # It takes some time after sending keys for the reset + # btn to register the changes inside the editor + sleep 1 + click_button 'Reset' + + expect(page).to have_css('#reset-content') + + page.within('#reset-content') do + click_button 'Reset file' + end + + page.within('#source-editor-') do + expect(page).to have_content('Default Content') + expect(page).not_to have_content('Default Content123') + end + end + + it 'user can cancel reseting their CI configuration' do + click_button 'Collapse' + + page.within('#source-editor-') do + find('textarea').send_keys '123' + end + + # It takes some time after sending keys for the reset + # btn to register the changes inside the editor + sleep 1 + click_button 'Reset' + + expect(page).to have_css('#reset-content') + + page.within('#reset-content') do + click_button 'Cancel' + end + + page.within('#source-editor-') do + expect(page).to have_content('Default Content123') + end + end end end |