BigW Consortium Gitlab

Commit e0edf6c7 by Grzegorz Bizon

Improve QA sanity selectors test output message

parent 170c07ef
......@@ -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
......
......@@ -19,6 +19,10 @@ module QA
def matches?(line)
!!(line =~ expression)
end
def to_s
@name
end
end
end
end
......@@ -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
......
......@@ -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!)
......
......@@ -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
......
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