testnow 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/LICENCE +20 -20
- data/README.md +213 -197
- data/Rakefile +8 -8
- data/bin/testnow +287 -287
- data/data/firebug-2.0.13.xpi +0 -0
- data/data/netExport-0.8.xpi +0 -0
- data/data/showtime/Gemfile +5 -5
- data/data/showtime/Gemfile_rspec +4 -4
- data/data/showtime/Rakefile +4 -4
- data/data/showtime/Rakefile_rspec +7 -7
- data/data/showtime/env.rb +7 -7
- data/data/showtime/github.feature +11 -11
- data/data/showtime/github_page.rb +29 -33
- data/data/showtime/github_spec.rb +17 -17
- data/data/showtime/github_steps.rb +23 -23
- data/data/showtime/hooks.rb +39 -39
- data/data/showtime/spec_helper.rb +20 -20
- data/data/showtime/watir/Gemfile +6 -6
- data/data/showtime/watir/Gemfile_rspec +6 -6
- data/data/showtime/watir/env.rb +8 -8
- data/data/showtime/watir/github_page.rb +28 -32
- data/data/showtime/watir/github_spec.rb +17 -17
- data/data/showtime/watir/github_steps.rb +23 -23
- data/data/showtime/watir/hooks.rb +39 -39
- data/data/showtime/watir/spec_helper.rb +21 -21
- data/lib/testnow.rb +78 -79
- data/lib/testnow/android_chrome.rb +26 -26
- data/lib/testnow/chrome.rb +47 -22
- data/lib/testnow/edge.rb +34 -34
- data/lib/testnow/firefox.rb +54 -54
- data/lib/testnow/firefox_gecko.rb +30 -30
- data/lib/testnow/ie.rb +45 -45
- data/lib/testnow/opera.rb +45 -41
- data/lib/testnow/version +1 -1
- data/spec/spec_helper.rb +5 -0
- data/spec/testnow/testnow_spec.rb +48 -0
- metadata +22 -18
- data/lib/testnow/android.rb +0 -8
data/lib/testnow/edge.rb
CHANGED
@@ -1,35 +1,35 @@
|
|
1
|
-
class MicrosoftEdge
|
2
|
-
|
3
|
-
@private
|
4
|
-
def pre_config
|
5
|
-
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
-
@client.
|
7
|
-
@caps = Selenium::WebDriver::Remote::Capabilities.edge(:native_events => false,
|
8
|
-
:acceptSslCerts => true)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
driver.manage.timeouts.
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
:
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
:
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
1
|
+
class MicrosoftEdge
|
2
|
+
|
3
|
+
@private
|
4
|
+
def pre_config
|
5
|
+
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
+
@client.read_timeout = 120
|
7
|
+
@caps = Selenium::WebDriver::Remote::Capabilities.edge(:native_events => false,
|
8
|
+
:acceptSslCerts => true)
|
9
|
+
end
|
10
|
+
|
11
|
+
@private
|
12
|
+
def post_config(driver)
|
13
|
+
driver.manage.timeouts.implicit_wait = 30
|
14
|
+
driver.manage.timeouts.page_load = 120
|
15
|
+
end
|
16
|
+
|
17
|
+
def launch_driver_edge
|
18
|
+
self.pre_config
|
19
|
+
driver = Selenium::WebDriver.for(:edge,
|
20
|
+
:desired_capabilities => @caps,
|
21
|
+
:http_client => @client)
|
22
|
+
self.post_config(driver)
|
23
|
+
return driver
|
24
|
+
end
|
25
|
+
|
26
|
+
def launch_watir_edge
|
27
|
+
self.pre_config
|
28
|
+
browser = Watir::Browser.new(:edge,
|
29
|
+
:desired_capabilities => @caps,
|
30
|
+
:http_client => @client)
|
31
|
+
self.post_config(browser.driver)
|
32
|
+
return browser
|
33
|
+
end
|
34
|
+
|
35
35
|
end
|
data/lib/testnow/firefox.rb
CHANGED
@@ -1,55 +1,55 @@
|
|
1
|
-
# module TestNow
|
2
|
-
class Firefox
|
3
|
-
|
4
|
-
#Firefox browser
|
5
|
-
def launch_driver_firefox
|
6
|
-
caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette
|
7
|
-
ENV['IS_UPA'] = "false" if ENV['IS_UPA'].nil?
|
8
|
-
if ENV['IS_UPA']=="true"
|
9
|
-
ENV['HAR_DIR'] = get_tmp_dir if ENV['HAR_DIR'].nil?
|
10
|
-
puts "=>=>=> Your HAR (UPA) files will be created here : #{ENV['HAR_DIR']}"
|
11
|
-
firebug = File.absolute_path(File.dirname(__FILE__)+"/../../data/firebug-2.0.13.xpi")
|
12
|
-
net_export = File.absolute_path(File.dirname(__FILE__)+"/../../data/netExport-0.8.xpi")
|
13
|
-
profile = Selenium::WebDriver::Firefox::Profile.new
|
14
|
-
profile.add_extension(firebug)
|
15
|
-
profile.add_extension(net_export)
|
16
|
-
profile['extensions.firebug.currentVersion'] = "2.0.13"
|
17
|
-
profile['extensions.firebug.allPagesActivation'] = "on"
|
18
|
-
profile['extensions.firebug.defaultPanelName'] = "net"
|
19
|
-
profile['extensions.firebug.net.enableSites'] = "true"
|
20
|
-
profile['extensions.firebug.netexport.alwaysEnableAutoExport'] = "true"
|
21
|
-
profile['extensions.firebug.netexport.showPreview'] = "false"
|
22
|
-
profile['extensions.firebug.netexport.defaultLogDir'] = ENV['HAR_DIR'].to_s
|
23
|
-
profile['extensions.firebug.netexport.defaultFileName'] = "upaReport.har"
|
24
|
-
profile['extensions.firebug.netexport.jsonpCallback'] = "jsonCallback"
|
25
|
-
driver = Selenium::WebDriver.for(:firefox, :profile => profile, :desired_cpabilities => caps)
|
26
|
-
else
|
27
|
-
driver = Selenium::WebDriver.for(:firefox, :desired_cpabilities => caps)
|
28
|
-
end
|
29
|
-
driver.manage.timeouts.implicit_wait = 30
|
30
|
-
driver.manage.timeouts.page_load = 120
|
31
|
-
driver.manage.window.maximize
|
32
|
-
driver
|
33
|
-
end
|
34
|
-
|
35
|
-
def get_tmp_dir
|
36
|
-
case RUBY_PLATFORM
|
37
|
-
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
38
|
-
return `echo %TEMP%`
|
39
|
-
when /darwin|mac os/
|
40
|
-
return "/tmp/"
|
41
|
-
else
|
42
|
-
return "/tmp/"
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
def launch_watir_firefox
|
47
|
-
caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette
|
48
|
-
browser = Watir::Browser.new(:firefox, :desired_capabilities => caps)
|
49
|
-
browser.driver.manage.timeouts.implicit_wait = 30
|
50
|
-
browser.driver.manage.timeouts.page_load = 120
|
51
|
-
browser.driver.manage.window.maximize
|
52
|
-
return browser
|
53
|
-
end
|
54
|
-
|
1
|
+
# module TestNow
|
2
|
+
class Firefox
|
3
|
+
|
4
|
+
#Firefox browser
|
5
|
+
def launch_driver_firefox
|
6
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:marionette => false)
|
7
|
+
ENV['IS_UPA'] = "false" if ENV['IS_UPA'].nil?
|
8
|
+
if ENV['IS_UPA']=="true"
|
9
|
+
ENV['HAR_DIR'] = get_tmp_dir if ENV['HAR_DIR'].nil?
|
10
|
+
puts "=>=>=> Your HAR (UPA) files will be created here : #{ENV['HAR_DIR']}"
|
11
|
+
firebug = File.absolute_path(File.dirname(__FILE__)+"/../../data/firebug-2.0.13.xpi")
|
12
|
+
net_export = File.absolute_path(File.dirname(__FILE__)+"/../../data/netExport-0.8.xpi")
|
13
|
+
profile = Selenium::WebDriver::Firefox::Profile.new
|
14
|
+
profile.add_extension(firebug)
|
15
|
+
profile.add_extension(net_export)
|
16
|
+
profile['extensions.firebug.currentVersion'] = "2.0.13"
|
17
|
+
profile['extensions.firebug.allPagesActivation'] = "on"
|
18
|
+
profile['extensions.firebug.defaultPanelName'] = "net"
|
19
|
+
profile['extensions.firebug.net.enableSites'] = "true"
|
20
|
+
profile['extensions.firebug.netexport.alwaysEnableAutoExport'] = "true"
|
21
|
+
profile['extensions.firebug.netexport.showPreview'] = "false"
|
22
|
+
profile['extensions.firebug.netexport.defaultLogDir'] = ENV['HAR_DIR'].to_s
|
23
|
+
profile['extensions.firebug.netexport.defaultFileName'] = "upaReport.har"
|
24
|
+
profile['extensions.firebug.netexport.jsonpCallback'] = "jsonCallback"
|
25
|
+
driver = Selenium::WebDriver.for(:firefox, :profile => profile, :desired_cpabilities => caps)
|
26
|
+
else
|
27
|
+
driver = Selenium::WebDriver.for(:firefox, :desired_cpabilities => caps)
|
28
|
+
end
|
29
|
+
driver.manage.timeouts.implicit_wait = 30
|
30
|
+
driver.manage.timeouts.page_load = 120
|
31
|
+
driver.manage.window.maximize
|
32
|
+
driver
|
33
|
+
end
|
34
|
+
|
35
|
+
def get_tmp_dir
|
36
|
+
case RUBY_PLATFORM
|
37
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
38
|
+
return `echo %TEMP%`
|
39
|
+
when /darwin|mac os/
|
40
|
+
return "/tmp/"
|
41
|
+
else
|
42
|
+
return "/tmp/"
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
def launch_watir_firefox
|
47
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:marionette => false)
|
48
|
+
browser = Watir::Browser.new(:firefox, :desired_capabilities => caps)
|
49
|
+
browser.driver.manage.timeouts.implicit_wait = 30
|
50
|
+
browser.driver.manage.timeouts.page_load = 120
|
51
|
+
browser.driver.manage.window.maximize
|
52
|
+
return browser
|
53
|
+
end
|
54
|
+
|
55
55
|
end
|
@@ -1,31 +1,31 @@
|
|
1
|
-
class FirefoxGecko
|
2
|
-
|
3
|
-
@private
|
4
|
-
def pre_config
|
5
|
-
caps = Selenium::WebDriver::Remote::Capabilities.firefox(marionette
|
6
|
-
caps
|
7
|
-
end
|
8
|
-
|
9
|
-
@private
|
10
|
-
def post_config(driver)
|
11
|
-
driver.manage.timeouts.implicit_wait = 10
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
# Firefox Gecko Browser
|
17
|
-
def launch_driver_firefox_gecko
|
18
|
-
caps = self.pre_config
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
end
|
23
|
-
|
24
|
-
def launch_watir_firefox_gecko
|
25
|
-
caps = self.pre_config
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
end
|
30
|
-
|
1
|
+
class FirefoxGecko
|
2
|
+
|
3
|
+
@private
|
4
|
+
def pre_config
|
5
|
+
caps = Selenium::WebDriver::Remote::Capabilities.firefox(:marionette => true)
|
6
|
+
caps
|
7
|
+
end
|
8
|
+
|
9
|
+
@private
|
10
|
+
def post_config(driver)
|
11
|
+
driver.manage.timeouts.implicit_wait = 10
|
12
|
+
# driver.manage.timeouts.page_load = 15
|
13
|
+
driver.manage.window.maximize
|
14
|
+
end
|
15
|
+
|
16
|
+
# Firefox Gecko Browser
|
17
|
+
def launch_driver_firefox_gecko
|
18
|
+
caps = self.pre_config
|
19
|
+
driver = Selenium::WebDriver.for(:firefox, :desired_capabilities => caps)
|
20
|
+
self.post_config(driver)
|
21
|
+
driver
|
22
|
+
end
|
23
|
+
|
24
|
+
def launch_watir_firefox_gecko
|
25
|
+
caps = self.pre_config
|
26
|
+
browser = Watir::Browser.new(:firefox, :desired_capabilities => caps)
|
27
|
+
self.post_config(browser.driver)
|
28
|
+
browser
|
29
|
+
end
|
30
|
+
|
31
31
|
end
|
data/lib/testnow/ie.rb
CHANGED
@@ -1,46 +1,46 @@
|
|
1
|
-
class IE
|
2
|
-
|
3
|
-
@private
|
4
|
-
def ie_config
|
5
|
-
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
-
@client.
|
7
|
-
@caps = Selenium::WebDriver::Remote::Capabilities.ie('ie.ensureCleanSession' => true,
|
8
|
-
:javascript_enabled => true,
|
9
|
-
:http_client => @client,
|
10
|
-
:native_events => false,
|
11
|
-
:acceptSslCerts => true)
|
12
|
-
end
|
13
|
-
|
14
|
-
@private
|
15
|
-
def set_ie_config(driver)
|
16
|
-
driver.manage.timeouts.implicit_wait = 90
|
17
|
-
driver.manage.timeouts.page_load = 120
|
18
|
-
if ENV['RESOLUTION'].nil?
|
19
|
-
driver.manage.window.size = Selenium::WebDriver::Dimension.new(1366,768)
|
20
|
-
elsif ENV['RESOLUTION'].downcase == "max"
|
21
|
-
driver.manage.window.maximize
|
22
|
-
else
|
23
|
-
res = ENV['RESOLUTION'].split('x')
|
24
|
-
driver.manage.window.size = Selenium::WebDriver::Dimension.new(res.first.to_i, res.last.to_i)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def launch_driver_ie
|
29
|
-
self.ie_config
|
30
|
-
driver = Selenium::WebDriver.for(:ie,
|
31
|
-
:desired_capabilities => @caps,
|
32
|
-
:http_client => @client)
|
33
|
-
self.set_ie_config(driver)
|
34
|
-
return driver
|
35
|
-
end
|
36
|
-
|
37
|
-
def launch_watir_ie
|
38
|
-
self.ie_config
|
39
|
-
browser = Watir::Browser.new(:ie,
|
40
|
-
:desired_capabilities => @caps,
|
41
|
-
:http_client => @client)
|
42
|
-
self.set_ie_config(browser.driver)
|
43
|
-
return browser
|
44
|
-
end
|
45
|
-
|
1
|
+
class IE
|
2
|
+
|
3
|
+
@private
|
4
|
+
def ie_config
|
5
|
+
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
+
@client.read_timeout = 120
|
7
|
+
@caps = Selenium::WebDriver::Remote::Capabilities.ie('ie.ensureCleanSession' => true,
|
8
|
+
:javascript_enabled => true,
|
9
|
+
:http_client => @client,
|
10
|
+
:native_events => false,
|
11
|
+
:acceptSslCerts => true)
|
12
|
+
end
|
13
|
+
|
14
|
+
@private
|
15
|
+
def set_ie_config(driver)
|
16
|
+
driver.manage.timeouts.implicit_wait = 90
|
17
|
+
driver.manage.timeouts.page_load = 120
|
18
|
+
if ENV['RESOLUTION'].nil?
|
19
|
+
driver.manage.window.size = Selenium::WebDriver::Dimension.new(1366,768)
|
20
|
+
elsif ENV['RESOLUTION'].downcase == "max"
|
21
|
+
driver.manage.window.maximize
|
22
|
+
else
|
23
|
+
res = ENV['RESOLUTION'].split('x')
|
24
|
+
driver.manage.window.size = Selenium::WebDriver::Dimension.new(res.first.to_i, res.last.to_i)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def launch_driver_ie
|
29
|
+
self.ie_config
|
30
|
+
driver = Selenium::WebDriver.for(:ie,
|
31
|
+
:desired_capabilities => @caps,
|
32
|
+
:http_client => @client)
|
33
|
+
self.set_ie_config(driver)
|
34
|
+
return driver
|
35
|
+
end
|
36
|
+
|
37
|
+
def launch_watir_ie
|
38
|
+
self.ie_config
|
39
|
+
browser = Watir::Browser.new(:ie,
|
40
|
+
:desired_capabilities => @caps,
|
41
|
+
:http_client => @client)
|
42
|
+
self.set_ie_config(browser.driver)
|
43
|
+
return browser
|
44
|
+
end
|
45
|
+
|
46
46
|
end
|
data/lib/testnow/opera.rb
CHANGED
@@ -1,42 +1,46 @@
|
|
1
|
-
class Opera
|
2
|
-
|
3
|
-
@private
|
4
|
-
def
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
end
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
self.
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
return "
|
40
|
-
|
41
|
-
|
1
|
+
class Opera
|
2
|
+
|
3
|
+
@private
|
4
|
+
def pre_config
|
5
|
+
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
+
@client.read_timeout = 180 # seconds
|
7
|
+
@service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/operadriver", 48923, {})
|
8
|
+
@service.start
|
9
|
+
@cap = Selenium::WebDriver::Remote::Capabilities.chrome('operaOptions' => {'binary' => "#{get_binary_path}", 'args' => ["--ignore-certificate-errors"]})
|
10
|
+
end
|
11
|
+
|
12
|
+
@private
|
13
|
+
def post_config(driver)
|
14
|
+
driver.manage.timeouts.implicit_wait = 30
|
15
|
+
driver.manage.window.maximize
|
16
|
+
driver.manage.timeouts.page_load = 120
|
17
|
+
end
|
18
|
+
|
19
|
+
# Opera browser
|
20
|
+
def launch_driver_opera
|
21
|
+
self.pre_config
|
22
|
+
driver = Selenium::WebDriver.for(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
|
23
|
+
self.post_config(driver)
|
24
|
+
return driver
|
25
|
+
end
|
26
|
+
|
27
|
+
# Opera browser
|
28
|
+
def launch_watir_opera
|
29
|
+
self.pre_config
|
30
|
+
browser = Watir::Browser.new(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
|
31
|
+
self.post_config(browser.driver)
|
32
|
+
return browser
|
33
|
+
end
|
34
|
+
|
35
|
+
@private
|
36
|
+
def get_binary_path
|
37
|
+
case RUBY_PLATFORM
|
38
|
+
when /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
39
|
+
return "NEED TO FIND WINDOWS BINARY LOCATION"
|
40
|
+
when /darwin|mac os/
|
41
|
+
return "/Applications/Opera.app/Contents/MacOS/Opera"
|
42
|
+
else
|
43
|
+
return "/usr/bin/opera"
|
44
|
+
end
|
45
|
+
end
|
42
46
|
end
|
data/lib/testnow/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
|
4
|
+
describe "Test TestNow" do
|
5
|
+
it "should start chrome" do
|
6
|
+
ENV['BROWSER']='chrome'
|
7
|
+
driver = TestNow.init
|
8
|
+
expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
|
9
|
+
expect(driver.inspect.to_s.downcase).to include("chrome")
|
10
|
+
driver.quit
|
11
|
+
end
|
12
|
+
|
13
|
+
it "should start opera" do
|
14
|
+
ENV['BROWSER']='opera'
|
15
|
+
driver = TestNow.init
|
16
|
+
expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
|
17
|
+
expect(driver.inspect.to_s.downcase).to include("chrome")
|
18
|
+
driver.quit
|
19
|
+
end
|
20
|
+
|
21
|
+
it "should start firefox when BROWSER is set" do
|
22
|
+
ENV['BROWSER']='firefox'
|
23
|
+
driver = TestNow.init
|
24
|
+
expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
|
25
|
+
expect(driver.inspect.to_s.downcase).to include("firefox")
|
26
|
+
driver.quit
|
27
|
+
end
|
28
|
+
|
29
|
+
it "should start firefox as default when BROWSER is not set" do
|
30
|
+
driver = TestNow.init
|
31
|
+
expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
|
32
|
+
expect(driver.inspect.to_s.downcase).to include("firefox")
|
33
|
+
driver.quit
|
34
|
+
end
|
35
|
+
|
36
|
+
it "should start firefox with UPA config when HAR_DIR is set" do
|
37
|
+
ENV['HAR_DIR']="/Users/KaushalRupani/Downloads/"
|
38
|
+
ENV['IS_UPA']="true"
|
39
|
+
`rm -f $HAR_DIR*.har`
|
40
|
+
driver = TestNow.init
|
41
|
+
expect(driver).to be_an_instance_of Selenium::WebDriver::Driver
|
42
|
+
expect(driver.inspect.to_s.downcase).to include("firefox")
|
43
|
+
sleep(5)
|
44
|
+
driver.get("http://google.com")
|
45
|
+
expect(`ls $HAR_DIR*.har`).to_not be_nil
|
46
|
+
driver.quit
|
47
|
+
end
|
48
|
+
end
|