diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-09 14:34:47 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2018-01-09 14:34:47 +0300 |
commit | e0edf6c7afbf103378c2e589212617df1510c55e (patch) | |
tree | 5e833762b33f54fc630e0560ac462474a8743034 /qa | |
parent | 170c07ef677d45edf93411f6c5a396b93e0def3f (diff) |
Improve QA sanity selectors test output message
Diffstat (limited to 'qa')
-rw-r--r-- | qa/qa/page/base.rb | 2 | ||||
-rw-r--r-- | qa/qa/page/element.rb | 4 | ||||
-rw-r--r-- | qa/qa/page/validator.rb | 7 | ||||
-rw-r--r-- | qa/qa/scenario/test/sanity/selectors.rb | 28 | ||||
-rw-r--r-- | qa/spec/page/base_spec.rb | 2 |
5 files changed, 40 insertions, 3 deletions
diff --git a/qa/qa/page/base.rb b/qa/qa/page/base.rb index 05e300820fa..c60e9bfd40a 100644 --- a/qa/qa/page/base.rb +++ b/qa/qa/page/base.rb @@ -50,7 +50,7 @@ module QA def self.errors if views.empty? - return ["#{name} class does not have views / elements defined!"] + return ["Page class does not have views / elements defined!"] end views.map(&:errors).flatten diff --git a/qa/qa/page/element.rb b/qa/qa/page/element.rb index 23e1b10fe33..791f92d002d 100644 --- a/qa/qa/page/element.rb +++ b/qa/qa/page/element.rb @@ -19,6 +19,10 @@ module QA def matches?(line) !!(line =~ expression) end + + def to_s + @name + end end end end diff --git a/qa/qa/page/validator.rb b/qa/qa/page/validator.rb index 953a137ec34..e178fd9a1e9 100644 --- a/qa/qa/page/validator.rb +++ b/qa/qa/page/validator.rb @@ -2,7 +2,12 @@ module QA module Page class Validator ValidationError = Class.new(StandardError) - Error = Struct.new(:page, :message) + + Error = Struct.new(:page, :message) do + def to_s + "Error: #{page} - #{message}" + end + end def initialize(constant) @module = constant diff --git a/qa/qa/scenario/test/sanity/selectors.rb b/qa/qa/scenario/test/sanity/selectors.rb index 62dd47bc0ad..cb73b98da73 100644 --- a/qa/qa/scenario/test/sanity/selectors.rb +++ b/qa/qa/scenario/test/sanity/selectors.rb @@ -13,6 +13,34 @@ module QA end validators.map(&:errors).flatten.tap do |errors| + break if errors.none? + + STDERR.puts <<~EOS + GitLab QA sanity selectors validation test detected problems + your merge request! + + The purpose of this tes is to make sure that GitLab QA tests, + that are entirely black-box and click-driven scenario, do match + pages structure / layout in the GitLab CE / EE repositories. + + It looks like you have changed views / pages / selectors, and + these are now out of sync with what we have defined in `qa/` + directory. + + Please update code in `qa/` directory to match currect changes + in this merge request. + + For more help see documentation in `qa/page/README.md` file or + ask for help on #qa channel on Slack (GitLab Team only). + + If you are not a team member, and you still need help to + contribute, please open an issue in GitLab QA issue tracker. + + Please see errors described below. + + EOS + + STDERR.puts errors end validators.each(&:validate!) diff --git a/qa/spec/page/base_spec.rb b/qa/spec/page/base_spec.rb index 29b62cf758c..287adf35c46 100644 --- a/qa/spec/page/base_spec.rb +++ b/qa/spec/page/base_spec.rb @@ -56,7 +56,7 @@ describe QA::Page::Base do it 'appends an error about missing views / elements block' do expect(described_class.errors) - .to include 'QA::Page::Base class does not have views / elements defined!' + .to include 'Page class does not have views / elements defined!' end end end |