Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-14 03:06:25 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-14 03:06:25 +0300
commita93dfc1b7e55b118b1cf4a67afeb46556292914c (patch)
tree65b874b7940d0d05c4ebedaef43b8a1009362651 /spec/support
parent188a57f93bba5953800de490fcc6246966a073fd (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/support')
-rw-r--r--spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb111
1 files changed, 111 insertions, 0 deletions
diff --git a/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb b/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb
new file mode 100644
index 00000000000..cb5460bde23
--- /dev/null
+++ b/spec/support/shared_examples/quick_actions/issue/zoom_quick_actions_shared_examples.rb
@@ -0,0 +1,111 @@
+# frozen_string_literal: true
+
+shared_examples 'zoom quick actions' do
+ let(:zoom_link) { 'https://zoom.us/j/123456789' }
+ let(:invalid_zoom_link) { 'https://invalid-zoom' }
+
+ before do
+ issue.update!(description: description)
+ end
+
+ describe '/zoom' do
+ shared_examples 'skip silently' do
+ it 'skip addition silently' do
+ add_note("/zoom #{zoom_link}")
+
+ wait_for_requests
+
+ expect(page).not_to have_content('Zoom meeting added')
+ expect(page).not_to have_content('Failed to add a Zoom meeting')
+ expect(issue.reload.description).to eq(description)
+ end
+ end
+
+ shared_examples 'success' do
+ it 'adds a Zoom link' do
+ add_note("/zoom #{zoom_link}")
+
+ wait_for_requests
+
+ expect(page).to have_content('Zoom meeting added')
+ expect(issue.reload.description).to end_with(zoom_link)
+ end
+ end
+
+ context 'without issue description' do
+ let(:description) { nil }
+
+ include_examples 'success'
+
+ it 'cannot add invalid zoom link' do
+ add_note("/zoom #{invalid_zoom_link}")
+
+ wait_for_requests
+
+ expect(page).to have_content('Failed to add a Zoom meeting')
+ expect(page).not_to have_content(zoom_link)
+ end
+
+ context 'when feature flag disabled' do
+ before do
+ stub_feature_flags(issue_zoom_integration: false)
+ end
+
+ include_examples 'skip silently'
+ end
+ end
+
+ context 'with Zoom link not at the end of the issue description' do
+ let(:description) { "A link #{zoom_link} not at the end" }
+
+ include_examples 'success'
+ end
+
+ context 'with Zoom link at end of the issue description' do
+ let(:description) { "Text\n#{zoom_link}" }
+
+ include_examples 'skip silently'
+ end
+ end
+
+ describe '/remove_zoom' do
+ shared_examples 'skip silently' do
+ it 'skip removal silently' do
+ add_note('/remove_zoom')
+
+ wait_for_requests
+
+ expect(page).not_to have_content('Zoom meeting removed')
+ expect(page).not_to have_content('Failed to remove a Zoom meeting')
+ expect(issue.reload.description).to eq(description)
+ end
+ end
+
+ context 'with Zoom link in the description' do
+ let(:description) { "Text with #{zoom_link}\n\n\n#{zoom_link}" }
+
+ it 'removes last Zoom link' do
+ add_note('/remove_zoom')
+
+ wait_for_requests
+
+ expect(page).to have_content('Zoom meeting removed')
+ expect(issue.reload.description).to eq("Text with #{zoom_link}")
+ end
+
+ context 'when feature flag disabled' do
+ before do
+ stub_feature_flags(issue_zoom_integration: false)
+ end
+
+ include_examples 'skip silently'
+ end
+ end
+
+ context 'with a Zoom link not at the end of the description' do
+ let(:description) { "A link #{zoom_link} not at the end" }
+
+ include_examples 'skip silently'
+ end
+ end
+end