diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 09:09:09 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-12-03 09:09:09 +0000 |
commit | c384315ae1ea48df2a741874b326581ded0a97e1 (patch) | |
tree | 6f50dfdb7fb726ef3e738dc5264526cf683906a3 /qa/qa/specs/features/browser_ui/1_manage | |
parent | e1e017ddc4d64e4777bbe663c555093a7ae0cca3 (diff) | |
download | gitlab-ce-c384315ae1ea48df2a741874b326581ded0a97e1.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'qa/qa/specs/features/browser_ui/1_manage')
-rw-r--r-- | qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb b/qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb new file mode 100644 index 00000000000..d3bb269bcb3 --- /dev/null +++ b/qa/qa/specs/features/browser_ui/1_manage/mail/trigger_mail_notification_spec.rb @@ -0,0 +1,43 @@ +# frozen_string_literal: true + +module QA + context 'Manage', :orchestrated, :smtp do + describe 'mail notification' do + let(:user) do + Resource::User.fabricate_or_use(Runtime::Env.gitlab_qa_username_1, Runtime::Env.gitlab_qa_password_1) + end + + let(:project) do + Resource::Project.fabricate_via_api! do |resource| + resource.name = 'email-notification-test' + end + end + + before do + Flow::Login.sign_in + end + + it 'user receives email for project invitation' do + Flow::Project.add_member(project: project, username: user.username) + + expect(page).to have_content(/@#{user.username}(\n| )?Given access/) + + # Wait for Action Mailer to deliver messages + mailhog_json = Support::Retrier.retry_until(sleep_interval: 1) do + Runtime::Logger.debug(%Q[retrieving "#{QA::Runtime::MailHog.api_messages_url}"]) if Runtime::Env.debug? + + mailhog_response = get QA::Runtime::MailHog.api_messages_url + + mailhog_data = JSON.parse(mailhog_response.body) + + # Expect at least two invitation messages: group and project + mailhog_data if mailhog_data.dig('total') >= 2 + end + + # Check json result from mailhog + mailhog_items = mailhog_json.dig('items') + expect(mailhog_items).to include(an_object_satisfying { |o| /project was granted/ === o.dig('Content', 'Headers', 'Subject', 0) }) + end + end + end +end |