Add tests for mattermost login via oauth
* Adds Runtime::Scenario as a place to record the properties of the Scenario we're interested in. * Adds a positional argument to Test::Integration::Mattermost to specify Runtime::Scenario.mattermost * Adds Page::Mattermost::{Main,Login} to model the mattermost pages we need to interact with. * Adds qa/features/mattermost/login_spec to perform a login via oauth and ensure we are logged in.
This commit is contained in:
parent
4598c00a8f
commit
ce3b81b953
6 changed files with 61 additions and 0 deletions
6
qa/qa.rb
6
qa/qa.rb
|
@ -8,6 +8,7 @@ module QA
|
|||
autoload :Release, 'qa/runtime/release'
|
||||
autoload :User, 'qa/runtime/user'
|
||||
autoload :Namespace, 'qa/runtime/namespace'
|
||||
autoload :Scenario, 'qa/runtime/scenario'
|
||||
end
|
||||
|
||||
##
|
||||
|
@ -80,6 +81,11 @@ module QA
|
|||
module Admin
|
||||
autoload :Menu, 'qa/page/admin/menu'
|
||||
end
|
||||
|
||||
module Mattermost
|
||||
autoload :Main, 'qa/page/mattermost/main'
|
||||
autoload :Login, 'qa/page/mattermost/login'
|
||||
end
|
||||
end
|
||||
|
||||
##
|
||||
|
|
19
qa/qa/page/mattermost/login.rb
Normal file
19
qa/qa/page/mattermost/login.rb
Normal file
|
@ -0,0 +1,19 @@
|
|||
module QA
|
||||
module Page
|
||||
module Mattermost
|
||||
class Login < Page::Base
|
||||
def initialize
|
||||
visit(Runtime::Scenario.mattermost + '/login')
|
||||
end
|
||||
|
||||
def sign_in_using_oauth
|
||||
click_link class: 'btn btn-custom-login gitlab'
|
||||
|
||||
if page.has_content?('Authorize GitLab Mattermost to use your account?')
|
||||
click_button 'Authorize'
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
11
qa/qa/page/mattermost/main.rb
Normal file
11
qa/qa/page/mattermost/main.rb
Normal file
|
@ -0,0 +1,11 @@
|
|||
module QA
|
||||
module Page
|
||||
module Mattermost
|
||||
class Main < Page::Base
|
||||
def initialize
|
||||
visit(Runtime::Scenario.mattermost)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
8
qa/qa/runtime/scenario.rb
Normal file
8
qa/qa/runtime/scenario.rb
Normal file
|
@ -0,0 +1,8 @@
|
|||
module QA
|
||||
module Runtime
|
||||
module Scenario
|
||||
extend self
|
||||
attr_accessor :mattermost
|
||||
end
|
||||
end
|
||||
end
|
|
@ -8,6 +8,11 @@ module QA
|
|||
#
|
||||
class Mattermost < Scenario::Entrypoint
|
||||
tags :core, :mattermost
|
||||
|
||||
def perform(address, mattermost, *files)
|
||||
Runtime::Scenario.mattermost = mattermost
|
||||
super(address, files)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
12
qa/qa/specs/features/mattermost/login_spec.rb
Normal file
12
qa/qa/specs/features/mattermost/login_spec.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
module QA
|
||||
feature 'logging in to Mattermost', :mattermost do
|
||||
scenario 'can use gitlab oauth' do
|
||||
Page::Main::Entry.act { sign_in_using_credentials }
|
||||
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
|
Loading…
Reference in a new issue