testnow 0.0.9 → 0.1.0
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 +197 -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 +33 -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 +32 -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 +79 -72
- data/lib/testnow/android.rb +7 -7
- data/lib/testnow/android_chrome.rb +26 -26
- data/lib/testnow/chrome.rb +22 -22
- data/lib/testnow/edge.rb +34 -33
- data/lib/testnow/firefox.rb +54 -52
- data/lib/testnow/firefox_gecko.rb +31 -0
- data/lib/testnow/ie.rb +45 -45
- data/lib/testnow/opera.rb +41 -41
- data/lib/testnow/version +1 -1
- metadata +4 -7
- data/spec/spec_helper.rb +0 -5
- data/spec/testnow/testnow_spec.rb +0 -48
@@ -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,72 +1,79 @@
|
|
1
|
-
require 'testnow/chrome'
|
2
|
-
require 'testnow/opera'
|
3
|
-
require 'testnow/firefox'
|
4
|
-
require 'testnow/android'
|
5
|
-
require 'testnow/android_chrome'
|
6
|
-
require 'testnow/ie'
|
7
|
-
require 'testnow/edge'
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
chrome.
|
17
|
-
|
18
|
-
|
19
|
-
puts "
|
20
|
-
|
21
|
-
|
22
|
-
opera.
|
23
|
-
|
24
|
-
|
25
|
-
ac.
|
26
|
-
|
27
|
-
|
28
|
-
ie.
|
29
|
-
|
30
|
-
|
31
|
-
edge.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
1
|
+
require 'testnow/chrome'
|
2
|
+
require 'testnow/opera'
|
3
|
+
require 'testnow/firefox'
|
4
|
+
require 'testnow/android'
|
5
|
+
require 'testnow/android_chrome'
|
6
|
+
require 'testnow/ie'
|
7
|
+
require 'testnow/edge'
|
8
|
+
require 'testnow/firefox_gecko'
|
9
|
+
|
10
|
+
module TestNow
|
11
|
+
|
12
|
+
def init
|
13
|
+
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
14
|
+
case ENV['BROWSER'].downcase.gsub(" ","").gsub("_","")
|
15
|
+
when "chrome"
|
16
|
+
chrome = Chrome.new
|
17
|
+
chrome.launch_driver_chrome
|
18
|
+
when "android"
|
19
|
+
puts "Coming Soon!!\n"
|
20
|
+
puts "Apologies for inconvenience...\n\n"
|
21
|
+
when "opera"
|
22
|
+
opera = Opera.new
|
23
|
+
opera.launch_driver_opera
|
24
|
+
when "androidchrome","chromeandroid"
|
25
|
+
ac = AndroidChrome.new
|
26
|
+
ac.launch_driver_android_chrome
|
27
|
+
when "ie"
|
28
|
+
ie = IE.new
|
29
|
+
ie.launch_driver_ie
|
30
|
+
when "edge"
|
31
|
+
edge = MicrosoftEdge.new
|
32
|
+
edge.launch_driver_edge
|
33
|
+
when "firefoxgecko","geckofirefox","firefoxnew","newfirefox"
|
34
|
+
firefox_gecko = FirefoxGecko.new
|
35
|
+
firefox_gecko.launch_driver_firefox_gecko
|
36
|
+
when "phantomjs"
|
37
|
+
puts "Coming Soon!!\n"
|
38
|
+
puts "Apologies for inconvenience...\n\n"
|
39
|
+
else
|
40
|
+
ff = Firefox.new
|
41
|
+
ff.launch_driver_firefox
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
module Watir
|
46
|
+
def init
|
47
|
+
ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
|
48
|
+
case ENV['BROWSER'].downcase
|
49
|
+
when "chrome"
|
50
|
+
chrome = Chrome.new
|
51
|
+
chrome.launch_watir_chrome
|
52
|
+
when "android"
|
53
|
+
puts "Coming Soon!!\n"
|
54
|
+
puts "Apologies for inconvenience...\n\n"
|
55
|
+
when "opera"
|
56
|
+
opera = Opera.new
|
57
|
+
opera.launch_watir_opera
|
58
|
+
when "androidchrome"
|
59
|
+
ac = AndroidChrome.new
|
60
|
+
ac.launch_watir_android_chrome
|
61
|
+
when "ie"
|
62
|
+
ie = IE.new
|
63
|
+
ie.launch_watir_ie
|
64
|
+
when "edge"
|
65
|
+
edge = MicrosoftEdge.new
|
66
|
+
edge.launch_watir_edge
|
67
|
+
when "firefoxgecko","geckofirefox","firefoxnew","newfirefox"
|
68
|
+
firefox_gecko = FirefoxGecko.new
|
69
|
+
firefox_gecko.launch_watir_firefox_gecko
|
70
|
+
else
|
71
|
+
ff = Firefox.new
|
72
|
+
ff.launch_watir_firefox
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
78
|
+
|
79
|
+
|
data/lib/testnow/android.rb
CHANGED
@@ -1,8 +1,8 @@
|
|
1
|
-
module TestNow
|
2
|
-
|
3
|
-
def launch_driver_android
|
4
|
-
@driver = Selenium::WebDriver.for :remote, :desired_capabilities => :android
|
5
|
-
@driver
|
6
|
-
end
|
7
|
-
|
1
|
+
module TestNow
|
2
|
+
|
3
|
+
def launch_driver_android
|
4
|
+
@driver = Selenium::WebDriver.for :remote, :desired_capabilities => :android
|
5
|
+
@driver
|
6
|
+
end
|
7
|
+
|
8
8
|
end
|
@@ -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,23 @@
|
|
1
|
-
class Chrome
|
2
|
-
|
3
|
-
@private
|
4
|
-
def
|
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.
|
14
|
-
return driver
|
15
|
-
end
|
16
|
-
|
17
|
-
def launch_watir_chrome
|
18
|
-
browser = Watir::Browser.new :chrome
|
19
|
-
self.
|
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
23
|
end
|