diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-02-18 09:45:46 +0000 |
commit | a7b3560714b4d9cc4ab32dffcd1f74a284b93580 (patch) | |
tree | 7452bd5c3545c2fa67a28aa013835fb4fa071baf /spec/features/projects/ci/editor_spec.rb | |
parent | ee9173579ae56a3dbfe5afe9f9410c65bb327ca7 (diff) | |
download | gitlab-ce-a7b3560714b4d9cc4ab32dffcd1f74a284b93580.tar.gz |
Add latest changes from gitlab-org/gitlab@14-8-stable-eev14.8.0-rc42
Diffstat (limited to 'spec/features/projects/ci/editor_spec.rb')
-rw-r--r-- | spec/features/projects/ci/editor_spec.rb | 61 |
1 files changed, 59 insertions, 2 deletions
diff --git a/spec/features/projects/ci/editor_spec.rb b/spec/features/projects/ci/editor_spec.rb index 16cfa9f5f84..daf5ac61d73 100644 --- a/spec/features/projects/ci/editor_spec.rb +++ b/spec/features/projects/ci/editor_spec.rb @@ -26,7 +26,7 @@ RSpec.describe 'Pipeline Editor', :js do expect(page).to have_content('Pipeline Editor') end - context 'branch switcher' do + describe 'Branch switcher' do def switch_to_branch(branch) find('[data-testid="branch-selector"]').click @@ -64,7 +64,64 @@ RSpec.describe 'Pipeline Editor', :js do end end - context 'Editor content' do + describe 'Editor navigation' do + context 'when no change is made' do + it 'user can navigate away without a browser alert' do + expect(page).to have_content('Pipeline Editor') + + click_link 'Pipelines' + + expect(page).not_to have_content('Pipeline Editor') + end + end + + context 'when a change is made' do + before do + click_button 'Collapse' + + page.within('#source-editor-') do + find('textarea').send_keys '123' + # It takes some time after sending keys for the vue + # component to update + sleep 1 + end + end + + it 'user who tries to navigate away can cancel the action and keep their changes' do + click_link 'Pipelines' + + page.driver.browser.switch_to.alert.dismiss + + expect(page).to have_content('Pipeline Editor') + + page.within('#source-editor-') do + expect(page).to have_content('Default Content123') + end + end + + it 'user who tries to navigate away can confirm the action and discard their change' do + click_link 'Pipelines' + + page.driver.browser.switch_to.alert.accept + + expect(page).not_to have_content('Pipeline Editor') + end + + it 'user who creates a MR is taken to the merge request page without warnings' do + expect(page).not_to have_content('New merge request') + + find_field('Target Branch').set 'new_branch' + find_field('Start a new merge request with these changes').click + + click_button 'Commit changes' + + expect(page).not_to have_content('Pipeline Editor') + expect(page).to have_content('New merge request') + end + end + end + + describe 'Editor content' do it 'user can reset their CI configuration' do click_button 'Collapse' |