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
@@ -1,18 +1,18 @@
|
|
1
|
-
require File.join(File.dirname(__FILE__),'/../spec_helper')
|
2
|
-
|
3
|
-
describe "As a github user, my public profile" do
|
4
|
-
|
5
|
-
before(:each) do
|
6
|
-
@browser.goto(ENV['TEST_URL'])
|
7
|
-
end
|
8
|
-
|
9
|
-
it "should display my name" do
|
10
|
-
git = GithubPage.new(@browser)
|
11
|
-
git.search_github("Kaushal Rupani")
|
12
|
-
git.click_tab("Users")
|
13
|
-
git.verify_text_presence("Kaushal")
|
14
|
-
git.visit_profile
|
15
|
-
git.verify_text_presence("Kaushal Rupani")
|
16
|
-
end
|
17
|
-
|
1
|
+
require File.join(File.dirname(__FILE__),'/../spec_helper')
|
2
|
+
|
3
|
+
describe "As a github user, my public profile" do
|
4
|
+
|
5
|
+
before(:each) do
|
6
|
+
@browser.goto(ENV['TEST_URL'])
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should display my name" do
|
10
|
+
git = GithubPage.new(@browser)
|
11
|
+
git.search_github("Kaushal Rupani")
|
12
|
+
git.click_tab("Users")
|
13
|
+
git.verify_text_presence("Kaushal")
|
14
|
+
git.visit_profile
|
15
|
+
git.verify_text_presence("Kaushal Rupani")
|
16
|
+
end
|
17
|
+
|
18
18
|
end
|
@@ -1,24 +1,24 @@
|
|
1
|
-
Given /^I am on github page$/ do
|
2
|
-
ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
|
3
|
-
@browser.goto(ENV['TEST_URL'])
|
4
|
-
end
|
5
|
-
|
6
|
-
When (/^I search for "([^"]*)" keyword$/) do |key|
|
7
|
-
home = GithubPage.new(@browser)
|
8
|
-
home.search_github(key)
|
9
|
-
end
|
10
|
-
|
11
|
-
When /^I follow the Users Tab$/ do
|
12
|
-
home = GithubPage.new(@browser)
|
13
|
-
home.click_tab("Users")
|
14
|
-
end
|
15
|
-
|
16
|
-
When /^I follow username link to view the profile page$/ do
|
17
|
-
home = GithubPage.new(@browser)
|
18
|
-
home.visit_profile
|
19
|
-
end
|
20
|
-
|
21
|
-
Then (/^I verify "([^"]*)" is displayed$/) do |name|
|
22
|
-
home = GithubPage.new(@browser)
|
23
|
-
home.verify_text_presence(name)
|
1
|
+
Given /^I am on github page$/ do
|
2
|
+
ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
|
3
|
+
@browser.goto(ENV['TEST_URL'])
|
4
|
+
end
|
5
|
+
|
6
|
+
When (/^I search for "([^"]*)" keyword$/) do |key|
|
7
|
+
home = GithubPage.new(@browser)
|
8
|
+
home.search_github(key)
|
9
|
+
end
|
10
|
+
|
11
|
+
When /^I follow the Users Tab$/ do
|
12
|
+
home = GithubPage.new(@browser)
|
13
|
+
home.click_tab("Users")
|
14
|
+
end
|
15
|
+
|
16
|
+
When /^I follow username link to view the profile page$/ do
|
17
|
+
home = GithubPage.new(@browser)
|
18
|
+
home.visit_profile
|
19
|
+
end
|
20
|
+
|
21
|
+
Then (/^I verify "([^"]*)" is displayed$/) do |name|
|
22
|
+
home = GithubPage.new(@browser)
|
23
|
+
home.verify_text_presence(name)
|
24
24
|
end
|
@@ -1,40 +1,40 @@
|
|
1
|
-
Before do |scenario|
|
2
|
-
@browser = TestNow.init
|
3
|
-
end
|
4
|
-
|
5
|
-
After do |scenario|
|
6
|
-
if scenario.failed?
|
7
|
-
begin
|
8
|
-
encoded_img = driver.screenshot_as(:base64)
|
9
|
-
embed("#{encoded_img}", "image/png;base64")
|
10
|
-
rescue
|
11
|
-
p "*** Could not take failed scenario screenshot ***"
|
12
|
-
end
|
13
|
-
end
|
14
|
-
quit_driver
|
15
|
-
end
|
16
|
-
|
17
|
-
at_exit do
|
18
|
-
ENV['TITLE'] = "GITHUB AUTOMATION REPORT" if ENV['TITLE'].nil?
|
19
|
-
report_file = File.absolute_path("github_report.html","reports")
|
20
|
-
doc = File.read(report_file)
|
21
|
-
new_doc = doc.sub("Cucumber Features", "#{ENV['TITLE']}")
|
22
|
-
File.open(report_file, "w") {|file| file.puts new_doc }
|
23
|
-
end
|
24
|
-
|
25
|
-
AfterStep do
|
26
|
-
begin
|
27
|
-
encoded_img = driver.screenshot_as(:base64)
|
28
|
-
embed("#{encoded_img}", "image/png;base64")
|
29
|
-
rescue
|
30
|
-
p "*** Could Not take screenshot ***"
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
def driver
|
35
|
-
@browser.driver
|
36
|
-
end
|
37
|
-
|
38
|
-
def quit_driver
|
39
|
-
@browser.quit
|
1
|
+
Before do |scenario|
|
2
|
+
@browser = TestNow.init
|
3
|
+
end
|
4
|
+
|
5
|
+
After do |scenario|
|
6
|
+
if scenario.failed?
|
7
|
+
begin
|
8
|
+
encoded_img = driver.screenshot_as(:base64)
|
9
|
+
embed("#{encoded_img}", "image/png;base64")
|
10
|
+
rescue
|
11
|
+
p "*** Could not take failed scenario screenshot ***"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
quit_driver
|
15
|
+
end
|
16
|
+
|
17
|
+
at_exit do
|
18
|
+
ENV['TITLE'] = "GITHUB AUTOMATION REPORT" if ENV['TITLE'].nil?
|
19
|
+
report_file = File.absolute_path("github_report.html","reports")
|
20
|
+
doc = File.read(report_file)
|
21
|
+
new_doc = doc.sub("Cucumber Features", "#{ENV['TITLE']}")
|
22
|
+
File.open(report_file, "w") {|file| file.puts new_doc }
|
23
|
+
end
|
24
|
+
|
25
|
+
AfterStep do
|
26
|
+
begin
|
27
|
+
encoded_img = driver.screenshot_as(:base64)
|
28
|
+
embed("#{encoded_img}", "image/png;base64")
|
29
|
+
rescue
|
30
|
+
p "*** Could Not take screenshot ***"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def driver
|
35
|
+
@browser.driver
|
36
|
+
end
|
37
|
+
|
38
|
+
def quit_driver
|
39
|
+
@browser.quit
|
40
40
|
end
|
@@ -1,21 +1,21 @@
|
|
1
|
-
require 'rspec'
|
2
|
-
require 'selenium-webdriver'
|
3
|
-
require 'rake'
|
4
|
-
require 'testnow'
|
5
|
-
require 'watir-webdriver'
|
6
|
-
|
7
|
-
include RSpec::Matchers
|
8
|
-
include TestNow::Watir
|
9
|
-
|
10
|
-
require File.dirname(__FILE__) + "/../pages/github_page"
|
11
|
-
|
12
|
-
RSpec.configure do |config|
|
13
|
-
config.before(:all) do
|
14
|
-
ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
|
15
|
-
@browser = TestNow.init
|
16
|
-
end
|
17
|
-
|
18
|
-
config.after(:all) do
|
19
|
-
@browser.quit
|
20
|
-
end
|
21
|
-
end
|
1
|
+
require 'rspec'
|
2
|
+
require 'selenium-webdriver'
|
3
|
+
require 'rake'
|
4
|
+
require 'testnow'
|
5
|
+
require 'watir-webdriver'
|
6
|
+
|
7
|
+
include RSpec::Matchers
|
8
|
+
include TestNow::Watir
|
9
|
+
|
10
|
+
require File.dirname(__FILE__) + "/../pages/github_page"
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.before(:all) do
|
14
|
+
ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
|
15
|
+
@browser = TestNow.init
|
16
|
+
end
|
17
|
+
|
18
|
+
config.after(:all) do
|
19
|
+
@browser.quit
|
20
|
+
end
|
21
|
+
end
|
data/lib/testnow.rb
CHANGED
@@ -1,79 +1,78 @@
|
|
1
|
-
require 'testnow/chrome'
|
2
|
-
require 'testnow/opera'
|
3
|
-
require 'testnow/firefox'
|
4
|
-
require 'testnow/
|
5
|
-
require 'testnow/
|
6
|
-
require 'testnow/
|
7
|
-
require 'testnow/
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
ENV['BROWSER']
|
14
|
-
|
15
|
-
|
16
|
-
chrome
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
ff
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
chrome
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
ff
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
1
|
+
require 'testnow/chrome'
|
2
|
+
require 'testnow/opera'
|
3
|
+
require 'testnow/firefox'
|
4
|
+
require 'testnow/android_chrome'
|
5
|
+
require 'testnow/ie'
|
6
|
+
require 'testnow/edge'
|
7
|
+
require 'testnow/firefox_gecko'
|
8
|
+
|
9
|
+
module TestNow
|
10
|
+
|
11
|
+
def init
|
12
|
+
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
13
|
+
case ENV['BROWSER'].downcase.gsub(" ","").gsub("_","")
|
14
|
+
when "chrome"
|
15
|
+
chrome = Chrome.new
|
16
|
+
chrome.launch_driver_chrome
|
17
|
+
when "opera"
|
18
|
+
opera = Opera.new
|
19
|
+
opera.launch_driver_opera
|
20
|
+
when "androidchrome","chromeandroid"
|
21
|
+
ac = AndroidChrome.new
|
22
|
+
ac.launch_driver_android_chrome
|
23
|
+
when "ie"
|
24
|
+
ie = IE.new
|
25
|
+
ie.launch_driver_ie
|
26
|
+
when "edge"
|
27
|
+
edge = MicrosoftEdge.new
|
28
|
+
edge.launch_driver_edge
|
29
|
+
when "firefoxgecko","geckofirefox","firefoxnew","newfirefox","firefox"
|
30
|
+
firefox_gecko = FirefoxGecko.new
|
31
|
+
firefox_gecko.launch_driver_firefox_gecko
|
32
|
+
when "phantomjs"
|
33
|
+
puts "Coming Soon!!\n"
|
34
|
+
puts "Apologies for inconvenience...\n\n"
|
35
|
+
when "chromemobile","mobilechrome"
|
36
|
+
chrome = Chrome.new
|
37
|
+
chrome.launch_driver_chrome_mobile
|
38
|
+
when "firefoxold","oldfirefox"
|
39
|
+
ff = Firefox.new
|
40
|
+
ff.launch_driver_firefox
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
module Watir
|
45
|
+
def init
|
46
|
+
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
47
|
+
case ENV['BROWSER'].downcase
|
48
|
+
when "chrome"
|
49
|
+
chrome = Chrome.new
|
50
|
+
chrome.launch_watir_chrome
|
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
|
+
when "firefoxgecko","geckofirefox","firefoxnew","newfirefox","firefox"
|
64
|
+
firefox_gecko = FirefoxGecko.new
|
65
|
+
firefox_gecko.launch_watir_firefox_gecko
|
66
|
+
when "chromemobile","mobilechrome"
|
67
|
+
chrome = Chrome.new
|
68
|
+
chrome.launch_watir_chrome_mobile
|
69
|
+
when "firefoxold","oldfirefox"
|
70
|
+
ff = Firefox.new
|
71
|
+
ff.launch_watir_firefox
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
end
|
77
|
+
|
78
|
+
|
@@ -1,27 +1,27 @@
|
|
1
|
-
class AndroidChrome
|
2
|
-
|
3
|
-
@private
|
4
|
-
def android_chrome_config
|
5
|
-
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
-
@client.timeout = 120
|
7
|
-
@service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/chromedriver")
|
8
|
-
@service.start
|
9
|
-
end
|
10
|
-
|
11
|
-
def launch_driver_android_chrome
|
12
|
-
self.android_chrome_config
|
13
|
-
caps = {'chromeOptions'=> {'androidPackage' => 'com.android.chrome'}}
|
14
|
-
driver = Selenium::WebDriver.for(:remote, :http_client => client, :url => service.uri, :desired_capabilities => caps)
|
15
|
-
driver.manage.timeouts.implicit_wait = 60
|
16
|
-
return driver
|
17
|
-
end
|
18
|
-
|
19
|
-
def launch_watir_android_chrome
|
20
|
-
self.android_chrome_config
|
21
|
-
caps = {'chromeOptions'=> {'androidPackage' => 'com.android.chrome'}}
|
22
|
-
browser = Watir::Browser.new(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
|
23
|
-
browser.driver.manage.timeouts.implicit_wait = 60
|
24
|
-
return browser
|
25
|
-
end
|
26
|
-
|
1
|
+
class AndroidChrome
|
2
|
+
|
3
|
+
@private
|
4
|
+
def android_chrome_config
|
5
|
+
@client = Selenium::WebDriver::Remote::Http::Default.new
|
6
|
+
@client.timeout = 120
|
7
|
+
@service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/chromedriver")
|
8
|
+
@service.start
|
9
|
+
end
|
10
|
+
|
11
|
+
def launch_driver_android_chrome
|
12
|
+
self.android_chrome_config
|
13
|
+
caps = {'chromeOptions'=> {'androidPackage' => 'com.android.chrome'}}
|
14
|
+
driver = Selenium::WebDriver.for(:remote, :http_client => client, :url => service.uri, :desired_capabilities => caps)
|
15
|
+
driver.manage.timeouts.implicit_wait = 60
|
16
|
+
return driver
|
17
|
+
end
|
18
|
+
|
19
|
+
def launch_watir_android_chrome
|
20
|
+
self.android_chrome_config
|
21
|
+
caps = {'chromeOptions'=> {'androidPackage' => 'com.android.chrome'}}
|
22
|
+
browser = Watir::Browser.new(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
|
23
|
+
browser.driver.manage.timeouts.implicit_wait = 60
|
24
|
+
return browser
|
25
|
+
end
|
26
|
+
|
27
27
|
end
|
data/lib/testnow/chrome.rb
CHANGED
@@ -1,23 +1,48 @@
|
|
1
|
-
class Chrome
|
2
|
-
|
3
|
-
@private
|
4
|
-
def post_config(driver)
|
5
|
-
driver.manage.timeouts.implicit_wait = 30
|
6
|
-
driver.manage.timeouts.page_load = 120
|
7
|
-
driver.manage.window.maximize
|
8
|
-
end
|
9
|
-
|
10
|
-
# Chrome Browser
|
11
|
-
def launch_driver_chrome
|
12
|
-
driver = Selenium::WebDriver.for :chrome
|
13
|
-
self.post_config(driver)
|
14
|
-
return driver
|
15
|
-
end
|
16
|
-
|
17
|
-
def launch_watir_chrome
|
18
|
-
browser = Watir::Browser.new :chrome
|
19
|
-
self.post_config(browser.driver)
|
20
|
-
return browser
|
21
|
-
end
|
22
|
-
|
1
|
+
class Chrome
|
2
|
+
|
3
|
+
@private
|
4
|
+
def post_config(driver)
|
5
|
+
driver.manage.timeouts.implicit_wait = 30
|
6
|
+
driver.manage.timeouts.page_load = 120
|
7
|
+
driver.manage.window.maximize
|
8
|
+
end
|
9
|
+
|
10
|
+
# Chrome Browser
|
11
|
+
def launch_driver_chrome
|
12
|
+
driver = Selenium::WebDriver.for :chrome
|
13
|
+
self.post_config(driver)
|
14
|
+
return driver
|
15
|
+
end
|
16
|
+
|
17
|
+
def launch_watir_chrome
|
18
|
+
browser = Watir::Browser.new :chrome
|
19
|
+
self.post_config(browser.driver)
|
20
|
+
return browser
|
21
|
+
end
|
22
|
+
|
23
|
+
@private
|
24
|
+
def pre_mobile_chrome_config
|
25
|
+
device_name = ENV['DEVICE'].gsub("_"," ")
|
26
|
+
mobile_emulation = { "deviceName" => device_name }
|
27
|
+
caps = Selenium::WebDriver::Remote::Capabilities.chrome(
|
28
|
+
"chromeOptions" => { "mobileEmulation" => mobile_emulation })
|
29
|
+
return caps
|
30
|
+
end
|
31
|
+
|
32
|
+
def launch_driver_chrome_mobile
|
33
|
+
caps = self.pre_mobile_chrome_config
|
34
|
+
driver = Selenium::WebDriver.for(:chrome,
|
35
|
+
:desired_capabilities => caps)
|
36
|
+
self.post_config(driver)
|
37
|
+
return driver
|
38
|
+
end
|
39
|
+
|
40
|
+
def launch_watir_chrome_mobile
|
41
|
+
caps = self.pre_mobile_chrome_config
|
42
|
+
browser = Watir::Browser.new(:chrome,
|
43
|
+
:desired_capabilities => caps)
|
44
|
+
self.post_config(browser.driver)
|
45
|
+
return browser
|
46
|
+
end
|
47
|
+
|
23
48
|
end
|