Commit 6306e797 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'rc-qa-mattermost-login' into 'master'

Add login mattermost to Test::Integration::Mattermost

See merge request gitlab-org/gitlab-ce!15033
parents f9a85b0c ce3b81b9
......@@ -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
##
......
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
module QA
module Page
module Mattermost
class Main < Page::Base
def initialize
visit(Runtime::Scenario.mattermost)
end
end
end
end
end
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
......
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
describe QA::Scenario::Entrypoint do
subject do
Class.new(QA::Scenario::Entrypoint) do
tags :rspec
end
end
context '#perform' do
let(:config) { spy('Specs::Config') }
let(:release) { spy('Runtime::Release') }
let(:runner) { spy('Specs::Runner') }
before do
allow(config).to receive(:perform) { |&block| block.call config }
allow(runner).to receive(:perform) { |&block| block.call runner }
stub_const('QA::Specs::Config', config)
stub_const('QA::Runtime::Release', release)
stub_const('QA::Specs::Runner', runner)
end
it 'should set address' do
subject.perform("hello")
expect(config).to have_received(:address=).with("hello")
end
context 'no paths' do
it 'should call runner with default arguments' do
subject.perform("test")
expect(runner).to have_received(:rspec)
.with(hash_including(files: 'qa/specs/features'))
end
end
context 'specifying paths' do
it 'should call runner with paths' do
subject.perform('test', 'path1', 'path2')
expect(runner).to have_received(:rspec)
.with(hash_including(files: %w(path1 path2)))
end
end
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment