Commit 52b9797a authored by Lin Jen-Shin's avatar Lin Jen-Shin

Avoid quick action prompt blocking preview button

parent 65a7a20a
...@@ -23,8 +23,18 @@ module Spec ...@@ -23,8 +23,18 @@ module Spec
def preview_note(text) def preview_note(text)
page.within('.js-main-target-form') do page.within('.js-main-target-form') do
fill_in('note[note]', with: text) filled_text = fill_in('note[note]', with: text)
begin
# Dismiss quick action prompt if it appears
filled_text.parent.send_keys(:escape)
rescue Selenium::WebDriver::Error::ElementNotInteractableError
# It's fine if we can't escape when there's no prompt.
end
click_on('Preview') click_on('Preview')
yield if block_given?
end end
end end
end end
......
# frozen_string_literal: true # frozen_string_literal: true
shared_examples 'close quick action' do |issuable_type| shared_examples 'close quick action' do |issuable_type|
include Spec::Support::Helpers::Features::NotesHelpers
before do before do
project.add_maintainer(maintainer) project.add_maintainer(maintainer)
gitlab_sign_in(maintainer) gitlab_sign_in(maintainer)
...@@ -76,10 +78,7 @@ shared_examples 'close quick action' do |issuable_type| ...@@ -76,10 +78,7 @@ shared_examples 'close quick action' do |issuable_type|
it 'explains close quick action' do it 'explains close quick action' do
visit public_send("project_#{issuable_type}_path", project, issuable) visit public_send("project_#{issuable_type}_path", project, issuable)
page.within('.js-main-target-form') do preview_note("this is done, close\n/close") do
fill_in 'note[note]', with: "this is done, close\n/close"
click_on 'Preview'
expect(page).not_to have_content '/close' expect(page).not_to have_content '/close'
expect(page).to have_content 'this is done, close' expect(page).to have_content 'this is done, close'
expect(page).to have_content "Closes this #{issuable_type.to_s.humanize.downcase}." expect(page).to have_content "Closes this #{issuable_type.to_s.humanize.downcase}."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment