howitzer 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c577b57b08ceb6da2f3a82b8b7e29950f02903fd519379bf42d49bfbb98d619
4
- data.tar.gz: 3c3ee954802caa64bddd20e53c230dae5a6442bd83860b85058f90a61bf8cbc3
3
+ metadata.gz: fe051b3bfe068d7fe68f999882f1aac432ee24dd558438e3e0b6f195c7123885
4
+ data.tar.gz: '09dca8df71b0ed83c4f0cf6f49679330628d92934f4e2e36bd861ddeb3ff2427'
5
5
  SHA512:
6
- metadata.gz: 1bbe3fe208d2d92ebfa7b04e6ae7fa7842ff8400515f8e699ab8587cbdb1ee8206f2cfc0a9e7b3841173fd6c4f7d0ab01341dc24172ca0a3fb4136c07a14ca46
7
- data.tar.gz: 3f98ca3bc90bd1e35b7b2a87bbc8059878de7bbe08109cbdeff83e46f02bf9a8503f3bc4d034028fbef73718aac71702424276a49d59f892e25bf771d21e8f4d
6
+ metadata.gz: 5265ec269dba8e334e2c1223ac788c2a65b331f2374d9007ae78a3c0b5fc1aa79a9ce65ccfff713efeec3a7e6531cf42fc413eeb722c908f916b7fd5efc8f34d
7
+ data.tar.gz: 72948920c6c1cd9b437e766dc89bc205b12837c86e98a225ff05d853d17f16a4b833cbcc9febeeafd4b5ed3f60be915c0a67e779dd5d9967175c6b9e62cfc9f5
data/CHANGELOG.md CHANGED
@@ -4,6 +4,20 @@
4
4
 
5
5
  ### Bug-fixes
6
6
 
7
+ ## [2.4.0](https://github.com/strongqa/howitzer/compare/v2.3.0...v2.4.0) (2022-07-22)
8
+
9
+
10
+ ### Features
11
+
12
+ * LambdaTest support ([#305](https://github.com/strongqa/howitzer/issues/305)) ([eca5b8a](https://github.com/strongqa/howitzer/commit/eca5b8a6e4e30c4b9a7640ee999c061cd8e71e09))
13
+ * RegExp email subject matcher for Mailgun ([#304](https://github.com/strongqa/howitzer/issues/304)) ([598c9a2](https://github.com/strongqa/howitzer/commit/598c9a27b5dd8047c212ad050f86b78fa72d326d))
14
+ * Selenium 4 support ([#303](https://github.com/strongqa/howitzer/issues/303)) ([c5bf2d8](https://github.com/strongqa/howitzer/commit/c5bf2d8426e36f97b9fa109a783803c7b1bb538d))
15
+
16
+
17
+ ### Continuous Integration
18
+
19
+ * release-please integration ([#307](https://github.com/strongqa/howitzer/issues/307)) ([bd2f53e](https://github.com/strongqa/howitzer/commit/bd2f53e75c9ef283daadf8f9063d827c4f885a77))
20
+
7
21
  ## [v2.3.0](https://github.com/strongqa/howitzer/compare/v2.2.0...v2.3.0)
8
22
 
9
23
  ### New Features
data/README.md CHANGED
@@ -26,7 +26,7 @@
26
26
  - Fast installation and configuration of the complete testing infrastructure (takes less than 5 minutes).
27
27
  - Elegant, intuitive and powerful Ruby language underneath.
28
28
  - Possibility to choose your favorite BDD tool (Cucumber, RSpec or Turnip).
29
- - Integration with SauceLabs, Testingbot, BrowserStack, CrossBrowserTesting cloud services.
29
+ - Integration with SauceLabs, Testingbot, BrowserStack, CrossBrowserTesting, LambdaTest cloud services.
30
30
  - Integration with MailGun, Gmail, Mailtrap email services.
31
31
  - Easy tests support based on the best patterns, techniques, principles.
32
32
  - Ability to execute tests against to both browserless driver and actual browsers with no changes in your tests.
@@ -50,7 +50,6 @@ You can also find the Rdoc documentation on [Rubygems](https://rubygems.org/gems
50
50
  * [SafariDriver](https://webkit.org/blog/6900/webdriver-support-in-safari-10/) (For **safari** selenium browser)
51
51
  * [Chrome](https://www.google.com/chrome/browser/desktop/index.html) v.59+ (For **headless chrome** support)
52
52
  * [Firefox](https://www.mozilla.org/en-US/firefox/new/) v.56+ (For **headless firefox** support)
53
- * [Android SDK](https://developer.android.com/studio) and [Appium](https://appium.io/docs/en/about-appium/getting-started) (For Appium driver)
54
53
  ## Setup
55
54
  To install, type
56
55
 
@@ -89,8 +89,8 @@ module Howitzer
89
89
  copy_templates_file_exist(data, destination_path, source_path)
90
90
  else
91
91
  write_template(destination_path, source_path)
92
- puts_info "#{ColorizedString.new('Added').light_green} template '#{data[:source]}' with"\
93
- " params '#{@options}' to destination '#{data[:destination]}'"
92
+ puts_info "#{ColorizedString.new('Added').light_green} template '#{data[:source]}' with " \
93
+ "params '#{@options}' to destination '#{data[:destination]}'"
94
94
  end
95
95
  end
96
96
  end
@@ -118,10 +118,8 @@ module Howitzer
118
118
  end
119
119
 
120
120
  def write_template(dest_path, source_path)
121
- File.open(dest_path, 'w+') do |f|
122
- f.write(ERB.new(File.open(source_path, 'r').read, trim_mode: '-')
123
- .result(OpenStruct.new(@options).instance_eval { binding }))
124
- end
121
+ File.write(dest_path, ERB.new(File.read(source_path), trim_mode: '-')
122
+ .result(OpenStruct.new(@options).instance_eval { binding })) # rubocop:disable Style/OpenStructUse
125
123
  end
126
124
 
127
125
  private
@@ -13,6 +13,7 @@ module Howitzer
13
13
  { source: 'drivers/crossbrowsertesting.rb', destination: 'config/drivers/crossbrowsertesting.rb' },
14
14
  { source: 'drivers/headless_chrome.rb', destination: 'config/drivers/headless_chrome.rb' },
15
15
  { source: 'drivers/headless_firefox.rb', destination: 'config/drivers/headless_firefox.rb' },
16
+ { source: 'drivers/lambdatest.rb', destination: 'config/drivers/lambdatest.rb' },
16
17
  { source: 'drivers/sauce.rb', destination: 'config/drivers/sauce.rb' },
17
18
  { source: 'drivers/selenium.rb', destination: 'config/drivers/selenium.rb' },
18
19
  { source: 'drivers/selenium_grid.rb', destination: 'config/drivers/selenium_grid.rb' },
@@ -1,18 +1,18 @@
1
1
  HOWITZER_KNOWN_DRIVERS = %i[
2
- appium
3
2
  selenium
4
3
  selenium_grid
5
4
  sauce
6
5
  testingbot
7
6
  browserstack
8
7
  crossbrowsertesting
8
+ lambdatest
9
9
  headless_chrome
10
10
  headless_firefox
11
11
  ].freeze
12
12
 
13
13
  unless HOWITZER_KNOWN_DRIVERS.include?(Howitzer.driver.to_s.to_sym)
14
- raise Howitzer::UnknownDriverError, "Unknown '#{Howitzer.driver}' driver." \
15
- " Check your settings, it should be one of #{HOWITZER_KNOWN_DRIVERS}"
14
+ raise Howitzer::UnknownDriverError, "Unknown '#{Howitzer.driver}' driver. " \
15
+ "Check your settings, it should be one of #{HOWITZER_KNOWN_DRIVERS}"
16
16
  end
17
17
 
18
18
  Capybara.configure do |config|
@@ -27,7 +27,8 @@
27
27
  test_order: defined
28
28
 
29
29
  # Specify one of the following drivers: selenium, selenium_grid, sauce,
30
- # testingbot, browserstack, crossbrowsertesting, headless_chrome, headless_firefox, appium
30
+ # testingbot, browserstack, crossbrowsertesting, lambdatest, headless_chrome,
31
+ # headless_firefox
31
32
  driver: headless_chrome
32
33
 
33
34
  # -Selenium-
@@ -81,6 +82,11 @@
81
82
  cloud_cbt_record_video: 'true'
82
83
  cloud_cbt_record_network: 'true'
83
84
 
85
+ # -LambdaTest (https://www.lambdatest.com/support/docs/selenium-automation-capabilities)
86
+ cloud_lambdatest_resolution: '1024x768'
87
+ cloud_lambdatest_project: 'Howitzer Example'
88
+ cloud_lambdatest_build: 'v1'
89
+
84
90
  ###########################################################
85
91
  # CAPYBARA SETTINGS #
86
92
  ###########################################################
@@ -1,10 +1,32 @@
1
- Capybara.register_driver :browserstack do |app|
1
+ def w3c_selenium_browserstack_caps # rubocop:disable Metrics/AbcSize
2
+ caps = CapybaraHelpers.required_w3c_cloud_caps
3
+ bstack_options = {
4
+ sessionName: "#{(Howitzer.current_rake_task || 'ALL').upcase} #{Howitzer.cloud_browser_name}",
5
+ projectName: Howitzer.cloud_bstack_project,
6
+ buildName: Howitzer.cloud_bstack_build
7
+ }
8
+ bstack_options['resolution'] = Howitzer.cloud_bstack_resolution if Howitzer.cloud_bstack_resolution.present?
9
+ bstack_options['os'] = Howitzer.cloud_bstack_os if Howitzer.cloud_bstack_os.present?
10
+ caps['bstack:options'] = bstack_options
11
+ if Howitzer.user_agent.present?
12
+ if CapybaraHelpers.chrome_browser?
13
+ caps['goog:chromeOptions'] = { 'args' => ["--user-agent=#{Howitzer.user_agent}"] }
14
+ elsif CapybaraHelpers.ff_browser?
15
+ profile = Selenium::WebDriver::Firefox::Profile.new
16
+ profile['general.useragent.override'] = Howitzer.user_agent
17
+ caps['moz:firefoxOptions'] = { profile: profile.as_json['zip'] }
18
+ end
19
+ end
20
+ caps
21
+ end
22
+
23
+ def classic_selenium_browserstack_caps # rubocop:disable Metrics/AbcSize
2
24
  caps = CapybaraHelpers.required_cloud_caps.merge(
3
25
  project: Howitzer.cloud_bstack_project,
4
26
  build: Howitzer.cloud_bstack_build
5
27
  )
6
- caps[:resolution] = Howitzer.cloud_bstack_resolution if Howitzer.cloud_bstack_resolution.present?
7
- caps[:device] = Howitzer.cloud_bstack_mobile_device if Howitzer.cloud_bstack_mobile_device.present?
28
+ caps['resolution'] = Howitzer.cloud_bstack_resolution if Howitzer.cloud_bstack_resolution.present?
29
+ caps['os'] = Howitzer.cloud_bstack_os if Howitzer.cloud_bstack_os.present?
8
30
  if Howitzer.user_agent.present?
9
31
  if CapybaraHelpers.chrome_browser?
10
32
  caps['chromeOptions'] = { 'args' => ["--user-agent=#{Howitzer.user_agent}"] }
@@ -14,7 +36,12 @@ Capybara.register_driver :browserstack do |app|
14
36
  caps[:firefox_profile] = profile
15
37
  end
16
38
  end
39
+ caps
40
+ end
41
+
42
+ Capybara.register_driver :browserstack do |app|
17
43
  url = "https://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@hub.browserstack.com/wd/hub"
44
+ caps = CapybaraHelpers.w3c_selenium? ? w3c_selenium_browserstack_caps : classic_selenium_browserstack_caps
18
45
  CapybaraHelpers.cloud_driver(app, caps, url)
19
46
  end
20
47
 
@@ -1,15 +1,15 @@
1
1
  # :crossbrowsertesting driver
2
2
 
3
3
  Capybara.register_driver :crossbrowsertesting do |app|
4
- caps = {}
5
- caps['name'] = Howitzer.cloud_cbt_name
6
- caps['build'] = Howitzer.cloud_cbt_build
7
- caps['browser_api_name'] = Howitzer.cloud_browser_name + Howitzer.cloud_browser_version.to_s
8
- caps['os_api_name'] = Howitzer.cloud_cbt_os_api_name
9
- caps['screen_resolution'] = Howitzer.cloud_cbt_screen_resolution
10
- caps['record_video'] = Howitzer.cloud_cbt_record_video
11
- caps['record_network'] = Howitzer.cloud_cbt_record_network
12
- caps['max_duration'] = Howitzer.cloud_max_duration
4
+ url = "https://#{CGI.escape(Howitzer.cloud_auth_login)}:#{Howitzer.cloud_auth_pass}" \
5
+ '@hub.crossbrowsertesting.com/wd/hub'
6
+ caps = CapybaraHelpers.required_cloud_caps.merge(
7
+ build: Howitzer.cloud_cbt_build,
8
+ screenResolution: Howitzer.cloud_cbt_screen_resolution,
9
+ record_video: Howitzer.cloud_cbt_record_video,
10
+ record_network: Howitzer.cloud_cbt_record_network,
11
+ max_duration: Howitzer.cloud_max_duration
12
+ )
13
13
  if Howitzer.user_agent.present?
14
14
  if CapybaraHelpers.chrome_browser?
15
15
  caps['chromeOptions'] = { 'args' => ["--user-agent=#{Howitzer.user_agent}"] }
@@ -19,8 +19,6 @@ Capybara.register_driver :crossbrowsertesting do |app|
19
19
  caps[:firefox_profile] = profile
20
20
  end
21
21
  end
22
- url = "https://#{CGI.escape(Howitzer.cloud_auth_login)}:#{Howitzer.cloud_auth_pass}"\
23
- '@hub.crossbrowsertesting.com/wd/hub'
24
22
  CapybaraHelpers.cloud_driver(app, caps, url)
25
23
  end
26
24
 
@@ -0,0 +1,30 @@
1
+ def w3c_selenium_lambdatest_caps
2
+ caps = CapybaraHelpers.required_w3c_cloud_caps
3
+ lt_options = {
4
+ name: "#{(Howitzer.current_rake_task || 'ALL').upcase} #{Howitzer.cloud_browser_name}",
5
+ build: Howitzer.cloud_lambdatest_build
6
+ }
7
+ lt_options[:platformName] = Howitzer.cloud_platform unless Howitzer.cloud_platform.casecmp?('any')
8
+ lt_options[:resolution] = Howitzer.cloud_lambdatest_resolution if Howitzer.cloud_lambdatest_resolution.present?
9
+ caps['LT:Options'] = lt_options
10
+ caps
11
+ end
12
+
13
+ def classic_selenium_lambdatest_caps
14
+ caps = CapybaraHelpers.required_cloud_caps.merge(
15
+ build: Howitzer.cloud_lambdatest_build,
16
+ acceptSslCerts: true
17
+ )
18
+ caps[:resolution] = Howitzer.cloud_lambdatest_resolution if Howitzer.cloud_lambdatest_resolution.present?
19
+ caps
20
+ end
21
+
22
+ Capybara.register_driver :lambdatest do |app|
23
+ url = "https://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@hub.lambdatest.com/wd/hub"
24
+ caps = CapybaraHelpers.w3c_selenium? ? w3c_selenium_lambdatest_caps : classic_selenium_lambdatest_caps
25
+ CapybaraHelpers.cloud_driver(app, caps, url)
26
+ end
27
+
28
+ Capybara::Screenshot.class_eval do
29
+ register_driver :lambdatest, &registered_drivers[:selenium]
30
+ end
@@ -1,6 +1,29 @@
1
1
  # :sauce driver
2
2
 
3
- Capybara.register_driver :sauce do |app|
3
+ def w3c_selenium_browserstack_caps # rubocop:disable Metrics/AbcSize
4
+ caps = CapybaraHelpers.required_w3c_cloud_caps
5
+ caps['platform'] = Howitzer.cloud_platform unless Howitzer.cloud_platform.casecmp?('any')
6
+ sauce_options = {
7
+ name: "#{(Howitzer.current_rake_task || 'ALL').upcase} #{Howitzer.cloud_browser_name}",
8
+ maxDuration: Howitzer.cloud_max_duration,
9
+ idleTimeout: Howitzer.cloud_sauce_idle_timeout,
10
+ recordScreenshots: Howitzer.cloud_sauce_record_screenshots,
11
+ videoUploadOnPass: Howitzer.cloud_sauce_video_upload_on_pass
12
+ }
13
+ caps['sauce:options'] = sauce_options
14
+ if Howitzer.user_agent.present?
15
+ if CapybaraHelpers.chrome_browser?
16
+ caps['goog:chromeOptions'] = { 'args' => ["--user-agent=#{Howitzer.user_agent}"] }
17
+ elsif CapybaraHelpers.ff_browser?
18
+ profile = Selenium::WebDriver::Firefox::Profile.new
19
+ profile['general.useragent.override'] = Howitzer.user_agent
20
+ caps['moz:firefoxOptions'] = { profile: profile.as_json['zip'] }
21
+ end
22
+ end
23
+ caps
24
+ end
25
+
26
+ def classic_selenium_browserstack_caps # rubocop:disable Metrics/AbcSize
4
27
  caps = CapybaraHelpers.required_cloud_caps.merge(
5
28
  maxDuration: Howitzer.cloud_max_duration,
6
29
  idleTimeout: Howitzer.cloud_sauce_idle_timeout,
@@ -16,7 +39,12 @@ Capybara.register_driver :sauce do |app|
16
39
  caps[:firefox_profile] = profile
17
40
  end
18
41
  end
42
+ caps
43
+ end
44
+
45
+ Capybara.register_driver :sauce do |app|
19
46
  url = "https://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@ondemand.saucelabs.com/wd/hub"
47
+ caps = CapybaraHelpers.w3c_selenium? ? w3c_selenium_browserstack_caps : classic_selenium_browserstack_caps
20
48
  CapybaraHelpers.cloud_driver(app, caps, url)
21
49
  end
22
50
 
@@ -10,9 +10,9 @@ Capybara.register_driver :selenium_grid do |app|
10
10
  elsif CapybaraHelpers.safari_browser?
11
11
  Selenium::WebDriver::Remote::Capabilities.safari
12
12
  else
13
- raise Howitzer::UnknownBrowserError, "Unknown '#{Howitzer.selenium_browser}' selenium_browser." \
14
- ' Check your settings, it should be one of' \
15
- ' [:ie, :iexplore, :ff, :firefox, :chrome, :safari]'
13
+ raise Howitzer::UnknownBrowserError, "Unknown '#{Howitzer.selenium_browser}' selenium_browser. " \
14
+ 'Check your settings, it should be one of ' \
15
+ '[:ie, :iexplore, :ff, :firefox, :chrome, :safari]'
16
16
  end
17
17
  if Howitzer.user_agent.present?
18
18
  if CapybaraHelpers.chrome_browser?
@@ -1,6 +1,28 @@
1
1
  # :testingbot driver
2
2
 
3
- Capybara.register_driver :testingbot do |app|
3
+ def w3c_selenium_browserstack_caps # rubocop:disable Metrics/AbcSize
4
+ caps = CapybaraHelpers.required_w3c_cloud_caps
5
+ caps[:platformName] = Howitzer.cloud_platform unless Howitzer.cloud_platform.casecmp?('any')
6
+ tb_options = {
7
+ name: "#{(Howitzer.current_rake_task || 'ALL').upcase} #{Howitzer.cloud_browser_name}",
8
+ maxduration: Howitzer.cloud_max_duration,
9
+ idletimeout: Howitzer.cloud_testingbot_idle_timeout,
10
+ screenshot: Howitzer.cloud_testingbot_screenshots
11
+ }
12
+ caps['tb:options'] = tb_options
13
+ if Howitzer.user_agent.present?
14
+ if CapybaraHelpers.chrome_browser?
15
+ caps['goog:chromeOptions'] = { 'args' => ["--user-agent=#{Howitzer.user_agent}"] }
16
+ elsif CapybaraHelpers.ff_browser?
17
+ profile = Selenium::WebDriver::Firefox::Profile.new
18
+ profile['general.useragent.override'] = Howitzer.user_agent
19
+ caps['moz:firefoxOptions'] = { profile: profile.as_json['zip'] }
20
+ end
21
+ end
22
+ caps
23
+ end
24
+
25
+ def classic_selenium_browserstack_caps
4
26
  caps = CapybaraHelpers.required_cloud_caps.merge(
5
27
  maxduration: Howitzer.cloud_max_duration,
6
28
  idletimeout: Howitzer.cloud_testingbot_idle_timeout,
@@ -15,7 +37,12 @@ Capybara.register_driver :testingbot do |app|
15
37
  caps[:firefox_profile] = profile
16
38
  end
17
39
  end
40
+ caps
41
+ end
42
+
43
+ Capybara.register_driver :testingbot do |app|
18
44
  url = "https://#{Howitzer.cloud_auth_login}:#{Howitzer.cloud_auth_pass}@hub.testingbot.com/wd/hub"
45
+ caps = CapybaraHelpers.w3c_selenium? ? w3c_selenium_browserstack_caps : classic_selenium_browserstack_caps
19
46
  CapybaraHelpers.cloud_driver(app, caps, url)
20
47
  end
21
48
 
@@ -15,8 +15,8 @@ After do |scenario|
15
15
  if CapybaraHelpers.cloud_driver?
16
16
  Howitzer::Cache.store(:cloud, :status, false) if scenario.failed?
17
17
  session_end = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
18
- Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end}" \
19
- " URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
18
+ Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end} " \
19
+ "URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
20
20
  elsif CapybaraHelpers.ie_browser?
21
21
  Howitzer::Log.info 'IE reset session'
22
22
  Capybara.current_session.execute_script("void(document.execCommand('ClearAuthenticationCache', false));")
@@ -16,7 +16,3 @@ gem 'rubocop'
16
16
  <%= "gem 'rubocop-rspec'\n" if rspec || turnip -%>
17
17
  <%= "gem 'turnip'\n" if turnip -%>
18
18
  <%= "gem 'syntax'\n" if cucumber -%>
19
-
20
- # Uncomment it if you are going to use 'appium' driver. Appium and Android SDK should be installed.
21
- # See https://appium.io/docs/en/about-appium/getting-started/
22
- # gem 'appium_capybara'
@@ -32,8 +32,8 @@ RSpec.configure do |config|
32
32
  Howitzer::Cache.clear_all_ns
33
33
  if CapybaraHelpers.cloud_driver?
34
34
  session_end = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
35
- Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end}" \
36
- " URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
35
+ Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end} " \
36
+ "URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
37
37
  elsif CapybaraHelpers.ie_browser?
38
38
  Howitzer::Log.info 'IE reset session'
39
39
  Capybara.current_session.execute_script("void(document.execCommand('ClearAuthenticationCache', false));")
@@ -31,8 +31,8 @@ RSpec.configure do |config|
31
31
  Howitzer::Cache.clear_all_ns
32
32
  if CapybaraHelpers.cloud_driver?
33
33
  session_end = CapybaraHelpers.duration(Time.now.utc - Howitzer::Cache.extract(:cloud, :start_time))
34
- Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end}" \
35
- " URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
34
+ Howitzer::Log.info "CLOUD VIDEO #{@session_start} - #{session_end} " \
35
+ "URL: #{CapybaraHelpers.cloud_resource_path(:video)}"
36
36
  elsif CapybaraHelpers.ie_browser?
37
37
  Howitzer::Log.info 'IE reset session'
38
38
  Capybara.current_session.execute_script("void(document.execCommand('ClearAuthenticationCache', false));")
@@ -4,7 +4,8 @@ require 'howitzer/exceptions'
4
4
  # There is an issue with supporting Ruby 3 by Selenium Webdriver 3.x version
5
5
  # https://github.com/SeleniumHQ/selenium/issues/9001
6
6
  # Migration to Selenium Webdriver 4 is planned when it will be released without alfa, beta stages.
7
- if Gem::Requirement.new('>=3').satisfied_by?(Gem::Version.new(RUBY_VERSION)) ||
7
+ # :nocov:
8
+ if Gem::Requirement.new('>=3').satisfied_by?(Gem::Version.new(RUBY_VERSION)) &&
8
9
  Gem::Requirement.new(['>=3', '<4']).satisfied_by?(Gem::Version.new(Selenium::WebDriver::VERSION))
9
10
  module Selenium
10
11
  module WebDriver
@@ -22,6 +23,7 @@ if Gem::Requirement.new('>=3').satisfied_by?(Gem::Version.new(RUBY_VERSION)) ||
22
23
  end
23
24
  end
24
25
  end
26
+ # :nocov:
25
27
 
26
28
  module Howitzer
27
29
  # This module holds capybara helpers methods
@@ -130,6 +132,21 @@ module Howitzer
130
132
  }
131
133
  end
132
134
 
135
+ # @return [Hash] selenium W3C capabilities required for a cloud driver
136
+
137
+ def required_w3c_cloud_caps
138
+ {
139
+ browserName: Howitzer.cloud_browser_name,
140
+ browserVersion: Howitzer.cloud_browser_version
141
+ }
142
+ end
143
+
144
+ # @return [Boolean] whether or not Selenium is W3C compatible.
145
+
146
+ def w3c_selenium?
147
+ Gem::Requirement.new('>=4').satisfied_by?(Gem::Version.new(Selenium::WebDriver::VERSION))
148
+ end
149
+
133
150
  # Buids selenium driver for a cloud service
134
151
  # @param app [<Rack>] a rack application that this server will contain
135
152
  # @param caps [Hash] remote capabilities
@@ -140,13 +157,13 @@ module Howitzer
140
157
  http_client = ::Selenium::WebDriver::Remote::Http::Default.new
141
158
  http_client.read_timeout = Howitzer.cloud_http_idle_timeout
142
159
  http_client.open_timeout = Howitzer.cloud_http_idle_timeout
143
-
144
160
  options = {
145
161
  url: url,
146
- desired_capabilities: ::Selenium::WebDriver::Remote::Capabilities.new(caps),
147
162
  http_client: http_client,
148
163
  browser: :remote
149
164
  }
165
+ options[w3c_selenium? ? :capabilities : :desired_capabilities] =
166
+ ::Selenium::WebDriver::Remote::Capabilities.new(caps)
150
167
  driver = Capybara::Selenium::Driver.new(app, **options)
151
168
  driver.browser.file_detector = remote_file_detector
152
169
  driver
@@ -79,8 +79,8 @@ module Howitzer
79
79
  def self.find_by_recipient(recipient, params = {})
80
80
  if defined?(subject_value).nil? || subject_value.nil?
81
81
  raise Howitzer::NoEmailSubjectError, "Please specify email subject. For example:\n" \
82
- "class SomeEmail < Howitzer::Email\n" \
83
- " subject ‘some subject text’\nend"
82
+ "class SomeEmail < Howitzer::Email\n " \
83
+ "subject ‘some subject text’\nend"
84
84
  end
85
85
  new(adapter.find(recipient, expand_subject(params), wait: wait_time_value))
86
86
  end
@@ -89,7 +89,7 @@ module Howitzer
89
89
 
90
90
  def self.event_by(recipient, subject)
91
91
  events.to_h['items'].find do |hash|
92
- hash['message']['recipients'].first == recipient && hash['message']['headers']['subject'] == subject
92
+ hash['message']['recipients'].first == recipient && subject === hash['message']['headers']['subject']
93
93
  end
94
94
  end
95
95
  private_class_method :event_by
@@ -1,4 +1,4 @@
1
1
  # This module holds howitzer version
2
2
  module Howitzer
3
- VERSION = '2.3.0'.freeze # :nodoc:
3
+ VERSION = '2.4.0'.freeze # :nodoc:
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: howitzer
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.0
4
+ version: 2.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roman Parashchenko
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-18 00:00:00.000000000 Z
11
+ date: 2022-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -149,9 +149,6 @@ dependencies:
149
149
  - - ">="
150
150
  - !ruby/object:Gem::Version
151
151
  version: 3.4.1
152
- - - "<"
153
- - !ruby/object:Gem::Version
154
- version: '4.0'
155
152
  type: :runtime
156
153
  prerelease: false
157
154
  version_requirements: !ruby/object:Gem::Requirement
@@ -159,9 +156,6 @@ dependencies:
159
156
  - - ">="
160
157
  - !ruby/object:Gem::Version
161
158
  version: 3.4.1
162
- - - "<"
163
- - !ruby/object:Gem::Version
164
- version: '4.0'
165
159
  - !ruby/object:Gem::Dependency
166
160
  name: sexy_settings
167
161
  requirement: !ruby/object:Gem::Requirement
@@ -253,11 +247,11 @@ files:
253
247
  - generators/config/templates/capybara.rb
254
248
  - generators/config/templates/custom.yml
255
249
  - generators/config/templates/default.yml
256
- - generators/config/templates/drivers/appium.rb
257
250
  - generators/config/templates/drivers/browserstack.rb
258
251
  - generators/config/templates/drivers/crossbrowsertesting.rb
259
252
  - generators/config/templates/drivers/headless_chrome.rb
260
253
  - generators/config/templates/drivers/headless_firefox.rb
254
+ - generators/config/templates/drivers/lambdatest.rb
261
255
  - generators/config/templates/drivers/sauce.rb
262
256
  - generators/config/templates/drivers/selenium.rb
263
257
  - generators/config/templates/drivers/selenium_grid.rb
@@ -342,9 +336,10 @@ licenses:
342
336
  metadata:
343
337
  bug_tracker_uri: https://github.com/strongqa/howitzer/issues
344
338
  changelog_uri: https://github.com/strongqa/howitzer/blob/master/CHANGELOG.md
345
- documentation_uri: https://www.rubydoc.info/gems/howitzer/2.3.0
339
+ documentation_uri: https://www.rubydoc.info/gems/howitzer/2.4.0
346
340
  source_code_uri: https://github.com/strongqa/howitzer
347
- post_install_message:
341
+ rubygems_mfa_required: 'false'
342
+ post_install_message:
348
343
  rdoc_options: []
349
344
  require_paths:
350
345
  - lib
@@ -359,8 +354,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
354
  - !ruby/object:Gem::Version
360
355
  version: '0'
361
356
  requirements: []
362
- rubygems_version: 3.2.22
363
- signing_key:
357
+ rubygems_version: 3.2.33
358
+ signing_key:
364
359
  specification_version: 4
365
360
  summary: Ruby based framework for acceptance testing
366
361
  test_files: []
@@ -1,25 +0,0 @@
1
- CapybaraHelpers.load_driver_gem!(:appium, 'appium_capybara', 'appium_capybara')
2
-
3
- Capybara.register_driver(:appium) do |app|
4
- caps = {}
5
- caps['deviceName'] = Howitzer.appium_device_name
6
- caps['deviceOrientation'] = Howitzer.appium_device_orientation
7
- caps['platformVersion'] = Howitzer.appium_platform_version
8
- caps['platformName'] = Howitzer.appium_platform_name
9
- caps['browserName'] = Howitzer.appium_browser_name
10
-
11
- url = Howitzer.appium_url
12
-
13
- appium_lib_options = {
14
- server_url: url
15
- }
16
- all_options = {
17
- appium_lib: appium_lib_options,
18
- caps: caps
19
- }
20
- Appium::Capybara::Driver.new app, all_options
21
- end
22
-
23
- Capybara::Screenshot.class_eval do
24
- register_driver :appium, &registered_drivers[:selenium]
25
- end