browza 0.0.4 → 0.0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/examples/fox.proxy.rb +42 -5
- data/lib/browza/base/manager.rb +91 -6
- data/lib/browza/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b18c180cdb6ad2b3808f22a7b8b61c92c5daed
|
4
|
+
data.tar.gz: dd58e4eeb7a809d848142ae368e9fd3dfa042f35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f8fbbf83d3df9c6f04b6ad2410497ec18a2e7e2feb67b69eb462690f33fdbd55c8c4872859a33db08662e1eca6f2a480eeffdbf92092f81535ebdd6ed7f0d9d
|
7
|
+
data.tar.gz: e010c384dc964bb0f7568752299e77f8e94bf67dab343f6ee7dd19e85e8fb5e4d674099431889ae1023a2347743e2ad3b8ee743057fb71a942496bb0715909be
|
data/README.md
CHANGED
data/examples/fox.proxy.rb
CHANGED
@@ -1,12 +1,49 @@
|
|
1
1
|
|
2
2
|
require 'selenium-webdriver'
|
3
3
|
|
4
|
+
def chromeProxy
|
5
|
+
proxy='127.0.0.1:8080'
|
6
|
+
# caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => [ "--disable-web-security" ]})
|
7
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome("chromeOptions" => {"args" => ["--proxy-server=#{proxy}"]})
|
8
|
+
driver = Selenium::WebDriver.for :chrome, desired_capabilities: caps
|
9
|
+
end
|
4
10
|
|
5
|
-
profile = Selenium::WebDriver::Firefox::Profile.new
|
6
|
-
proxy = Selenium::WebDriver::Proxy.new(http: "127.0.0.:8080")
|
7
|
-
profile.proxy = proxy
|
8
|
-
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
9
|
-
driver = Selenium::WebDriver.for :firefox, options: options
|
10
11
|
|
11
12
|
|
12
13
|
|
14
|
+
def firefoxProxy
|
15
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
16
|
+
proxy = Selenium::WebDriver::Proxy.new(http: "127.0.0.1:8080")
|
17
|
+
profile.proxy = proxy
|
18
|
+
|
19
|
+
puts "Proxy => #{profile.methods.sort}"
|
20
|
+
|
21
|
+
proxySSL = Selenium::WebDriver::Proxy.new(http: "127.0.0.1:8080", ssl: "127.0.0.1:8080")
|
22
|
+
profile.proxy = proxySSL
|
23
|
+
|
24
|
+
options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
25
|
+
driver = Selenium::WebDriver.for :firefox, options: options
|
26
|
+
driver.navigate.to 'https://msprqa3.concurtech.net'
|
27
|
+
end
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
def ff
|
32
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(proxy: Selenium::WebDriver::Proxy.new(http: "127.0.0.1:8080"))
|
33
|
+
# driver = Selenium::WebDriver.for :remote, desired_capabilities: caps
|
34
|
+
|
35
|
+
driver = Selenium::WebDriver.for :firefox, :desired_capabilities => caps
|
36
|
+
end
|
37
|
+
|
38
|
+
driver=ff()
|
39
|
+
#driver=chromeProxy()
|
40
|
+
|
41
|
+
begin
|
42
|
+
driver.navigate.to 'https://msprqa3.concurtech.net'
|
43
|
+
rescue => ex
|
44
|
+
;
|
45
|
+
end
|
46
|
+
|
47
|
+
STDIN.gets
|
48
|
+
driver.close()
|
49
|
+
driver.quit()
|
data/lib/browza/base/manager.rb
CHANGED
@@ -3,6 +3,7 @@ require 'singleton'
|
|
3
3
|
require 'appmodel'
|
4
4
|
require 'logging'
|
5
5
|
require 'sauce_whisk'
|
6
|
+
require 'eyes_selenium'
|
6
7
|
|
7
8
|
module Browza
|
8
9
|
|
@@ -18,6 +19,8 @@ class Manager
|
|
18
19
|
attr_accessor :driverList
|
19
20
|
attr_accessor :browserMgr
|
20
21
|
attr_accessor :debug
|
22
|
+
attr_accessor :eyes
|
23
|
+
attr_accessor :eyesOptions
|
21
24
|
|
22
25
|
def initialize(_logLevel = :warn)
|
23
26
|
@debug = false
|
@@ -28,10 +31,24 @@ class Manager
|
|
28
31
|
@appModels=[]
|
29
32
|
@defaultRetries = 2
|
30
33
|
@browserMgr = Browza::BrowzaMgr.new()
|
34
|
+
@eyes = nil
|
35
|
+
@eyesOptions = { :appName => ENV['EYES_APPNAME'], :testName => ENV['EYES_TESTNAME'] }
|
36
|
+
end
|
37
|
+
|
38
|
+
def setAppName(s)
|
39
|
+
@eyesOptions[:appName] = s
|
40
|
+
end
|
41
|
+
|
42
|
+
def setTestName(s)
|
43
|
+
@eyesOptions[:testName] = s
|
31
44
|
end
|
32
45
|
|
33
46
|
def setDebug(b)
|
34
47
|
@debug = b
|
48
|
+
|
49
|
+
if b
|
50
|
+
@logger.level = :debug
|
51
|
+
end
|
35
52
|
end
|
36
53
|
|
37
54
|
def _addDriver(d)
|
@@ -186,7 +203,7 @@ class Manager
|
|
186
203
|
i=0
|
187
204
|
@driverList.each do |b|
|
188
205
|
target_size = Selenium::WebDriver::Dimension.new(width.to_i, height.to_i)
|
189
|
-
if b[:drv] && (b[:drv].is_a?(Selenium::WebDriver) || b[:drv].is_a?(Selenium::WebDriver::Driver))
|
206
|
+
if b[:drv] && (b[:drv].is_a?(Selenium::WebDriver) || b[:drv].is_a?(Selenium::WebDriver::Driver) || b.has_key?(:id))
|
190
207
|
b[:drv].manage.window.size = target_size
|
191
208
|
else
|
192
209
|
@logger.warn __FILE__ + (__LINE__).to_s + " Attempt to access driver failed. (#{b})"
|
@@ -250,6 +267,19 @@ class Manager
|
|
250
267
|
|
251
268
|
timeout = nil
|
252
269
|
|
270
|
+
if ENV['SELENIUM_EYES']
|
271
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " Enable EYES"
|
272
|
+
@eyes = Applitools::Selenium::Eyes.new()
|
273
|
+
@eyes.api_key = ENV['APPLITOOLS_API_KEY']
|
274
|
+
@eyes.force_full_page_screenshot = true
|
275
|
+
@eyes.stitch_mode = :css
|
276
|
+
@eyes.match_level = :strict
|
277
|
+
@eyes.match_timeout = 8
|
278
|
+
batch = Applitools::BatchInfo.new('DEMO_COREUI_HIGX')
|
279
|
+
batch.id = 'DEC17'
|
280
|
+
@eyes.batch = batch
|
281
|
+
end
|
282
|
+
|
253
283
|
if ENV['SELENIUM_RESOLUTION']
|
254
284
|
@logger.debug " SELENIUM_RESOLUTION=#{ENV['SELENIUM_RESOLUTION']}" if @debug
|
255
285
|
_width = ENV['SELENIUM_RESOLUTION'].match(/\s*(\d+)\s*x\s*(\d+)\s*$/)[1].to_s
|
@@ -335,7 +365,24 @@ class Manager
|
|
335
365
|
|
336
366
|
begin
|
337
367
|
if timeout.nil? && ENV['SELENIUM_PROXY'].nil?
|
338
|
-
|
368
|
+
|
369
|
+
if @eyes.nil?
|
370
|
+
@drv = Selenium::WebDriver.for @browserType
|
371
|
+
else
|
372
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " Create eyes: widthxheight: #{_width} by #{_height}"
|
373
|
+
_driver = Selenium::WebDriver.for @browserType
|
374
|
+
|
375
|
+
if @eyes
|
376
|
+
@drv = @eyes.open(
|
377
|
+
app_name: @eyesOptions[:appName],
|
378
|
+
test_name: @eyesOptions[:testName],
|
379
|
+
viewport_size: {width: _width.to_i, height: _height.to_i},
|
380
|
+
driver: _driver
|
381
|
+
)
|
382
|
+
end
|
383
|
+
|
384
|
+
end
|
385
|
+
|
339
386
|
else
|
340
387
|
|
341
388
|
if ENV['SELENIUM_PROXY']
|
@@ -344,16 +391,38 @@ class Manager
|
|
344
391
|
@logger.debug "createBrowser() with proxy: #{ENV['SELENIUM_PROXY']}"
|
345
392
|
|
346
393
|
profile = Selenium::WebDriver::Firefox::Profile.new
|
394
|
+
|
395
|
+
# Selenium::WebDriver::Proxy.new(http: "127.0.0.1:8080")
|
347
396
|
proxy = Selenium::WebDriver::Proxy.new(http: "#{ENV['SELENIUM_PROXY']}")
|
348
|
-
|
349
|
-
|
350
|
-
|
397
|
+
# profile.proxy = proxy
|
398
|
+
# options = Selenium::WebDriver::Firefox::Options.new(profile: profile)
|
399
|
+
|
400
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(proxy: proxy)
|
401
|
+
|
402
|
+
|
403
|
+
# @drv = Selenium::WebDriver.for :firefox, options: options
|
404
|
+
|
405
|
+
@drv = Selenium::WebDriver.for :firefox, :desired_capabilities => caps
|
351
406
|
end
|
352
407
|
|
353
408
|
elsif
|
354
409
|
client = Selenium::WebDriver::Remote::Http::Default.new
|
355
410
|
client.read_timeout = timeout.to_i
|
356
|
-
|
411
|
+
|
412
|
+
if @eyes.nil?
|
413
|
+
@drv = Selenium::WebDriver.for @browserType, http_client: client
|
414
|
+
else
|
415
|
+
|
416
|
+
@logger.debug __FILE__ + (__LINE__).to_s + " Create eyes"; STDIN.gets
|
417
|
+
_driver = Selenium::WebDriver.for @browserType, http_client: client
|
418
|
+
@drv = @eyes.open(
|
419
|
+
app_name: @eyesOptions[:appName],
|
420
|
+
test_name: @eyesOptions[:testName],
|
421
|
+
viewport_size: {width: _width, height: _height},
|
422
|
+
driver: _driver
|
423
|
+
)
|
424
|
+
end
|
425
|
+
|
357
426
|
end
|
358
427
|
|
359
428
|
puts __FILE__ + (__LINE__).to_s + " Set NET::TIMEOUT to #{timeout.to_s}"
|
@@ -406,6 +475,11 @@ class Manager
|
|
406
475
|
|
407
476
|
def quit(id=nil)
|
408
477
|
|
478
|
+
if @eyes
|
479
|
+
eyesResults = @eyes.close(false)
|
480
|
+
puts __FILE__ + (__LINE__).to_s + " Eyes => #{eyesResults.to_s}"
|
481
|
+
end
|
482
|
+
|
409
483
|
if id.nil?
|
410
484
|
@browserMgr.getBrowsers().each do |b|
|
411
485
|
|
@@ -1537,6 +1611,17 @@ class Manager
|
|
1537
1611
|
end
|
1538
1612
|
|
1539
1613
|
|
1614
|
+
|
1615
|
+
def checkWindow(tag, region = nil)
|
1616
|
+
if @eyes
|
1617
|
+
@eyes.force_full_page_screenshot = true
|
1618
|
+
@eyes.stitch_mode = :css
|
1619
|
+
@eyes.match_level = :strict
|
1620
|
+
@eyes.check_window(tag.to_s)
|
1621
|
+
end
|
1622
|
+
|
1623
|
+
end
|
1624
|
+
|
1540
1625
|
end
|
1541
1626
|
|
1542
1627
|
|
data/lib/browza/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browza
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.4
|
4
|
+
version: 0.0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- H20Dragon
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-01-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|