testnow 0.0.9 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
File without changes
File without changes
@@ -1,6 +1,6 @@
1
- source "http://rubygems.org"
2
- gem 'selenium-webdriver'
3
- gem 'cucumber'
4
- gem 'rspec'
5
- gem 'rake'
1
+ source "http://rubygems.org"
2
+ gem 'selenium-webdriver'
3
+ gem 'cucumber'
4
+ gem 'rspec'
5
+ gem 'rake'
6
6
  gem 'testnow'
@@ -1,5 +1,5 @@
1
- source "http://rubygems.org"
2
- gem 'selenium-webdriver'
3
- gem 'rspec'
4
- gem 'rake'
1
+ source "http://rubygems.org"
2
+ gem 'selenium-webdriver'
3
+ gem 'rspec'
4
+ gem 'rake'
5
5
  gem 'testnow'
@@ -1,5 +1,5 @@
1
- require 'cucumber/rake/task'
2
-
3
- Cucumber::Rake::Task.new('testnow') do |feature|
4
- feature.cucumber_opts = 'features --profile default'
1
+ require 'cucumber/rake/task'
2
+
3
+ Cucumber::Rake::Task.new('testnow') do |feature|
4
+ feature.cucumber_opts = 'features --profile default'
5
5
  end
@@ -1,7 +1,7 @@
1
- require 'rake'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new("testnow") do |role|
5
- role.pattern="spec/scenarios/*_spec.rb"
6
- role.rspec_opts = ["--format", "html", "--out", "reports/github.html"]
7
- end
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new("testnow") do |role|
5
+ role.pattern="spec/scenarios/*_spec.rb"
6
+ role.rspec_opts = ["--format", "html", "--out", "reports/github.html"]
7
+ end
data/data/showtime/env.rb CHANGED
@@ -1,8 +1,8 @@
1
- require 'rspec'
2
- require 'selenium-webdriver'
3
- require 'cucumber'
4
- require 'rake'
5
- require 'testnow'
6
-
7
- include RSpec::Matchers
1
+ require 'rspec'
2
+ require 'selenium-webdriver'
3
+ require 'cucumber'
4
+ require 'rake'
5
+ require 'testnow'
6
+
7
+ include RSpec::Matchers
8
8
  include TestNow
@@ -1,11 +1,11 @@
1
- Feature: As a github user
2
- I want to verify my user is searchable on github
3
- and confirm my name is displayed correctly on my profile
4
-
5
- Scenario: Verify full name is displayed on facebook public profile
6
- Given I am on github page
7
- When I search for "Kaushal Rupani" keyword
8
- And I follow the Users Tab
9
- Then I verify "Kaushal" is displayed
10
- When I follow username link to view the profile page
11
- Then I verify "Kaushal Rupani" is displayed
1
+ Feature: As a github user
2
+ I want to verify my user is searchable on github
3
+ and confirm my name is displayed correctly on my profile
4
+
5
+ Scenario: Verify full name is displayed on facebook public profile
6
+ Given I am on github page
7
+ When I search for "Kaushal Rupani" keyword
8
+ And I follow the Users Tab
9
+ Then I verify "Kaushal" is displayed
10
+ When I follow username link to view the profile page
11
+ Then I verify "Kaushal Rupani" is displayed
@@ -1,34 +1,34 @@
1
- class GithubPage
2
-
3
- def initialize(page_driver)
4
- @driver = page_driver
5
- end
6
-
7
- def search_github(key)
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
13
- end
14
-
15
- def click_tab(tab)
16
- wait = Selenium::WebDriver::Wait.new(:timeout => 30)
17
- case tab
18
- when "Users"
19
- @driver.find_element(:css => ".menu>a[href*=Users]").click
20
- wait.until{@driver.find_element(:id => "user_search_results").displayed?}
21
- else
22
- puts "Wrong tab buddy!!"
23
- end
24
- end
25
-
26
- def visit_profile
27
- @driver.find_element(:link => "krupani").click
28
- end
29
-
30
- def verify_text_presence(word)
31
- expect(@driver.find_element(:tag_name => "body").text).to include(word)
32
- end
33
-
1
+ class GithubPage
2
+
3
+ def initialize(page_driver)
4
+ @driver = page_driver
5
+ end
6
+
7
+ def search_github(key)
8
+ if ENV['BROWSER'].downcase == "edge" || ENV['BROWSER'].downcase == "firefoxgecko"
9
+ @driver.get(@driver.current_url+"/search?q=#{key}")
10
+ else
11
+ @driver.find_element(:name => "q").send_keys(key+"\n")
12
+ end
13
+ end
14
+
15
+ def click_tab(tab)
16
+ wait = Selenium::WebDriver::Wait.new(:timeout => 30)
17
+ case tab
18
+ when "Users"
19
+ @driver.find_element(:css => ".menu>a[href*=Users]").click
20
+ wait.until{@driver.find_element(:id => "user_search_results").displayed?}
21
+ else
22
+ puts "Wrong tab buddy!!"
23
+ end
24
+ end
25
+
26
+ def visit_profile
27
+ @driver.find_element(:link => "krupani").click
28
+ end
29
+
30
+ def verify_text_presence(word)
31
+ expect(@driver.find_element(:tag_name => "body").text).to include(word)
32
+ end
33
+
34
34
  end
@@ -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
- @driver.get(ENV['TEST_URL'])
7
- end
8
-
9
- it "should display my name" do
10
- git = GithubPage.new(@driver)
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
+ @driver.get(ENV['TEST_URL'])
7
+ end
8
+
9
+ it "should display my name" do
10
+ git = GithubPage.new(@driver)
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
- @driver.get(ENV['TEST_URL'])
4
- end
5
-
6
- When (/^I search for "([^"]*)" keyword$/) do |key|
7
- home = GithubPage.new(@driver)
8
- home.search_github(key)
9
- end
10
-
11
- When /^I follow the Users Tab$/ do
12
- home = GithubPage.new(@driver)
13
- home.click_tab("Users")
14
- end
15
-
16
- When /^I follow username link to view the profile page$/ do
17
- home = GithubPage.new(@driver)
18
- home.visit_profile
19
- end
20
-
21
- Then (/^I verify "([^"]*)" is displayed$/) do |name|
22
- home = GithubPage.new(@driver)
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
+ @driver.get(ENV['TEST_URL'])
4
+ end
5
+
6
+ When (/^I search for "([^"]*)" keyword$/) do |key|
7
+ home = GithubPage.new(@driver)
8
+ home.search_github(key)
9
+ end
10
+
11
+ When /^I follow the Users Tab$/ do
12
+ home = GithubPage.new(@driver)
13
+ home.click_tab("Users")
14
+ end
15
+
16
+ When /^I follow username link to view the profile page$/ do
17
+ home = GithubPage.new(@driver)
18
+ home.visit_profile
19
+ end
20
+
21
+ Then (/^I verify "([^"]*)" is displayed$/) do |name|
22
+ home = GithubPage.new(@driver)
23
+ home.verify_text_presence(name)
24
24
  end
@@ -1,40 +1,40 @@
1
- Before do |scenario|
2
- @driver = 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
- @driver
36
- end
37
-
38
- def quit_driver
39
- @driver.quit
1
+ Before do |scenario|
2
+ @driver = 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
+ @driver
36
+ end
37
+
38
+ def quit_driver
39
+ @driver.quit
40
40
  end
@@ -1,20 +1,20 @@
1
- require 'rspec'
2
- require 'selenium-webdriver'
3
- require 'rake'
4
- require 'testnow'
5
-
6
- include RSpec::Matchers
7
- include TestNow
8
-
9
- require File.dirname(__FILE__) + "/../pages/github_page"
10
-
11
- RSpec.configure do |config|
12
- config.before(:all) do
13
- ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
14
- @driver = TestNow.init
15
- end
16
-
17
- config.after(:all) do
18
- @driver.quit
19
- end
20
- end
1
+ require 'rspec'
2
+ require 'selenium-webdriver'
3
+ require 'rake'
4
+ require 'testnow'
5
+
6
+ include RSpec::Matchers
7
+ include TestNow
8
+
9
+ require File.dirname(__FILE__) + "/../pages/github_page"
10
+
11
+ RSpec.configure do |config|
12
+ config.before(:all) do
13
+ ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
14
+ @driver = TestNow.init
15
+ end
16
+
17
+ config.after(:all) do
18
+ @driver.quit
19
+ end
20
+ end
@@ -1,7 +1,7 @@
1
- source "http://rubygems.org"
2
- gem 'selenium-webdriver'
3
- gem 'cucumber'
4
- gem 'rspec'
5
- gem 'rake'
6
- gem 'testnow'
1
+ source "http://rubygems.org"
2
+ gem 'selenium-webdriver'
3
+ gem 'cucumber'
4
+ gem 'rspec'
5
+ gem 'rake'
6
+ gem 'testnow'
7
7
  gem 'watir-webdriver'
@@ -1,7 +1,7 @@
1
- source "http://rubygems.org"
2
- gem 'selenium-webdriver'
3
- gem 'cucumber'
4
- gem 'rspec'
5
- gem 'rake'
6
- gem 'testnow'
1
+ source "http://rubygems.org"
2
+ gem 'selenium-webdriver'
3
+ gem 'cucumber'
4
+ gem 'rspec'
5
+ gem 'rake'
6
+ gem 'testnow'
7
7
  gem 'watir-webdriver'
@@ -1,9 +1,9 @@
1
- require 'rspec'
2
- require 'selenium-webdriver'
3
- require 'cucumber'
4
- require 'rake'
5
- require 'testnow'
6
- require 'watir-webdriver'
7
-
8
- include RSpec::Matchers
1
+ require 'rspec'
2
+ require 'selenium-webdriver'
3
+ require 'cucumber'
4
+ require 'rake'
5
+ require 'testnow'
6
+ require 'watir-webdriver'
7
+
8
+ include RSpec::Matchers
9
9
  include TestNow::Watir
@@ -1,33 +1,33 @@
1
- class GithubPage
2
-
3
- def initialize(page_browser)
4
- @browser = page_browser
5
- end
6
-
7
- def search_github(key)
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
13
- end
14
-
15
- def click_tab(tab)
16
- case tab
17
- when "Users"
18
- @browser.element(:css => ".menu>a[href*=Users]").click
19
- @browser.element(:id => "user_search_results").wait_until_present(timeout=30)
20
- else
21
- puts "Wrong tab buddy!!"
22
- end
23
- end
24
-
25
- def visit_profile
26
- @browser.link(:text => "krupani").click
27
- end
28
-
29
- def verify_text_presence(word)
30
- expect(@browser.element(:text => word).present?).to be true
31
- end
32
-
1
+ class GithubPage
2
+
3
+ def initialize(page_browser)
4
+ @browser = page_browser
5
+ end
6
+
7
+ def search_github(key)
8
+ if ENV['BROWSER'].downcase == "edge" || ENV['BROWSER'].downcase == "firefoxgecko"
9
+ @browser.goto(@browser.driver.current_url+"/search?q=#{key}")
10
+ else
11
+ @browser.text_field(:name => "q").set "#{key}\n"
12
+ end
13
+ end
14
+
15
+ def click_tab(tab)
16
+ case tab
17
+ when "Users"
18
+ @browser.element(:css => ".menu>a[href*=Users]").click
19
+ @browser.element(:id => "user_search_results").wait_until_present(timeout=30)
20
+ else
21
+ puts "Wrong tab buddy!!"
22
+ end
23
+ end
24
+
25
+ def visit_profile
26
+ @browser.link(:text => "krupani").click
27
+ end
28
+
29
+ def verify_text_presence(word)
30
+ expect(@browser.element(:text => word).present?).to be true
31
+ end
32
+
33
33
  end