eyes_selenium 2.39.1 → 3.0.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/lib/applitools/capybara.rb +1 -1
  3. data/lib/applitools/selenium/border_aware_element_content_location_provider.rb +41 -0
  4. data/lib/applitools/selenium/browser.rb +1 -0
  5. data/lib/applitools/selenium/capybara/capybara_settings.rb +8 -0
  6. data/lib/applitools/selenium/capybara/driver.rb +1 -0
  7. data/lib/applitools/selenium/context_based_scale_provider.rb +36 -0
  8. data/lib/applitools/selenium/css_translate_position_provider.rb +66 -0
  9. data/lib/applitools/selenium/driver.rb +159 -44
  10. data/lib/applitools/selenium/element.rb +100 -8
  11. data/lib/applitools/selenium/element_position_provider.rb +48 -0
  12. data/lib/applitools/selenium/eyes.rb +922 -0
  13. data/lib/applitools/selenium/eyes_target_locator.rb +191 -0
  14. data/lib/applitools/selenium/eyes_web_driver_screenshot.rb +274 -0
  15. data/lib/applitools/selenium/frame.rb +24 -0
  16. data/lib/applitools/selenium/frame_chain.rb +68 -0
  17. data/lib/applitools/selenium/full_page_capture_algorithm.rb +162 -0
  18. data/lib/applitools/selenium/keyboard.rb +1 -0
  19. data/lib/applitools/selenium/match_window_task.rb +0 -197
  20. data/lib/applitools/selenium/mouse.rb +1 -0
  21. data/lib/applitools/selenium/move_to_region_visibility_strategy.rb +33 -0
  22. data/lib/applitools/selenium/nop_region_visibility_strategy.rb +16 -0
  23. data/lib/applitools/selenium/scroll_position_provider.rb +52 -0
  24. data/lib/applitools/selenium/takes_screenshot_image_provider.rb +36 -0
  25. data/lib/applitools/version.rb +1 -1
  26. data/lib/eyes_selenium.rb +19 -30
  27. metadata +24 -254
  28. data/.gitignore +0 -18
  29. data/.rspec +0 -2
  30. data/.rubocop.yml +0 -57
  31. data/.travis.yml +0 -17
  32. data/Gemfile +0 -4
  33. data/LICENSE.txt +0 -13
  34. data/README.md +0 -38
  35. data/Rakefile +0 -11
  36. data/certs/cacert.pem +0 -3557
  37. data/examples/appium_example_script.rb +0 -59
  38. data/examples/capybara_example.rb +0 -82
  39. data/examples/sauce_capybara_example.rb +0 -41
  40. data/examples/sauce_example.rb +0 -34
  41. data/examples/simple_test_script.rb +0 -23
  42. data/examples/watir_test_script.rb +0 -26
  43. data/eyes_selenium.gemspec +0 -89
  44. data/lib/applitools/appium_driver.rb +0 -7
  45. data/lib/applitools/base/batch_info.rb +0 -21
  46. data/lib/applitools/base/dimension.rb +0 -36
  47. data/lib/applitools/base/environment.rb +0 -19
  48. data/lib/applitools/base/image_position.rb +0 -10
  49. data/lib/applitools/base/mouse_trigger.rb +0 -33
  50. data/lib/applitools/base/point.rb +0 -34
  51. data/lib/applitools/base/region.rb +0 -112
  52. data/lib/applitools/base/server_connector.rb +0 -120
  53. data/lib/applitools/base/session.rb +0 -15
  54. data/lib/applitools/base/start_info.rb +0 -34
  55. data/lib/applitools/base/test_results.rb +0 -28
  56. data/lib/applitools/base/text_trigger.rb +0 -22
  57. data/lib/applitools/extensions.rb +0 -17
  58. data/lib/applitools/eyes.rb +0 -460
  59. data/lib/applitools/eyes_logger.rb +0 -38
  60. data/lib/applitools/method_tracer.rb +0 -22
  61. data/lib/applitools/poltergeist/applitools_compatible.rb +0 -28
  62. data/lib/applitools/poltergeist/driver.rb +0 -11
  63. data/lib/applitools/sauce.rb +0 -2
  64. data/lib/applitools/selenium/match_window_data.rb +0 -28
  65. data/lib/applitools/selenium_webdriver.rb +0 -8
  66. data/lib/applitools/utils/image_delta_compressor.rb +0 -148
  67. data/lib/applitools/utils/image_utils.rb +0 -143
  68. data/lib/applitools/utils/utils.rb +0 -49
  69. data/lib/applitools/watir_browser.rb +0 -8
  70. data/spec/driver_passthrough_spec.rb +0 -68
  71. data/spec/fixtures/static_test_file.html +0 -15
  72. data/spec/spec_helper.rb +0 -17
@@ -1,59 +0,0 @@
1
- require 'logger'
2
- require 'appium_lib'
3
-
4
- require 'eyes_selenium'
5
-
6
- # Based on Appium example: https://github.com/appium/appium/blob/master/sample-code/examples/ruby/
7
-
8
- def android_caps
9
- {
10
- deviceName: 'Samsung Galaxy S4 Emulator',
11
- platformName: 'Android',
12
- platformVersion: 4.4,
13
- app: ENV['ANDROID_NOTES_LIST_APP'],
14
- appPackage: 'com.example.android.notepad',
15
- appActivity: '.NotesList',
16
- # orientation: 'landscape',
17
- newCommandTimeout: 300
18
- }
19
- end
20
-
21
- def ios_caps
22
- {
23
- deviceName: 'iPhone 6',
24
- platformName: 'ios',
25
- platformVersion: 8.4,
26
- app: ENV['IOS_DEMO_APP'],
27
- orientation: 'landscape',
28
- newCommandTimeout: 300
29
- }
30
- end
31
-
32
- def appium_opts
33
- {
34
- server_url: 'http://127.0.0.1:4723/wd/hub'
35
- }
36
- end
37
-
38
- eyes = Applitools::Eyes.new
39
- eyes.log_handler = Logger.new(STDOUT)
40
- eyes.api_key = ENV['APPLITOOLS_API_KEY']
41
-
42
- begin
43
- # driver = Selenium::WebDriver.for(:remote, :url => 'http://localhost:4723/wd/hub', :desired_capabilities => ios_caps)
44
- # driver = Appium::Driver.new({caps: android_caps, appium_lib: appium_opts})
45
- driver = Appium::Driver.new(caps: ios_caps, appium_lib: appium_opts)
46
- driver.start_driver
47
- # driver.driver.rotate :landscape
48
- puts "Screen size: #{driver.driver.manage.window.size}"
49
- puts "orientation: #{driver.driver.orientation}"
50
- puts driver.caps
51
- eyes.open(app_name: 'Ruby SDK', test_name: 'Appium Notepad', driver: driver)
52
-
53
- eyes.check_window('No notes')
54
- eyes.close
55
- ensure
56
- eyes.abort_if_not_closed
57
- driver.driver_quit
58
- # driver.quit
59
- end
@@ -1,82 +0,0 @@
1
- require 'rspec'
2
- require 'capybara/rspec'
3
- require 'eyes_selenium'
4
- require 'applitools/capybara'
5
-
6
- ##
7
- # This will register capybara driver :eyes by performing
8
- #
9
- # Capybara.register_driver :eyes do |app|
10
- # Capybara::Selenium::Driver.new(options)
11
- # end
12
- #
13
- # (options are passed to Applitools.register_capybara_driver method) and set it as a default driver.
14
- # The page.driver.browser method will return Applitools::Selenium::Driver instance,
15
- # based on standard Selenium::Webdriver driver, when eyes have opened.
16
- # The page.driver.browser method will contain Selenium::Webdriver
17
- # instance (without applitools wrapper), after eyes have closed
18
- #
19
- Applitools.register_capybara_driver :browser => :chrome
20
-
21
- # Register another driver if needed
22
- Capybara.register_driver :selenium_chrome do |app|
23
- Capybara::Selenium::Driver.new(app, :browser => :chrome)
24
- end
25
-
26
- # And even one more
27
- Capybara.register_driver :selenium_firefox do |app|
28
- Capybara::Selenium::Driver.new(app, :browser => :firefox)
29
- end
30
-
31
- describe 'Capybara Example', :type => :feature, :js => true do
32
- let(:eyes) do
33
- Applitools::Eyes.new.tap do |eyes|
34
- eyes.api_key = ENV['APPLITOOLS_API_KEY']
35
- eyes.log_handler = Logger.new(STDOUT)
36
- end
37
- end
38
-
39
- it 'Simple test' do
40
- eyes.open(app_name: 'Ruby SDK', test_name: 'Capybara test', driver: page,
41
- viewport_size: { width: 800, height: 600 })
42
- visit 'http://github.com'
43
- eyes.check_window('homepage')
44
- fill_in('user[login]', with: 'user')
45
- eyes.check_window('homepage with username')
46
- eyes.close
47
- end
48
-
49
- ##
50
- # This will use :eyes driver with standard browser, without Applitools wrapper
51
- # In our case - Selenium::Webdriver for :crome
52
- #
53
- it 'common capybara test' do
54
- visit 'http://github.com'
55
- fill_in('user[login]', with: 'user')
56
- # and so on
57
- end
58
-
59
- it 'other chrome test' do
60
- ##
61
- # this uses :selenium_chrome driver (see Capybara.register_driver block) instead of :eyes driver
62
- Capybara.using_driver :selenium_chrome do
63
- visit 'http://github.com'
64
- fill_in('user[login]', with: 'user')
65
- # and so on
66
- end
67
- end
68
-
69
- after :each do
70
- eyes.abort_if_not_closed
71
- end
72
- end
73
-
74
- describe 'Other Capybara tests', :type => :feature, :js => true do
75
- it 'some other chrome test' do
76
- Capybara.using_driver :selenium_chrome do
77
- visit 'http://github.com'
78
- fill_in('user[login]', with: 'user')
79
- # and so on
80
- end
81
- end
82
- end
@@ -1,41 +0,0 @@
1
- require 'rspec'
2
- require 'capybara/rspec'
3
- require 'sauce'
4
- require 'sauce/capybara'
5
- require 'eyes_selenium'
6
-
7
- Sauce.config do |config|
8
- config[:browsers] = [
9
- ['OS X 10.10', 'chrome', '39.0']
10
- ]
11
- config[:start_tunnel] = false
12
- # config[:sauce_connect_4_executable] = '/path/to/sauce-connect/bin/sc'
13
- end
14
-
15
- Capybara.configure do |c|
16
- c.javascript_driver = :sauce
17
- c.default_driver = :sauce
18
- end
19
-
20
- describe 'A Saucy Example Group', :type => :feature, :sauce => true do
21
- let!(:eyes) do
22
- Applitools::Eyes.new.tap do |eyes|
23
- eyes.api_key = ENV['APPLITOOLS_API_KEY']
24
- eyes.log_handler = Logger.new(STDOUT)
25
- end
26
- end
27
-
28
- it 'Simple test' do
29
- eyes.open(app_name: 'Ruby SDK', test_name: 'Capybara test', driver: page,
30
- viewport_size: { width: 800, height: 600 })
31
- visit 'http://github.com'
32
- eyes.check_window('homepage')
33
- fill_in 'user[login]', with: 'user'
34
- eyes.check_window('homepage with username')
35
- eyes.close(false)
36
- end
37
-
38
- after :each do
39
- eyes.abort_if_not_closed
40
- end
41
- end
@@ -1,34 +0,0 @@
1
- require 'rspec'
2
- require 'sauce'
3
- require 'eyes_selenium'
4
-
5
- Sauce.config do |config|
6
- config[:browsers] = [
7
- ['OS X 10.10', 'chrome', '39.0']
8
- ]
9
- config[:start_tunnel] = false
10
- # config[:sauce_connect_4_executable] = '/path/to/sauce-connect/bin/sc'
11
- end
12
-
13
- describe 'A Saucy Example Group', sauce: true do
14
- let!(:eyes) do
15
- Applitools::Eyes.new.tap do |eyes|
16
- eyes.api_key = ENV['APPLITOOLS_API_KEY']
17
- eyes.log_handler = Logger.new(STDOUT)
18
- end
19
- end
20
-
21
- it 'Simple test' do
22
- eyes.test(app_name: 'Ruby SDK', test_name: 'Sauce plain test', driver: selenium,
23
- viewport_size: { width: 800, height: 600 }) do |driver|
24
- driver.get 'http://github.com'
25
- eyes.check_window('homepage')
26
- driver.find_element(:css, 'input[name="user[login]"]').send_keys 'user'
27
- eyes.check_window('homepage with username')
28
- end
29
- end
30
-
31
- after :each do
32
- eyes.abort_if_not_closed
33
- end
34
- end
@@ -1,23 +0,0 @@
1
- require_relative '../lib/eyes_selenium'
2
-
3
- require 'logger'
4
- require 'openssl'
5
- OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
6
-
7
- eyes = Applitools::Eyes.new
8
- eyes.api_key = ENV['APPLITOOLS_API_KEY']
9
- eyes.log_handler = Logger.new(STDOUT)
10
- # eyes.set_proxy('https://localhost:8888')
11
- begin
12
- web_driver = Selenium::WebDriver.for :chrome
13
-
14
- eyes.test(app_name: 'Ruby SDK', test_name: 'Applitools website test', viewport_size: { width: 900, height: 600 },
15
- driver: web_driver) do |driver|
16
- driver.get 'http://www.applitools.com'
17
- eyes.check_window('initial')
18
- pricing = driver.find_element(:css, '.pricing a')
19
- eyes.check_region(:element, pricing, 'pricing element')
20
- end
21
- ensure
22
- web_driver.quit
23
- end
@@ -1,26 +0,0 @@
1
- require 'rubygems'
2
- require 'watir'
3
- require 'eyes_selenium'
4
- require 'logger'
5
-
6
- require 'openssl'
7
- OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
8
-
9
- eyes = Applitools::Eyes.new
10
- eyes.api_key = ENV['APPLITOOLS_API_KEY']
11
- eyes.log_handler = Logger.new(STDOUT)
12
-
13
- browser = Watir::Browser.new :chrome
14
-
15
- begin
16
- eyes.test(app_name: 'Ruby SDK', test_name: 'Applitools website test', viewport_size: { width: 900, height: 600 },
17
- driver: browser) do |driver|
18
- driver.get 'http://www.applitools.com'
19
- eyes.check_window('initial')
20
- eyes.check_region(:css, '.pricing', 'Pricing button')
21
- driver.find_element(:css, '.pricing a').click
22
- eyes.check_window('pricing page')
23
- end
24
- ensure
25
- browser.quit
26
- end
@@ -1,89 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'applitools/version'
5
-
6
- CURRENT_RYBY_VERSION = Gem::Version.new RUBY_VERSION
7
-
8
- RUBY_1_9_3 = Gem::Version.new '1.9.3'
9
- RUBY_2_0_0 = Gem::Version.new '2.0.0'
10
- RUBY_2_2_2 = Gem::Version.new '2.2.2'
11
- RUBY_2_4_0 = Gem::Version.new '2.4.0'
12
-
13
- RUBY_KEY = [RUBY_1_9_3, RUBY_2_0_0, RUBY_2_2_2, RUBY_2_4_0].select { |v| v <= CURRENT_RYBY_VERSION }.last
14
-
15
- EYES_GEM_SPECS = {
16
- RUBY_1_9_3 => proc do |spec|
17
- spec.add_development_dependency 'mime-types', ['~> 2.99.0']
18
- spec.add_development_dependency 'rack', ['~> 1.6.0']
19
- spec.add_development_dependency 'tomlrb', ['<= 1.2.2']
20
- spec.add_development_dependency 'rubocop', ['~> 0.41.1']
21
- spec.add_development_dependency 'cmdparse', ['= 2.0.2']
22
- spec.add_development_dependency 'net-ssh', ['<= 3.0.0']
23
- spec.add_development_dependency 'net-http-persistent', ['< 3.0.0']
24
- spec.add_development_dependency 'sauce'
25
- spec.add_dependency 'nokogiri', '~> 1.6.0'
26
- spec.add_dependency 'public_suffix', '< 1.5.0'
27
- spec.add_dependency 'appium_lib', '< 9.1.0'
28
- spec.add_dependency 'oily_png', '~> 1.2'
29
- end,
30
- RUBY_2_0_0 => proc do |spec|
31
- spec.add_development_dependency 'rack', ['~> 1.6.0']
32
- spec.add_development_dependency 'rubocop', ['<= 0.46.0']
33
- spec.add_development_dependency 'net-http-persistent', ['< 3.0.0']
34
- spec.add_development_dependency 'sauce'
35
- spec.add_dependency 'nokogiri', '~> 1.6.0'
36
- spec.add_development_dependency 'appium_lib', '< 9.1.0'
37
- spec.add_dependency 'oily_png', '= 1.2.0'
38
- end,
39
- RUBY_2_2_2 => proc do |spec|
40
- spec.add_development_dependency 'rubocop', ['<= 0.46.0']
41
- spec.add_development_dependency 'sauce'
42
- spec.add_development_dependency 'appium_lib'
43
- spec.add_dependency 'oily_png', '~> 1.2'
44
- end,
45
- RUBY_2_4_0 => proc do |spec|
46
- spec.add_development_dependency 'appium_lib'
47
- spec.add_development_dependency 'rubocop', ['<= 0.46.0']
48
- spec.add_dependency 'oily_png', '~> 1.2'
49
- end
50
- }.freeze
51
-
52
- Gem::Specification.new do |spec|
53
- spec.name = 'eyes_selenium'
54
- spec.version = Applitools::VERSION
55
- spec.authors = ['Applitools Team']
56
- spec.email = ['team@applitools.com']
57
- spec.description = 'Applitools Ruby SDK'
58
- spec.summary = 'Applitools Ruby SDK'
59
- spec.homepage = 'https://www.applitools.com'
60
- spec.license = 'Apache License, Version 2.0'
61
-
62
- spec.files = `git ls-files`.split($RS)
63
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
64
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
65
- spec.require_paths = ['lib']
66
-
67
- spec.add_dependency 'selenium-webdriver'
68
- spec.add_dependency 'poltergeist', '~> 1.9'
69
- spec.add_dependency 'chunky_png', '= 1.3.6'
70
- spec.add_dependency 'faraday'
71
- spec.add_dependency 'oj'
72
- spec.add_dependency 'watir'
73
-
74
- spec.add_development_dependency 'bundler'
75
- spec.add_development_dependency 'rake'
76
- spec.add_development_dependency 'capybara'
77
- spec.add_development_dependency 'rspec', '>= 3'
78
-
79
- EYES_GEM_SPECS[RUBY_KEY].call spec
80
-
81
- # Exclude debugging support on Travis CI, due to its incompatibility with jruby and older rubies.
82
- unless ENV['TRAVIS'] || CURRENT_RYBY_VERSION < Gem::Version.new('2.0.0')
83
- spec.add_development_dependency 'pry'
84
- spec.add_development_dependency 'pry-byebug'
85
- spec.add_development_dependency 'byebug'
86
- spec.add_development_dependency 'pry-doc'
87
- spec.add_development_dependency 'pry-stack_explorer'
88
- end
89
- end
@@ -1,7 +0,0 @@
1
- if defined? Appium::Driver
2
- Appium::Driver.class_eval do
3
- def driver_for_eyes(eyes)
4
- Applitools::Selenium::Driver.new(eyes, driver: driver || start_driver, is_mobile_device: true)
5
- end
6
- end
7
- end
@@ -1,21 +0,0 @@
1
- require 'securerandom'
2
-
3
- module Applitools::Base
4
- class BatchInfo
5
- attr_accessor :name, :started_at, :id
6
-
7
- def initialize(name = nil, started_at = Time.now)
8
- @name = name
9
- @started_at = started_at
10
- @id = SecureRandom.uuid
11
- end
12
-
13
- def to_hash
14
- {
15
- id: @id,
16
- name: @name,
17
- started_at: @started_at.iso8601
18
- }
19
- end
20
- end
21
- end
@@ -1,36 +0,0 @@
1
- module Applitools::Base
2
- Dimension = Struct.new(:width, :height) do
3
- def to_hash
4
- {
5
- width: width,
6
- height: height
7
- }
8
- end
9
-
10
- def values
11
- [width, height]
12
- end
13
-
14
- def -(other)
15
- self.width -= other.width
16
- self.height -= other.height
17
- self
18
- end
19
-
20
- def +(other)
21
- self.width += other.width
22
- self.height += other.height
23
- self
24
- end
25
-
26
- def to_s
27
- values.to_s
28
- end
29
-
30
- class << self
31
- def for(other)
32
- new(other.width, other.height)
33
- end
34
- end
35
- end
36
- end
@@ -1,19 +0,0 @@
1
- module Applitools::Base
2
- class Environment
3
- def initialize(os = nil, hosting_app = nil, display_size = nil, inferred = nil)
4
- @os = os
5
- @hosting_app = hosting_app
6
- @display_size = display_size
7
- @inferred = inferred
8
- end
9
-
10
- def to_hash
11
- {
12
- os: @os,
13
- hosting_app: @hosting_app,
14
- display_size: @display_size.to_hash,
15
- inferred: @inferred
16
- }
17
- end
18
- end
19
- end