qat-web 6.0.3 → 6.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/qat/cli.rb +52 -0
- data/lib/qat/cli/plugins/web.rb +22 -3
- data/lib/qat/web/generator.rb +32 -0
- data/lib/qat/web/generator/project/config/common/browsers.yml +5 -0
- data/lib/qat/web/generator/project/config/common/qat/web/home.yml +4 -0
- data/lib/qat/web/generator/project/config/common/qat/web/page.yml +4 -0
- data/lib/qat/web/generator/project/config/common/screens.yml +10 -0
- data/lib/qat/web/generator/project/config/common/timeouts.yml +7 -0
- data/lib/qat/web/generator/project/features/step_definitions/steps.rb +7 -0
- data/lib/qat/web/generator/project/features/support/env_qat_web.rb +17 -0
- data/lib/qat/web/generator/project/features/web_example.feature +11 -0
- data/lib/qat/web/generator/project/lib/web.rb +2 -0
- data/lib/qat/web/generator/project/lib/web/page_manager.rb +11 -0
- data/lib/qat/web/generator/project/lib/web/pages.rb +3 -0
- data/lib/qat/web/generator/project/lib/web/pages/base.rb +27 -0
- data/lib/qat/web/generator/project/lib/web/pages/blank.rb +5 -0
- data/lib/qat/web/generator/project/lib/web/pages/home.rb +35 -0
- data/lib/qat/web/generator/project/lib/web/world.rb +23 -0
- data/lib/qat/web/version.rb +1 -1
- metadata +19 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8d68e9065fad78da0faeae6edd261f76f9c2afca7a4b6a9c9032603edffea21
|
4
|
+
data.tar.gz: 5530cb9a8c37d1d930297c270a780c4e1a89516d370e3e25e142c2c50a3c3f70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7174abc47b1c79a9bed227ba151d9769bd4b660194137b21e820ce7ab0970616b265eab2924a8a2742831823719ea39f628bbc2925dd757e66c98fd1a0faba23
|
7
|
+
data.tar.gz: 78d04f134561aceb6a00c0ed197d6cf56afcb9002a9bc8018a6951e56533d1e0bd46f332a88c496939c03b103283743f3fed8f6a633e2cb302ba3d1abbbdc4f4
|
data/lib/qat/cli.rb
ADDED
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'little-plugger'
|
2
|
+
|
3
|
+
module QAT
|
4
|
+
#Module for CLI functions
|
5
|
+
#@since 6.1.0
|
6
|
+
module CLI
|
7
|
+
#Module as namespace for plugin definition
|
8
|
+
#@since 6.1.0
|
9
|
+
module Plugins
|
10
|
+
#Placeholder
|
11
|
+
end
|
12
|
+
# @!parse extend LittlePlugger
|
13
|
+
send :extend, LittlePlugger( :path => 'qat/cli/plugins', :module => ::QAT::CLI::Plugins )
|
14
|
+
|
15
|
+
#Lists all registered extentions/plugins
|
16
|
+
#@since 6.1.0
|
17
|
+
def self.list_extentions
|
18
|
+
plugins.keys.map(&:to_s).sort
|
19
|
+
end
|
20
|
+
|
21
|
+
#Call add_module in a given plugin.
|
22
|
+
#@param mod [String,Symbol] name of the plugin to call
|
23
|
+
#@param stdout [IO] stdout stream
|
24
|
+
#@param opts [Hash] options hash
|
25
|
+
#@raise ArgumentError When module does not exist
|
26
|
+
#@since 6.1.0
|
27
|
+
def self.add_module mod, stdout, opts
|
28
|
+
raise ArgumentError.new "Module #{mod} is not a plugin!" unless has_module? mod
|
29
|
+
|
30
|
+
loaded_mod = plugins[mod.to_sym]
|
31
|
+
|
32
|
+
if loaded_mod.respond_to? :add_module
|
33
|
+
meth = loaded_mod.method :add_module
|
34
|
+
unless meth.arity == 2 || meth.arity < 0
|
35
|
+
raise ArgumentError.new "Invalid implementation of add_module in #{mod}: should have 2 parameters: stdout, opts"
|
36
|
+
end
|
37
|
+
meth.call stdout, opts
|
38
|
+
else
|
39
|
+
stdout.puts "Nothing to add in #{mod}"
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
#Check if a plugin exists
|
45
|
+
#@param mod [String,Symbol] name of the plugin to call
|
46
|
+
#@return [true,false] true if the plugin exists
|
47
|
+
#@since 6.1.0
|
48
|
+
def self.has_module? mod
|
49
|
+
return plugins.has_key? mod.to_sym
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/qat/cli/plugins/web.rb
CHANGED
@@ -1,7 +1,26 @@
|
|
1
|
-
require_relative '../../web/
|
1
|
+
require_relative '../../web/generator'
|
2
2
|
|
3
3
|
#Plugin for CLI functions
|
4
|
-
#@since 1.0
|
5
|
-
module QAT
|
4
|
+
#@since 6.1.0
|
5
|
+
module QAT
|
6
|
+
#CLI module from QAT::Web.
|
7
|
+
#@since 6.1.0
|
8
|
+
module CLI
|
9
|
+
#Plugin namespace for CLI module from QAT::Web.
|
10
|
+
#@since 6.1.0
|
11
|
+
module Plugins
|
12
|
+
#Plugin for CLI functions
|
13
|
+
#@since 6.1.0
|
14
|
+
module Web
|
6
15
|
|
16
|
+
#Function for adding the Logger module to a project. Just used for testing, does nothing.
|
17
|
+
#@param stdout [IO] Stdout stream
|
18
|
+
#@param opts [Hash] Options hash
|
19
|
+
#@since 6.1.0
|
20
|
+
def self.add_module stdout, opts
|
21
|
+
QAT::Web::Generator.add_module(stdout, opts)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
7
26
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require_relative '../../../lib/qat/web/version'
|
2
|
+
require 'fileutils'
|
3
|
+
module QAT::Web
|
4
|
+
#Module for the various generators used in the CLI utility
|
5
|
+
#@since 6.1.0
|
6
|
+
module Generator
|
7
|
+
include FileUtils
|
8
|
+
extend FileUtils
|
9
|
+
|
10
|
+
# Adds a files QAT Web module to the current project
|
11
|
+
def add_module(stdout, opts)
|
12
|
+
|
13
|
+
stdout.puts "Adding files to project" if opts[:verbose]
|
14
|
+
cp_r ::File.join(::File.dirname(__FILE__), 'generator', 'project', '.'), Dir.pwd, opts
|
15
|
+
::File.write('Gemfile', <<-GEMFILE, mode: 'a')
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
# QAT-Web is a browser controller for Web testing (https://github.com/readiness-it/qat-web)
|
20
|
+
gem 'qat-web', '~> 6.1'
|
21
|
+
|
22
|
+
# Ruby headless display interface (http://leonid.shevtsov.me/en/headless)
|
23
|
+
gem 'headless' #optional
|
24
|
+
|
25
|
+
# The next generation developer focused tool for automated testing of webapps (https://github.com/seleniumhq/selenium)
|
26
|
+
gem 'selenium-webdriver' #optional
|
27
|
+
GEMFILE
|
28
|
+
end
|
29
|
+
|
30
|
+
module_function :add_module
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
############################################
|
3
|
+
# Requires for your code libraries go here #
|
4
|
+
############################################
|
5
|
+
require 'selenium-webdriver'
|
6
|
+
require 'qat/cucumber'
|
7
|
+
require 'qat/configuration'
|
8
|
+
require 'qat/web'
|
9
|
+
require 'qat/web/cucumber'
|
10
|
+
require_relative '../../lib/web/world'
|
11
|
+
require 'qat/core_ext/integer'
|
12
|
+
|
13
|
+
World ProjectName::Web::World
|
14
|
+
|
15
|
+
ENV['FIREFOX_PATH']&.tap do |path|
|
16
|
+
Selenium::WebDriver::Firefox::Binary.path = path
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
@epic#1 @feature#2 @user_story#3 @dummy_feature
|
2
|
+
Feature: some feature
|
3
|
+
In order to do something
|
4
|
+
As someone
|
5
|
+
I want to specify scenarios
|
6
|
+
|
7
|
+
|
8
|
+
@test#4 @dummy_test
|
9
|
+
Scenario: Navigate to google page
|
10
|
+
When I navigate to home page
|
11
|
+
Then I can interact with home page
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require_relative 'pages'
|
2
|
+
require 'qat/web/page_manager'
|
3
|
+
|
4
|
+
#Project name Module
|
5
|
+
module ProjectName::Web
|
6
|
+
#Class PageManager
|
7
|
+
class PageManager < QAT::Web::PageManager
|
8
|
+
manages ProjectName::Web::Pages::Base
|
9
|
+
initial_page ProjectName::Web::Pages::Blank
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'capybara/dsl'
|
2
|
+
require 'qat/logger'
|
3
|
+
require 'qat/configuration'
|
4
|
+
require 'qat/web/page'
|
5
|
+
require 'qat/web/finders'
|
6
|
+
|
7
|
+
#Project name Module
|
8
|
+
module ProjectName
|
9
|
+
#Web name Module
|
10
|
+
module Web
|
11
|
+
#Page name Module
|
12
|
+
module Pages
|
13
|
+
#Class base
|
14
|
+
class Base < QAT::Web::Page
|
15
|
+
include Capybara::DSL
|
16
|
+
include QAT::Logger
|
17
|
+
include QAT::Web::Finders
|
18
|
+
|
19
|
+
# Action to navigate to your home page
|
20
|
+
action :navigate_home!, returns: [ProjectName::Web::Pages::Base] do
|
21
|
+
visit 'https://www.google.com'
|
22
|
+
ProjectName::Web::Pages::Home.new
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require_relative 'base'
|
2
|
+
|
3
|
+
#Project name Module
|
4
|
+
module ProjectName
|
5
|
+
#Web name Module
|
6
|
+
module Web
|
7
|
+
#Page Object Pages
|
8
|
+
module Pages
|
9
|
+
#Home page
|
10
|
+
class Home < ProjectName::Web::Pages::Base
|
11
|
+
include QAT::Logger
|
12
|
+
|
13
|
+
elements_config QAT.configuration.dig(:qat, :web, :home)
|
14
|
+
|
15
|
+
web_elements :locator_name_example
|
16
|
+
|
17
|
+
def initialize
|
18
|
+
raise HomePageNotLoaded.new 'Home page was not loaded!' unless has_selector? *selector_locator_name_example
|
19
|
+
log.info "Loaded home page with URL: #{current_url}"
|
20
|
+
end
|
21
|
+
|
22
|
+
#Introduce text on search box
|
23
|
+
def input_search search_text
|
24
|
+
locator_name_example.set search_text
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
#Exception class error
|
30
|
+
class HomePageNotLoaded < QAT::Web::Error
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative 'page_manager'
|
2
|
+
|
3
|
+
QAT::Web::Browser::AutoLoad.load_browsers!
|
4
|
+
QAT::Web::Screen::AutoLoad.load_screens!
|
5
|
+
|
6
|
+
#Project name Module
|
7
|
+
module ProjectName
|
8
|
+
#Web name Module
|
9
|
+
module Web
|
10
|
+
#World name Module
|
11
|
+
module World
|
12
|
+
#Initialise browser
|
13
|
+
def browser
|
14
|
+
unless @browser
|
15
|
+
QAT::Web::Browser::Factory.for :firefox
|
16
|
+
@browser = ProjectName::Web::PageManager.new
|
17
|
+
end
|
18
|
+
@browser
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
data/lib/qat/web/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qat-web
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.0
|
4
|
+
version: 6.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- QAT
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-09-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: qat-cucumber
|
@@ -209,6 +209,7 @@ files:
|
|
209
209
|
- lib/capybara/core_ext/node/element.rb
|
210
210
|
- lib/capybara/core_ext/selenium/node.rb
|
211
211
|
- lib/headless/core_ext/random_display.rb
|
212
|
+
- lib/qat/cli.rb
|
212
213
|
- lib/qat/cli/plugins/web.rb
|
213
214
|
- lib/qat/web.rb
|
214
215
|
- lib/qat/web/browser.rb
|
@@ -238,6 +239,22 @@ files:
|
|
238
239
|
- lib/qat/web/error/enrichment.rb
|
239
240
|
- lib/qat/web/exceptions.rb
|
240
241
|
- lib/qat/web/finders.rb
|
242
|
+
- lib/qat/web/generator.rb
|
243
|
+
- lib/qat/web/generator/project/config/common/browsers.yml
|
244
|
+
- lib/qat/web/generator/project/config/common/qat/web/home.yml
|
245
|
+
- lib/qat/web/generator/project/config/common/qat/web/page.yml
|
246
|
+
- lib/qat/web/generator/project/config/common/screens.yml
|
247
|
+
- lib/qat/web/generator/project/config/common/timeouts.yml
|
248
|
+
- lib/qat/web/generator/project/features/step_definitions/steps.rb
|
249
|
+
- lib/qat/web/generator/project/features/support/env_qat_web.rb
|
250
|
+
- lib/qat/web/generator/project/features/web_example.feature
|
251
|
+
- lib/qat/web/generator/project/lib/web.rb
|
252
|
+
- lib/qat/web/generator/project/lib/web/page_manager.rb
|
253
|
+
- lib/qat/web/generator/project/lib/web/pages.rb
|
254
|
+
- lib/qat/web/generator/project/lib/web/pages/base.rb
|
255
|
+
- lib/qat/web/generator/project/lib/web/pages/blank.rb
|
256
|
+
- lib/qat/web/generator/project/lib/web/pages/home.rb
|
257
|
+
- lib/qat/web/generator/project/lib/web/world.rb
|
241
258
|
- lib/qat/web/hooks/common.rb
|
242
259
|
- lib/qat/web/hooks/har_exporter.rb
|
243
260
|
- lib/qat/web/hooks/html_dump.rb
|