summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2019-04-24 22:39:44 +0800
committerLin Jen-Shin <godfat@godfat.org>2019-05-07 01:07:23 +0800
commit52b9797af21ea717518041afca804edd3e4aaa0c (patch)
tree9224da526b5fe531fde028c5fefc9dcf503e7480
parent65a7a20ae9b70cdb25835b64466106c796825876 (diff)
downloadgitlab-ce-58882-reduce-test-view-port.tar.gz
Avoid quick action prompt blocking preview button58882-reduce-test-view-port
-rw-r--r--spec/support/helpers/features/notes_helpers.rb12
-rw-r--r--spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb7
2 files changed, 14 insertions, 5 deletions
diff --git a/spec/support/helpers/features/notes_helpers.rb b/spec/support/helpers/features/notes_helpers.rb
index 89517fde6e2..38f30a14409 100644
--- a/spec/support/helpers/features/notes_helpers.rb
+++ b/spec/support/helpers/features/notes_helpers.rb
@@ -23,8 +23,18 @@ module Spec
def preview_note(text)
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')
+
+ yield if block_given?
end
end
end
diff --git a/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb b/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb
index e0d0b790a0e..a79a61bc708 100644
--- a/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb
+++ b/spec/support/shared_examples/quick_actions/issuable/close_quick_action_shared_examples.rb
@@ -1,6 +1,8 @@
# frozen_string_literal: true
shared_examples 'close quick action' do |issuable_type|
+ include Spec::Support::Helpers::Features::NotesHelpers
+
before do
project.add_maintainer(maintainer)
gitlab_sign_in(maintainer)
@@ -76,10 +78,7 @@ shared_examples 'close quick action' do |issuable_type|
it 'explains close quick action' do
visit public_send("project_#{issuable_type}_path", project, issuable)
- page.within('.js-main-target-form') do
- fill_in 'note[note]', with: "this is done, close\n/close"
- click_on 'Preview'
-
+ preview_note("this is done, close\n/close") do
expect(page).not_to have_content '/close'
expect(page).to have_content 'this is done, close'
expect(page).to have_content "Closes this #{issuable_type.to_s.humanize.downcase}."