Welcome to mirror list, hosted at ThFree Co, Russian Federation.

validatable.rb « page « qa « qa - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3c4d9ad68aa7c695ff29300050a42d6f211e8db3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# frozen_string_literal: true

module QA
  module Page
    module Validatable
      PageValidationError = Class.new(StandardError)

      def validate_elements_present!
        base_page = self.new

        elements.each do |element|
          next unless element.required?

          unless base_page.has_element?(element.name, wait: QA::Support::Repeater::DEFAULT_MAX_WAIT_TIME)
            raise Validatable::PageValidationError, "#{element.name} did not appear on #{self.name} as expected"
          end
        end
      end
    end
  end
end