testnow 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1b843837c244c7dd1d30616b4fa1c7e0cf042b97
4
- data.tar.gz: 2709a0f8f17c553e0ac342f4bbcbbaa36f2b8819
3
+ metadata.gz: eb556c37d8d2e832253d745a9bf20d05e3145d97
4
+ data.tar.gz: 0a5ff7218eaedd0d5d2d38aeeb199be5f8f23ba9
5
5
  SHA512:
6
- metadata.gz: 6c5ca0fbd0be3a2689d6b03b7b8def97f86014640527b36a68189eaed8976b8bc1053422f24d051bd305d3853e07814ad4f046ad985cea8f73ed44c80eb8ea18
7
- data.tar.gz: 90ad5aa502825bd0df986637edbe6703b9d633db2ac4babba8db6c1d8a961534f07f180b2e71782505b9d424775635ef2767658a14035b104a074bdd5e445525
6
+ metadata.gz: 823fc2fbf9d73eac0a341e795782adbc204f6576f402ffa3aa0b7c543ccf60011bdf598781ca81276801124081cfdbe5022d54f1a8ee721f2afda8708c33e86e
7
+ data.tar.gz: 8fdac75edef2b6a10783f2cc883ea27d84994ea5d140f1d547e3f45ead4bd48f942405e5c435e7722a4b9eae6537fbc6090336777f23a9dec386d735458f5dff
data/bin/testnow ADDED
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'fileutils'
4
+
5
+ @root_dir = File.join(FileUtils.pwd, "cucumber_now")
6
+ @feature_dir = File.join(@root_dir,'features')
7
+ @scenario_dir = File.join(@feature_dir, 'scenarios')
8
+ @steps_dir = File.join(@feature_dir,'step_definition')
9
+ @page_dir = File.join(@feature_dir, 'pages')
10
+ @support_dir = File.join(@feature_dir,'support')
11
+ @report_dir = File.join(@root_dir, 'reports')
12
+ @showtime_dir = File.join(File.dirname(__FILE__) + "/../data/showtime")
13
+
14
+ def cucumber_now
15
+ if File.exist?(@root_dir)
16
+ print 'There is already cucumber_now directory. Either delete it or try running the command from some other directory.'
17
+ exit 1
18
+ end
19
+ puts "\n"+"*"*70
20
+ puts "* TestNow is creating a WebDriver-Ruby-Cucumber framework for you. *"
21
+ puts "*"*70
22
+
23
+ print "Creating project directory."
24
+ FileUtils.makedirs(@root_dir)
25
+
26
+ print "Creating features directory."
27
+ FileUtils.makedirs(@feature_dir)
28
+
29
+ print "Creating the scenarios directory to contain the feature files."
30
+ FileUtils.makedirs(@scenario_dir)
31
+
32
+ print "Creating the steps directory to contain the step definition files"
33
+ FileUtils.makedirs(@steps_dir)
34
+
35
+ print "Creating the page directory just in case if you want to use page object pattern."
36
+ FileUtils.makedirs(@page_dir)
37
+
38
+ print "Creating a support directory which will contain all the configs"
39
+ FileUtils.makedirs(@support_dir)
40
+
41
+ print "Creating the reports directory where the reports will be save after execution."
42
+ FileUtils.makedirs(@report_dir)
43
+
44
+ print "Creating config files..."
45
+ print "1. hooks.rb -- used for setup and teardown purpose."
46
+ FileUtils.copy(@showtime_dir+"/hooks.rb", @support_dir)
47
+ print "2. env.rb -- used as cucumber config"
48
+ FileUtils.copy(@showtime_dir+"/env.rb", @support_dir)
49
+
50
+ print "Creating feature file inside scenarios directory."
51
+ FileUtils.copy(@showtime_dir+"/github.feature", @scenario_dir)
52
+
53
+ print "Creating step definition file inside the steps directory"
54
+ FileUtils.copy(@showtime_dir+"/github_steps.rb", @steps_dir)
55
+
56
+ print "Creating page class file inside the page directory."
57
+ FileUtils.copy(@showtime_dir+"/github_page.rb", @page_dir)
58
+
59
+ print "Creating Gemfile -- used to contain all required gems information."
60
+ FileUtils.copy(@showtime_dir+"/Gemfile", @root_dir)
61
+
62
+ print "Creating cucumber.yml -- used to provide cucumber options"
63
+ FileUtils.copy(@showtime_dir+"/cucumber.yml", @root_dir)
64
+
65
+ puts "\n"+"*"*97
66
+ puts "* TestNow completed framework creation. A sample scenario is also created for your reference. *"
67
+ puts "*"*97
68
+
69
+ puts "\n Would you like to continue with dependency(gems) installation? (Y/n)"
70
+ ans=gets
71
+ if ans.chomp.downcase == "y"
72
+ print "TestNow is installing gems using bundler. Please wait till process completed."
73
+ system('gem install bundler')
74
+ system('bundle install --gemfile=$(pwd)/cucumber_now/Gemfile')
75
+ print "Dependency installation completed successfully.\n"
76
+ else
77
+ exit 1
78
+ end
79
+
80
+ puts "\n"+"*"*80
81
+ puts "* Congratulations!!! Your WenDriver-Ruby-Cucumber framework is ready to use. *"
82
+ puts "*"*80
83
+
84
+ end
85
+
86
+ def print(msg)
87
+ puts "\n"
88
+ puts "=>=>=>=>=> " + msg
89
+ sleep 1
90
+ end
91
+
92
+ def print_help
93
+ puts <<MSG
94
+
95
+ Usage: testnow <command-name>
96
+
97
+ <command-name> can be one of
98
+ help
99
+ cucumber_now
100
+ version
101
+
102
+
103
+ Command descriptions :
104
+ help : Prints help information in detail.
105
+
106
+ cucumber_now : Creates a framework for cross browser testing. This framework acts
107
+ as a sketon to add more features for your respective project.
108
+ This framework is compatible with the TestNow platform and also
109
+ can be used locally.
110
+
111
+ version : Prints the gem version
112
+
113
+ MSG
114
+ end
115
+
116
+ if ARGV.length == 0
117
+ print_help
118
+ else
119
+ cmd = ARGV.shift
120
+ if cmd == 'help'
121
+ print_help
122
+ elsif cmd == 'cucumber_now'
123
+ cucumber_now
124
+ elsif cmd == 'version'
125
+ puts File.read(File.expand_path("../../lib/testnow/version", __FILE__))
126
+ else
127
+ print_usage
128
+ end
129
+ end
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+ gem 'selenium-webdriver'
3
+ gem 'cucumber'
4
+ gem 'rspec'
5
+ gem 'rake'
6
+ gem 'page-object'
7
+ gem 'testnow'
@@ -0,0 +1 @@
1
+ default: --require features --no-source --color --format pretty --format html --out reports/github_report.html --format json --out reports/github_report.json
@@ -0,0 +1,9 @@
1
+ require 'rspec'
2
+ require 'selenium-webdriver'
3
+ require 'cucumber'
4
+ require 'rake'
5
+ require 'page-object'
6
+ require 'testnow'
7
+
8
+ include RSpec::Matchers
9
+ include TestNow
@@ -0,0 +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 Rupani" is displayed
10
+ When I follow username link to view the profile page
11
+ Then I verify "Kaushal Rupani" is displayed
@@ -0,0 +1,30 @@
1
+ class GithubPage
2
+
3
+ def initialize(page_driver)
4
+ @driver = page_driver
5
+ end
6
+
7
+ def search_github(key)
8
+ @driver.find_element(:name => "q").send_keys(key+"\n")
9
+ end
10
+
11
+ def click_tab(tab)
12
+ wait = Selenium::WebDriver::Wait.new(:timeout => 30)
13
+ case tab
14
+ when "Users"
15
+ @driver.find_element(:css => ".menu>a[href*=Users]").click
16
+ wait.until{@driver.find_element(:id => "user_search_results").displayed?}
17
+ else
18
+ puts "Wrong tab buddy!!"
19
+ end
20
+ end
21
+
22
+ def visit_profile
23
+ @driver.find_element(:link => "krupani").click
24
+ end
25
+
26
+ def verify_text_presence(word)
27
+ expect(@driver.find_element(:tag_name => "body").text).to include(word)
28
+ end
29
+
30
+ end
@@ -0,0 +1,23 @@
1
+ Given /^I am on github page$/ do
2
+ @driver.get("https://github.com")
3
+ end
4
+
5
+ When /^I search for "([^"]*)" keyword$/ do |key|
6
+ home = GithubPage.new(@driver)
7
+ home.search_github(key)
8
+ end
9
+
10
+ When /^I follow the Users Tab$/ do
11
+ home = GithubPage.new(@driver)
12
+ home.click_tab("Users")
13
+ end
14
+
15
+ When /^I follow username link to view the profile page$/ do
16
+ home = GithubPage.new(@driver)
17
+ home.visit_profile
18
+ end
19
+
20
+ Then /^I verify "([^"]*)" is displayed$/ do |name|
21
+ home = GithubPage.new(@driver)
22
+ home.verify_text_presence(name)
23
+ end
@@ -0,0 +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
40
+ end
@@ -0,0 +1 @@
1
+ 0.0.4
metadata CHANGED
@@ -1,50 +1,66 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testnow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
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-04-14 00:00:00.000000000 Z
11
+ date: 2016-04-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: selenium-webdriver
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.52'
17
20
  - - ">="
18
21
  - !ruby/object:Gem::Version
19
- version: '0'
22
+ version: '2.52'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
27
+ - - "~>"
28
+ - !ruby/object:Gem::Version
29
+ version: '2.52'
24
30
  - - ">="
25
31
  - !ruby/object:Gem::Version
26
- version: '0'
32
+ version: '2.52'
27
33
  description: A gem to configure your Ruby Selenium suite for TestNow
28
34
  email: kushrupani@live.com
29
- executables: []
35
+ executables:
36
+ - testnow
30
37
  extensions: []
31
38
  extra_rdoc_files: []
32
39
  files:
33
40
  - LICENCE
34
41
  - README.md
42
+ - bin/testnow
35
43
  - data/firebug-2.0.13.xpi
36
44
  - data/netExport-0.8.xpi
45
+ - data/showtime/Gemfile
46
+ - data/showtime/cucumber.yml
47
+ - data/showtime/env.rb
48
+ - data/showtime/github.feature
49
+ - data/showtime/github_page.rb
50
+ - data/showtime/github_steps.rb
51
+ - data/showtime/hooks.rb
37
52
  - lib/testnow.rb
38
53
  - lib/testnow/chrome.rb
39
54
  - lib/testnow/firefox.rb
40
55
  - lib/testnow/opera.rb
56
+ - lib/testnow/version
41
57
  - spec/spec_helper.rb
42
58
  - spec/testnow/testnow_spec.rb
43
59
  homepage: https://github.com/krupani/testnow
44
60
  licenses:
45
61
  - MIT
46
62
  metadata: {}
47
- post_install_message:
63
+ post_install_message: "=>=>=>=>=> Thank you for installing TestNow gem. <=<=<=<=<= "
48
64
  rdoc_options: []
49
65
  require_paths:
50
66
  - lib
@@ -64,4 +80,6 @@ rubygems_version: 2.5.1
64
80
  signing_key:
65
81
  specification_version: 4
66
82
  summary: TestNow helper
67
- test_files: []
83
+ test_files:
84
+ - spec/spec_helper.rb
85
+ - spec/testnow/testnow_spec.rb