# frozen_string_literal: true

module QA
  context 'Manage', :orchestrated, :mattermost do
    describe 'Mattermost login' do
      it 'user logs into Mattermost using GitLab OAuth' do
        Runtime::Browser.visit(:gitlab, Page::Main::Login)
        Page::Main::Login.perform(&:sign_in_using_credentials)

        Runtime::Browser.visit(:mattermost, Page::Mattermost::Login)
        Page::Mattermost::Login.perform(&:sign_in_using_oauth)

        Page::Mattermost::Main.perform do |page|
          expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/)
        end
      end
    end
  end
end

# frozen_string_literal: true

module QA
  context 'Manage', :orchestrated, :mattermost do
    describe 'Mattermost login' do
      it 'user logs into Mattermost using GitLab OAuth' do
        Runtime::Browser.visit(:gitlab, Page::Main::Login) do
          Page::Main::Login.act { sign_in_using_credentials }

          Runtime::Browser.visit(:mattermost, Page::Mattermost::Login) do
            Page::Mattermost::Login.act { sign_in_using_oauth }

            Page::Mattermost::Main.perform do |page|
              expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/)
            end
          end
        end
      end
    end
  end
end

--- 
+++ 
@@ -4,16 +4,14 @@
   context 'Manage', :orchestrated, :mattermost do
     describe 'Mattermost login' do
       it 'user logs into Mattermost using GitLab OAuth' do
-        Runtime::Browser.visit(:gitlab, Page::Main::Login) do
-          Page::Main::Login.act { sign_in_using_credentials }
+        Runtime::Browser.visit(:gitlab, Page::Main::Login)
+        Page::Main::Login.perform(&:sign_in_using_credentials)
 
-          Runtime::Browser.visit(:mattermost, Page::Mattermost::Login) do
-            Page::Mattermost::Login.act { sign_in_using_oauth }
+        Runtime::Browser.visit(:mattermost, Page::Mattermost::Login)
+        Page::Mattermost::Login.perform(&:sign_in_using_oauth)
 
-            Page::Mattermost::Main.perform do |page|
-              expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/)
-            end
-          end
+        Page::Mattermost::Main.perform do |page|
+          expect(page).to have_content(/(Welcome to: Mattermost|Logout GitLab Mattermost)/)
         end
       end
     end
Remove blocks from Runtime::Browser.visit calls within Mattermost tests

Use .perform instead of .act in Mattermost test

Signed-off-by: ddavison <2d8af30be2746a8359c9d49236dee9d2380c4fc1@gitlab.com>
