testnow 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +26 -4
- data/bin/testnow +2 -2
- data/data/showtime/github_page.rb +5 -1
- data/data/showtime/watir/github_page.rb +5 -1
- data/lib/testnow.rb +45 -33
- data/lib/testnow/chrome.rb +13 -10
- data/lib/testnow/edge.rb +34 -0
- data/lib/testnow/ie.rb +11 -3
- data/lib/testnow/version +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 247840ac5fda0abd6723d5df2c713d41c4ae8060
|
4
|
+
data.tar.gz: e3e48f2a6da8a4e1f8369e83a66382f15c5db60a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70e43a892be509d03ff810286c9385ebe33345970d776f93db54fa0a0fdfed354b937da9bca83b48c6d6f6c771495a225f550ae1494e18879dc86d25bb192afc
|
7
|
+
data.tar.gz: ef17fbab537db6d460d5c8c15180ea1d1065e15ed75cc84246ad3c3b8a70cbe42d452517fa329814ee53929f948b2deb603e4e0866c9c354664ba77f51779f05
|
data/README.md
CHANGED
@@ -2,6 +2,9 @@
|
|
2
2
|
|
3
3
|
An instant WebDriver-Ruby-Cucumber or WebDriver-Ruby-RSpec framework which has ability to do cross browser testing on any of the popular browsers, Firefox, Chrome, Opera, Internet Explorer, Safari, Android Browser. It uses the selenium-webdriver to driver the browsers already installed on your box.
|
4
4
|
|
5
|
+
[NOTE] -- This gem does not provide any webdrivers or install any browsers, it is related to browser configuration and framework generation. For the tests to run, browsers should be installed and webdrivers should be present in the path variable.
|
6
|
+
|
7
|
+
|
5
8
|
## Table of Contents
|
6
9
|
- [Installation](#installation)
|
7
10
|
- [Install using gem command](#gem)
|
@@ -17,7 +20,9 @@ An instant WebDriver-Ruby-Cucumber or WebDriver-Ruby-RSpec framework which has a
|
|
17
20
|
- [Variables](#variables)
|
18
21
|
- [BROWSER](#browser)
|
19
22
|
- [TEST_URL](#test-url)
|
20
|
-
- [
|
23
|
+
- [Browsers](#browsers)
|
24
|
+
- [Contributing](#contributing)
|
25
|
+
- [Issues](#issues)
|
21
26
|
|
22
27
|
|
23
28
|
|
@@ -70,10 +75,11 @@ now as everything is required, included and ready, just put the following comman
|
|
70
75
|
TestNow gem uses the environment variable __BROWSER__ to detect which browser to initialize. If no value is set for this variable then firefox will be initialized by default.
|
71
76
|
|
72
77
|
### <a name="cli"></a> 2. Command Line Tool -- testnow command
|
73
|
-
When you install testnow gem, it installs a command line tool which helps you to create automation frameworks with cross browser configuration in a jiffy.
|
78
|
+
When you install testnow gem, it installs a command line tool which helps you to create automation frameworks with cross browser configuration in a jiffy.
|
74
79
|
This command line tool has multiple command and can be seen using help
|
75
80
|
Following are the list of commands:
|
76
|
-
|
81
|
+
|
82
|
+
![help, version, cucumber_now, rspec_now, watir_cucumber_now, watir_rspec_now] (/images/commands.png)
|
77
83
|
|
78
84
|
|
79
85
|
|
@@ -170,6 +176,22 @@ For Example:
|
|
170
176
|
rake testnow BROWSER=chrome TEST_URL=https://github.com
|
171
177
|
```
|
172
178
|
|
179
|
+
## Browsers
|
180
|
+
As mentioned in the above section that there is a variable exposed called _BROWSER_ but what are the values to be passed and which OS-Browsers combinations are supported, well here is a index grid below:
|
181
|
+
|
182
|
+
| OS | Chrome | Firefox (v47-) | Firefox Gecko (v48+) | IE 11/10 | Edge | Opera | PhantomJS | Chrome Mobile[2] |
|
183
|
+
|---|---|---|---|---|---|---|---|---|
|
184
|
+
| Linux | Supported | Supported | Coming Soon! | N/A | N/A | Supported[1] | Coming Soon! | Coming Soon! |
|
185
|
+
| Mac | Supported | Supported | Coming Soon! | N/A | N/A | Supported[1] | Coming Soon! | Coming Soon! |
|
186
|
+
| Windows | Supported | Supported | Coming Soon! | Supported | Supported[3]| Coming Soon! | Coming Soon! | Coming Soon! |
|
187
|
+
|
188
|
+
Note:
|
189
|
+
[1] Currently it is expected that the Opera webdriver binary is present inside "/usr/local/bin/operadriver, soon this path will be made customizable and exposaed as a varibale.
|
190
|
+
[2] This is not another browser, it is the mobile emulation which Google Chrome proovides through its developer tools.
|
191
|
+
[3] Please download the required Microsoft WebDriver as per your windows 10 build number. Windows 10 build can be checked with the `winver` command.
|
173
192
|
|
174
193
|
## Contributing
|
175
|
-
Ideas and suggestions are always always most welcome. Please fork this gem code and feel free to add any updates, suggestions etc and create a pull request.
|
194
|
+
Ideas and suggestions are always always most welcome. Please fork this gem code and feel free to add any updates, suggestions etc and create a pull request.
|
195
|
+
|
196
|
+
## Issues
|
197
|
+
If you face any problem related to syntax, usability, documentation then please raise an [issues](https://github.com/krupani/testnow/issues)
|
data/bin/testnow
CHANGED
@@ -20,7 +20,7 @@ def cucumber_now(framework="cucumber")
|
|
20
20
|
@report_dir = File.join(@root_dir, 'reports')
|
21
21
|
|
22
22
|
if File.exist?(@root_dir)
|
23
|
-
print
|
23
|
+
print "There is already #{@base} directory. Either delete it or try running the command from some other directory."
|
24
24
|
exit 1
|
25
25
|
end
|
26
26
|
|
@@ -138,7 +138,7 @@ def rspec_now(framework="cucumber")
|
|
138
138
|
@pages_dir = File.join(@root_dir, "pages")
|
139
139
|
|
140
140
|
if File.exist?(@root_dir)
|
141
|
-
print
|
141
|
+
print "There is already #{@base} directory. Either delete it or try running the command from some other directory."
|
142
142
|
exit 1
|
143
143
|
end
|
144
144
|
|
@@ -5,7 +5,11 @@ class GithubPage
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def search_github(key)
|
8
|
-
|
8
|
+
if ENV['BROWSER'].downcase == "edge"
|
9
|
+
@driver.get(@driver.current_url+"/search?q=#{key}")
|
10
|
+
else
|
11
|
+
@driver.find_element(:name => "q").send_keys(key+"\n")
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
def click_tab(tab)
|
@@ -5,7 +5,11 @@ class GithubPage
|
|
5
5
|
end
|
6
6
|
|
7
7
|
def search_github(key)
|
8
|
-
|
8
|
+
if ENV['BROWSER'].downcase == "edge"
|
9
|
+
@browser.goto(@browser.driver.current_url+"/search?q=#{key}")
|
10
|
+
else
|
11
|
+
@browser.text_field(:name => "q").set "#{key}\n"
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
def click_tab(tab)
|
data/lib/testnow.rb
CHANGED
@@ -4,53 +4,65 @@ require 'testnow/firefox'
|
|
4
4
|
require 'testnow/android'
|
5
5
|
require 'testnow/android_chrome'
|
6
6
|
require 'testnow/ie'
|
7
|
+
require 'testnow/edge'
|
7
8
|
|
8
9
|
module TestNow
|
9
10
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
when "chrome"
|
14
|
-
chrome = Chrome.new
|
15
|
-
chrome.launch_driver_chrome
|
16
|
-
when "android"
|
17
|
-
TestNow.launch_driver_android
|
18
|
-
when "opera"
|
19
|
-
opera = Opera.new
|
20
|
-
opera.launch_driver_opera
|
21
|
-
when "androidchrome"
|
22
|
-
ac = AndroidChrome.new
|
23
|
-
ac.launch_driver_android_chrome
|
24
|
-
when "ie"
|
25
|
-
ie = IE.new
|
26
|
-
ie.launch_driver_ie
|
27
|
-
else
|
28
|
-
ff = Firefox.new
|
29
|
-
ff.launch_driver_firefox
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
module Watir
|
34
|
-
def init
|
35
|
-
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
36
|
-
case ENV['BROWSER'].downcase
|
11
|
+
def init
|
12
|
+
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
13
|
+
case ENV['BROWSER'].downcase
|
37
14
|
when "chrome"
|
38
15
|
chrome = Chrome.new
|
39
|
-
chrome.
|
16
|
+
chrome.launch_driver_chrome
|
40
17
|
when "android"
|
41
|
-
|
18
|
+
puts "Coming Soon!!\n"
|
19
|
+
puts "Apologies for inconvenience...\n\n"
|
42
20
|
when "opera"
|
43
21
|
opera = Opera.new
|
44
|
-
opera.
|
22
|
+
opera.launch_driver_opera
|
45
23
|
when "androidchrome"
|
46
24
|
ac = AndroidChrome.new
|
47
|
-
ac.
|
25
|
+
ac.launch_driver_android_chrome
|
48
26
|
when "ie"
|
49
27
|
ie = IE.new
|
50
|
-
ie.
|
28
|
+
ie.launch_driver_ie
|
29
|
+
when "edge"
|
30
|
+
edge = MicrosoftEdge.new
|
31
|
+
edge.launch_driver_edge
|
32
|
+
when "phantomjs"
|
33
|
+
puts "Coming Soon!!\n"
|
34
|
+
puts "Apologies for inconvenience...\n\n"
|
51
35
|
else
|
52
36
|
ff = Firefox.new
|
53
|
-
ff.
|
37
|
+
ff.launch_driver_firefox
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
module Watir
|
42
|
+
def init
|
43
|
+
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
44
|
+
case ENV['BROWSER'].downcase
|
45
|
+
when "chrome"
|
46
|
+
chrome = Chrome.new
|
47
|
+
chrome.launch_watir_chrome
|
48
|
+
when "android"
|
49
|
+
puts "Coming Soon!!\n"
|
50
|
+
puts "Apologies for inconvenience...\n\n"
|
51
|
+
when "opera"
|
52
|
+
opera = Opera.new
|
53
|
+
opera.launch_watir_opera
|
54
|
+
when "androidchrome"
|
55
|
+
ac = AndroidChrome.new
|
56
|
+
ac.launch_watir_android_chrome
|
57
|
+
when "ie"
|
58
|
+
ie = IE.new
|
59
|
+
ie.launch_watir_ie
|
60
|
+
when "edge"
|
61
|
+
edge = MicrosoftEdge.new
|
62
|
+
edge.launch_watir_edge
|
63
|
+
else
|
64
|
+
ff = Firefox.new
|
65
|
+
ff.launch_watir_firefox
|
54
66
|
end
|
55
67
|
end
|
56
68
|
end
|
data/lib/testnow/chrome.rb
CHANGED
@@ -1,20 +1,23 @@
|
|
1
1
|
class Chrome
|
2
2
|
|
3
|
+
@private
|
4
|
+
def post_chrome_config(driver)
|
5
|
+
driver.manage.timeouts.implicit_wait = 30
|
6
|
+
driver.manage.timeouts.page_load = 120
|
7
|
+
driver.manage.window.maximize
|
8
|
+
end
|
9
|
+
|
3
10
|
# Chrome Browser
|
4
11
|
def launch_driver_chrome
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
@driver.manage.window.maximize
|
9
|
-
return @driver
|
12
|
+
driver = Selenium::WebDriver.for :chrome
|
13
|
+
self.post_chrome_config(driver)
|
14
|
+
return driver
|
10
15
|
end
|
11
16
|
|
12
17
|
def launch_watir_chrome
|
13
18
|
browser = Watir::Browser.new :chrome
|
14
|
-
browser.driver
|
15
|
-
|
16
|
-
browser.driver.manage.window.maximize
|
17
|
-
return browser
|
19
|
+
self.post_chrome_config(browser.driver)
|
20
|
+
return browser
|
18
21
|
end
|
19
|
-
|
22
|
+
|
20
23
|
end
|
data/lib/testnow/edge.rb
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
class MicrosoftEdge
|
2
|
+
|
3
|
+
@private
|
4
|
+
def edge_config
|
5
|
+
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
+
@client.timeout = 120
|
7
|
+
@caps = Selenium::WebDriver::Remote::Capabilities.edge(:native_events => false,
|
8
|
+
:acceptSslCerts => true)
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
@private
|
13
|
+
def post_edge_config(driver)
|
14
|
+
driver.manage.timeouts.implicit_wait = 30
|
15
|
+
driver.manage.timeouts.page_load = 120
|
16
|
+
end
|
17
|
+
|
18
|
+
def launch_driver_edge
|
19
|
+
self.edge_config
|
20
|
+
driver = Selenium::WebDriver.for(:edge,
|
21
|
+
:desired_capabilities => @caps,
|
22
|
+
:http_client => @client)
|
23
|
+
return driver
|
24
|
+
end
|
25
|
+
|
26
|
+
def launch_watir_edge
|
27
|
+
self.edge_config
|
28
|
+
browser = Watir::Browser.new(:edge,
|
29
|
+
:desired_capabilities => @caps,
|
30
|
+
:http_client => @client)
|
31
|
+
self.post_edge_config(browser.driver)
|
32
|
+
return browser
|
33
|
+
end
|
34
|
+
end
|
data/lib/testnow/ie.rb
CHANGED
@@ -4,7 +4,11 @@ class IE
|
|
4
4
|
def ie_config
|
5
5
|
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
6
|
@client.timeout = 120
|
7
|
-
@caps = Selenium::WebDriver::Remote::Capabilities.ie('ie.ensureCleanSession' => true,
|
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)
|
8
12
|
end
|
9
13
|
|
10
14
|
@private
|
@@ -23,14 +27,18 @@ class IE
|
|
23
27
|
|
24
28
|
def launch_driver_ie
|
25
29
|
self.ie_config
|
26
|
-
driver = Selenium::WebDriver.for(:ie,
|
30
|
+
driver = Selenium::WebDriver.for(:ie,
|
31
|
+
:desired_capabilities => @caps,
|
32
|
+
:http_client => @client)
|
27
33
|
self.set_ie_config(driver)
|
28
34
|
return driver
|
29
35
|
end
|
30
36
|
|
31
37
|
def launch_watir_ie
|
32
38
|
self.ie_config
|
33
|
-
browser = Watir::Browser.new(:ie,
|
39
|
+
browser = Watir::Browser.new(:ie,
|
40
|
+
:desired_capabilities => @caps,
|
41
|
+
:http_client => @client)
|
34
42
|
self.set_ie_config(browser.driver)
|
35
43
|
return browser
|
36
44
|
end
|
data/lib/testnow/version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.9
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: testnow
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kaushal Rupani
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-12-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/testnow/android.rb
|
90
90
|
- lib/testnow/android_chrome.rb
|
91
91
|
- lib/testnow/chrome.rb
|
92
|
+
- lib/testnow/edge.rb
|
92
93
|
- lib/testnow/firefox.rb
|
93
94
|
- lib/testnow/ie.rb
|
94
95
|
- lib/testnow/opera.rb
|