Add Test::Integration::Mattermost

Here we add a new entrypoint for the test suite,
Test::Integration::Mattermost.  It is to ensure that mattermost
integration is working when enabling the embedded mattermost of
gitlab-omnibus

It runs all the example groups from Test::Instance, in addition to any
groups tagged :mattermost

* Extracts a common entrypoint class from Test::Instance as
  Scenario::Entrypoint, and uses that as the base for Test::Instance and
  Test::Integration::Mattermost

* RSpec groups defined in `specs/features/mattermost/**_spec.rb` are
  tagged with :mattermost so they can be filtered out of the default
  run.

* Tests tagged :mattermost are filtered out by default, and are
  un-filtered by Test::Integration::Mattermost
This commit is contained in:
Richard Clamp 2017-10-11 15:19:24 +01:00
parent 5a2acfe036
commit 60e8347c7f
6 changed files with 78 additions and 15 deletions

View file

@ -18,6 +18,7 @@ module QA
# Support files
#
autoload :Actable, 'qa/scenario/actable'
autoload :Entrypoint, 'qa/scenario/entrypoint'
autoload :Template, 'qa/scenario/template'
##
@ -25,6 +26,10 @@ module QA
#
module Test
autoload :Instance, 'qa/scenario/test/instance'
module Integration
autoload :Mattermost, 'qa/scenario/test/integration/mattermost'
end
end
##

View file

@ -0,0 +1,29 @@
module QA
module Scenario
##
# Run test suite against any Gitlab instance,
# including staging and on-premises installation.
#
class Entrypoint < Template
def perform(address, *files)
Specs::Config.perform do |specs|
specs.address = address
configure_specs(specs)
end
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs|
specs.rspec('--tty', files.any? ? files : 'qa/specs/features')
end
end
protected
def configure_specs(specs) end
end
end
end

View file

@ -5,21 +5,7 @@ module QA
# Run test suite against any GitLab instance,
# including staging and on-premises installation.
#
class Instance < Scenario::Template
def perform(address, *files)
Specs::Config.perform do |specs|
specs.address = address
end
##
# Perform before hooks, which are different for CE and EE
#
Runtime::Release.perform_before_hooks
Specs::Runner.perform do |specs|
specs.rspec('--tty', files.any? ? files : 'qa/specs/features')
end
end
class Instance < Entrypoint
end
end
end

View file

@ -0,0 +1,19 @@
module QA
module Scenario
module Test
module Integration
##
# Run test suite against any GitLab instance where mattermost is enabled,
# including staging and on-premises installation.
#
class Mattermost < Scenario::Entrypoint
protected
def configure_specs(specs)
specs.exclusion_filter[:mattermost] = false
end
end
end
end
end
end

View file

@ -10,9 +10,11 @@ module QA
module Specs
class Config < Scenario::Template
attr_writer :address
attr_accessor :exclusion_filter
def initialize
@address = ENV['GITLAB_URL']
@exclusion_filter = { mattermost: true }
end
def perform
@ -32,6 +34,12 @@ module QA
mocks.verify_partial_doubles = true
end
config.exclusion_filter = @exclusion_filter
config.define_derived_metadata(file_path: %r{/specs/features/mattermost/}) do |metadata|
metadata[:mattermost] = true
end
config.order = :random
Kernel.srand config.seed
config.formatter = :documentation

View file

@ -0,0 +1,16 @@
module QA
feature 'create a new group' do
scenario 'creating a group with a mattermost team' do
Page::Main::Entry.act { sign_in_using_credentials }
Page::Main::Menu.act { go_to_groups }
Page::Dashboard::Groups.perform do |page|
page.go_to_new_group
expect(page).to have_content(
/Create a Mattermost team for this group/
)
end
end
end
end