summaryrefslogtreecommitdiff
path: root/qa
diff options
context:
space:
mode:
authorDan Davison <ddavison@gitlab.com>2019-06-17 22:45:38 +0000
committerDan Davison <ddavison@gitlab.com>2019-06-17 22:45:38 +0000
commit8a153abd2dba2f91908e9805a74cd3e276f28e08 (patch)
tree360bb828f560ddb467e2b41f589d0f3c307d549b /qa
parent7c27155c453f4cc4382424bbd1d84813a2c86b10 (diff)
parent7886f44d632f8004024f869aadd20fcc6f225f54 (diff)
downloadgitlab-ce-8a153abd2dba2f91908e9805a74cd3e276f28e08.tar.gz
Merge branch 'qa-ml-validate-after-visit-in-block' into 'master'
[CE] Validate page after visit in block See merge request gitlab-org/gitlab-ce!29524
Diffstat (limited to 'qa')
-rw-r--r--qa/qa/page/dashboard/projects.rb8
-rw-r--r--qa/qa/runtime/address.rb2
-rw-r--r--qa/qa/runtime/browser.rb19
3 files changed, 19 insertions, 10 deletions
diff --git a/qa/qa/page/dashboard/projects.rb b/qa/qa/page/dashboard/projects.rb
index 7ab8ee39f72..0c23d7cffbb 100644
--- a/qa/qa/page/dashboard/projects.rb
+++ b/qa/qa/page/dashboard/projects.rb
@@ -5,7 +5,7 @@ module QA
module Dashboard
class Projects < Page::Base
view 'app/views/shared/projects/_search_form.html.haml' do
- element :form_filter_by_name, /form_tag.+id: 'project-filter-form'/ # rubocop:disable QA/ElementWithPattern
+ element :project_filter_form, required: true
end
def go_to_project(name)
@@ -14,10 +14,14 @@ module QA
find_link(text: name).click
end
+ def self.path
+ '/'
+ end
+
private
def filter_by_name(name)
- page.within('form#project-filter-form') do
+ within_element(:project_filter_form) do
fill_in :name, with: name
end
end
diff --git a/qa/qa/runtime/address.rb b/qa/qa/runtime/address.rb
index 98d042fb43a..c622051bb6d 100644
--- a/qa/qa/runtime/address.rb
+++ b/qa/qa/runtime/address.rb
@@ -5,7 +5,7 @@ module QA
class Address
attr_reader :address
- def initialize(instance, page = nil)
+ def initialize(instance, page)
@instance = instance
@address = host + (page.is_a?(String) ? page : page&.path)
end
diff --git a/qa/qa/runtime/browser.rb b/qa/qa/runtime/browser.rb
index 3bf4b3bbbfb..ed0779b93cc 100644
--- a/qa/qa/runtime/browser.rb
+++ b/qa/qa/runtime/browser.rb
@@ -1,6 +1,7 @@
# frozen_string_literal: true
require 'rspec/core'
+require 'rspec/expectations'
require 'capybara/rspec'
require 'capybara-screenshot/rspec'
require 'selenium-webdriver'
@@ -27,13 +28,12 @@ module QA
# In case of an address that is a symbol we will try to guess address
# based on `Runtime::Scenario#something_address`.
#
- def visit(address, page = nil, &block)
- Browser::Session.new(address, page).perform(&block)
+ def visit(address, page_class, &block)
+ Browser::Session.new(address, page_class).perform(&block)
end
- def self.visit(address, page = nil, &block)
- new.visit(address, page, &block)
- page.validate_elements_present!
+ def self.visit(address, page_class, &block)
+ new.visit(address, page_class, &block)
end
def self.configure!
@@ -128,8 +128,11 @@ module QA
class Session
include Capybara::DSL
- def initialize(instance, page = nil)
- @session_address = Runtime::Address.new(instance, page)
+ attr_reader :page_class
+
+ def initialize(instance, page_class)
+ @session_address = Runtime::Address.new(instance, page_class)
+ @page_class = page_class
end
def url
@@ -139,6 +142,8 @@ module QA
def perform(&block)
visit(url)
+ page_class.validate_elements_present!
+
if QA::Runtime::Env.qa_cookies
browser = Capybara.current_session.driver.browser
QA::Runtime::Env.qa_cookies.each do |cookie|