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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c0c42697ea27626ec6e4674fa4bfcb15157690095b7f95f17f70c8e011dac68
4
- data.tar.gz: a8e5c7815776b985bab6956db5d3c9050b4cbbf2e2a29bebde266ccd3401cbcf
3
+ metadata.gz: d8d68e9065fad78da0faeae6edd261f76f9c2afca7a4b6a9c9032603edffea21
4
+ data.tar.gz: 5530cb9a8c37d1d930297c270a780c4e1a89516d370e3e25e142c2c50a3c3f70
5
5
  SHA512:
6
- metadata.gz: 5b9b51572bca22fe718f253c153af8282674f588250ee7cb549e9c625c0ed20fc60752f239668e31c9981a1d13f0ed53987c59840f19e0668660af810ef9c60a
7
- data.tar.gz: ea161b61cc1e98e8daeeafdff7b0620d791e505886c26cd3384d18c26bd19ccb5376bf8a7b999102ac5c82b104f9f261a3ff41ca5bb5a2aa52590191c47a1d6b
6
+ metadata.gz: 7174abc47b1c79a9bed227ba151d9769bd4b660194137b21e820ce7ab0970616b265eab2924a8a2742831823719ea39f628bbc2925dd757e66c98fd1a0faba23
7
+ data.tar.gz: 78d04f134561aceb6a00c0ed197d6cf56afcb9002a9bc8018a6951e56533d1e0bd46f332a88c496939c03b103283743f3fed8f6a633e2cb302ba3d1abbbdc4f4
@@ -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
@@ -1,7 +1,26 @@
1
- require_relative '../../web/version'
1
+ require_relative '../../web/generator'
2
2
 
3
3
  #Plugin for CLI functions
4
- #@since 1.0.0
5
- module QAT::CLI::Plugins::Web
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,5 @@
1
+ firefox:
2
+ browser: firefox
3
+ screen: screen_1080p
4
+ properties:
5
+ geo.enabled: false
@@ -0,0 +1,4 @@
1
+ locators:
2
+ locator_name_example:
3
+ xpath: .//*[@name='q']
4
+ wait: timeouts.browser.medium
@@ -0,0 +1,4 @@
1
+ locators:
2
+ locator_name_example:
3
+ xpath: .//a[@title='selector_example']
4
+ wait: timeouts.browser.medium
@@ -0,0 +1,10 @@
1
+ screen_1080p: &screen_1080p
2
+ resolution:
3
+ width: 1920
4
+ height: 1080
5
+ video:
6
+ provider: ffmpeg
7
+ log_file_path: <%= File.join 'public', 'video.log' %>
8
+ codec: libx264
9
+ frame_rate: 12
10
+ extra: -pix_fmt yuvj420p
@@ -0,0 +1,7 @@
1
+ browser:
2
+ small: 5
3
+ medium: 15
4
+ big: 30
5
+ huge: 60
6
+ go_grab_a_coffee: 120
7
+ bathroom_break: 360
@@ -0,0 +1,7 @@
1
+ When(/^I navigate to home page$/) do
2
+ browser.navigate_home!
3
+ end
4
+
5
+ Then(/^I can interact with home page$/) do
6
+ browser.input_search "Test Automation"
7
+ 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,2 @@
1
+ require_relative 'web/pages'
2
+ require_relative 'web/page_manager'
@@ -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,3 @@
1
+ require_relative 'pages/base'
2
+ require_relative 'pages/blank'
3
+ require_relative 'pages/home'
@@ -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,5 @@
1
+ require_relative 'base'
2
+
3
+ #Blank class
4
+ class ProjectName::Web::Pages::Blank < ProjectName::Web::Pages::Base
5
+ 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
@@ -4,6 +4,6 @@ module QAT
4
4
  #@since 1.0.0
5
5
  module Web
6
6
  # Represents QAT-Web's version
7
- VERSION = '6.0.3'
7
+ VERSION = '6.1.0'
8
8
  end
9
9
  end
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.3
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-07-31 00:00:00.000000000 Z
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