Sha256: 5b5874e736fcc6279fe88703223de7e470bc8d228f3023e4cb087190951fe058

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

require 'generic_test/version'
require 'generic_test/page'
require 'generic_test/checker'
require 'spellcheck'
require 'watir'
require 'webdrivers'

module GenericTest
  class Error < StandardError; end
  @pages = []
  # @return [Boolean] Whether to only use Javascript. RestClient won't run in same context as
  # browser so less likely to be accurate for logged in pages
  @only_javascript = false

  class << self
    attr_accessor :browser
    attr_accessor :pages
    attr_accessor :only_javascript

    def setup
      ENV['HEADLESS'] ||= 'true'
      ENV['PAGE_NUM'] ||= '1'
      browser_args = %w[--disable-popup-blocking --no-sandbox --disable-dev-shm-usage]
      browser_args << '--headless' if ENV['HEADLESS'] == 'true'

      GenericTest.browser = Watir::Browser.new :chrome, args: browser_args

      raise 'PAGE_URL environment variable not set' unless ENV['PAGE_URL']

      browser = GenericTest.browser
      browser.goto ENV['PAGE_URL']
      GenericTest.pages << GenericTest::Page.new(browser)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
generic_test-0.1.10 lib/generic_test.rb
generic_test-0.1.9 lib/generic_test.rb
generic_test-0.1.8 lib/generic_test.rb
generic_test-0.1.7 lib/generic_test.rb