testnow 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d45b2d1b919ac6c4e97e74ef0492a4a9930c728c
4
- data.tar.gz: a184892f0bec6f63b088080e744bc7eaccd4561c
3
+ metadata.gz: f106969ca136c72bf809bfe4fb76ab6011e27db7
4
+ data.tar.gz: e0939a552b21e279b3d4d127edd5ca7d05660884
5
5
  SHA512:
6
- metadata.gz: ec503973ef3005797e6906136f40f1068acbfeb80dc637981d0e75ecfe569d1fd41b470034a23dcba186f01dd244b29af83ae6acc85a98ee7a1d84b823b4a663
7
- data.tar.gz: b742ebfaca88a16752e19f3bfd36972d8074dcb6f85da6e5df2cb0e117d9c562bc48e58598477b72d3e235eed1acf96e7438e596bfb7ba44920efcda05fef24d
6
+ metadata.gz: c879794ad8ffd854a93c74d26c4f37b43536b61b08b69aa37b7ba09ccc0802334f93a2621a5cefe2343bdcf151015b09260cbf40d8569e1444af20c7a33e4614
7
+ data.tar.gz: b056a29e0aa685e2a2e341a5cffe8f82291e9e68788867954aa871b26bb5ab5070cc16040a551465ce2b97240c318e7ab8a685f14b0ae786b1fde69c82020c2d
data/README.md CHANGED
@@ -1,29 +1,67 @@
1
1
  # testnow
2
2
 
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. This gem also makes your existing automation code compatible to the [TestNow platform](https://testnow.opexsoftware.com) by [Opex Software](https://opexsoftware.com) by adding just 1 line of code your existing setup(Before) method.
4
-
5
- ## Installation
6
- You must have Ruby installed before you can install this gem.
7
-
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
+
5
+ ## Table of Contents
6
+ - [Installation](#installation)
7
+ - [Install using gem command](#gem)
8
+ - [Install using bundler](#bundler)
9
+ - [Setup](#setup)
10
+ - [Cross browser configuration using testnow for your existing project](#cross)
11
+ - [Command Line Tool -- testnow command](#cli)
12
+ - [Usage](#usage)
13
+ - [Instantly create a fresh Cucumber-WebDriver framework](#cuke)
14
+ - [Instantly create a fresh RSpec-WebDriver framework](#rspec)
15
+ - [Instantly create a fresh Watir-Cucumber-WebDriver framework](#watir-cuke)
16
+ - [Instantly create a fresh Watir-RSpec-WebDriver framework](#watir-rspec)
17
+ - [Variables](#variables)
18
+ - [BROWSER](#browser)
19
+ - [TEST_URL](#test-url)
20
+ - [Contributing](#contributing)
21
+
22
+
23
+
24
+ ## Installation
25
+ There are multiple ways in which you can install and use testnow gem.
26
+ You must have Ruby installed before you can install this gem.
27
+
28
+ ### <a name="gem" /> 1. Install using gem command
29
+ Just use following command from you Terminal.
8
30
  ```
9
31
  gem install testnow
10
32
  ```
11
-
12
- or you can include it in your Gemfile and run bundle install
33
+
34
+ ### <a name="bundler" /> 2. Install using bundler
35
+ You can include it in your Gemfile and run bundle install
13
36
 
14
37
  ```
15
38
  gem 'testnow'
16
- ```
39
+ ```
40
+ then run following
41
+ ```
42
+ bundle install
43
+ ```
17
44
 
18
45
 
19
- ## Usage
46
+ ## Setup
20
47
 
21
- ### 1. Instant Cross Browser Configuration -- TestNow Platform Compatibility
22
- When creating a Selenium-WebDriver automation suite, if one requires cross browser testing, the biggest headache is configuring all browsers mainly because configurations for every browser is done differently. This is where TestNow gem jumps in as an Asprin to cure your headache by taking care of all browser configurations.
48
+ ### <a name="cross"></a> 1. Cross browser configuration using testnow for your existing project
49
+ When creating a Selenium-WebDriver automation suite, if one requires cross browser testing, the biggest headache is configuring all browsers mainly because configurations for every browser is done differently. This is where TestNow gem jumps in as an Asprin to cure your headache by taking care of browser configurations for you.
23
50
 
24
51
  Unlike some very famous Ruby-WebDriver tools which wraps up the WebDriver object and provides its own set of commands, TestNow gem returns you the ```driver``` object as is but initialized with any browser of your choice.
25
52
 
26
- In your existing automation suite, just put the following command in the setup method. (Setup method is where WebDriver is initialized with a certain browser and a driver object is created.)
53
+ In your existing automation suite, require and include the testnow gem in your config file
54
+ (i.e usually env.rb for cucumber or spec_helper for rspec depending on your framework)
55
+
56
+ ```
57
+ require 'testnow'
58
+
59
+ include TestNow # for basic webdriver framework
60
+
61
+ include TestNow::Watir # for watir webdriver framework
62
+ ```
63
+
64
+ now as everything is required, included and ready, just put the following command in the setup method. (Setup method is where WebDriver is initialized with a certain browser and a driver object is created. i.e hooks.rb file for cucumber)
27
65
 
28
66
  ```
29
67
  @driver = TestNow.init
@@ -31,8 +69,17 @@ In your existing automation suite, just put the following command in the setup m
31
69
 
32
70
  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.
33
71
 
72
+ ### <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.
74
+ This command line tool has multiple command and can be seen using help
75
+ Following are the list of commands:
76
+ <PUT IMAGE HERE>
77
+
78
+
79
+
80
+ ## Usage
34
81
 
35
- ### 2. Instant WebDriver-Ruby-Cucumber framework
82
+ ### <a name="cuke"></a> 1. Instantly create a fresh Cucumber-WebDriver framework
36
83
 
37
84
  ```
38
85
  testnow cucumber_now
@@ -44,13 +91,13 @@ cd cucumber_now # Navigate into the created directory
44
91
 
45
92
  Command 1 : cucumber features # Executes using cucumber gem executable
46
93
  or
47
- Command 2 : rake cucumber_now # Executes using cucumber rake task
94
+ Command 2 : rake testnow # Executes using cucumber rake task
48
95
  ```
49
96
 
50
97
  Use any of the command to execute the sample scenario. A beautiful, screenshot embedded report will be created by this execution to in the reports directory. It will be in html format, please double click or open in a browser to view it.
51
98
 
52
99
 
53
- ### 3. Instant WebDriver-Ruby-RSpec framework
100
+ ### <a name="rspec"></a> 2. Instantly create a fresh RSpec-WebDriver framework
54
101
 
55
102
  ```
56
103
  testnow rspec_now
@@ -61,10 +108,67 @@ This will run a series of commands and create a WebDriver-Ruby-RSpec framework f
61
108
  ```
62
109
  cd rspec_now # Navigate into the created directory
63
110
 
64
- rake rspec_now # Executes using cucumber rake task
111
+ rake testnow # Executes using cucumber rake task
65
112
  ```
66
113
 
67
114
  Use any of the command to execute the sample spec. A beautiful report will be created by this execution to in the reports directory. It will be in html format, please double click or open in a browser to view it.
115
+
116
+
117
+ ### <a name="watir-cuke"></a> 3. Instantly create a fresh Watir-Cucumber-WebDriver framework
118
+
119
+ ```
120
+ testnow watir_cucumber_now
121
+ ```
122
+ This will run a series of commands and create a WebDriver-Ruby-Cucumber framework for you in a directory called __watir_cucumber_now__. It will towards the end also ask you for gem dependency installation and it is highly recommended to say Yes. It will also create a sample scenario with a feature file and also a hooks and env file with all configurations. This scenario can be executed by simple command to see a demo of the execution.
123
+
124
+ ```
125
+ cd watir_cucumber_now # Navigate into the created directory
126
+
127
+ Command 1 : cucumber features # Executes using cucumber gem executable
128
+ or
129
+ Command 2 : rake testnow # Executes using cucumber rake task
130
+ ```
131
+
132
+ Use any of the command to execute the sample scenario. A beautiful, screenshot embedded report will be created by this execution to in the reports directory. It will be in html format, please double click or open in a browser to view it.
133
+
134
+
135
+ ### <a name="watir-rspec"></a> 4. Instantly create a fresh Watir-RSpec-WebDriver framework
136
+
137
+ ```
138
+ testnow rspec_now
139
+ ```
140
+
141
+ This will run a series of commands and create a WebDriver-Ruby-RSpec framework for you in a directory called __watir_rspec_now__. It will towards the end also ask you for gem dependency installation and it is highly recommended to say Yes. It will also create a sample scenario with a spec and spec_helper file with all configuration. This scenario can be executed by simple command to see a live demo of the execution.
142
+
143
+ ```
144
+ cd watir_rspec_now # Navigate into the created directory
145
+
146
+ rake testnow # Executes using cucumber rake task
147
+ ```
148
+
149
+ Use any of the command to execute the sample spec. A beautiful report will be created by this execution to in the reports directory. It will be in html format, please double click or open in a browser to view it.
150
+
151
+
152
+ ## Variables
153
+ ### <a name="browser"></a> 1. BROWSER
154
+ Using testnow for existing project or creating a fresh framework from the testnow command line tool, there an environment variable which is consumed by the execution which is called __BROWSER__. One can pass the browser of its choice to this variable to execute tests in different browsers. The default value is set to firefox.
155
+
156
+ For example, in above sample scenario.
157
+ ```
158
+ rake testnow BROWSER=chrome
159
+ or
160
+ rake testnow BROWSER=opera
161
+ ```
162
+
163
+ [NOTE: This will work provided you have webdrivers placed in PATH varibale. i.e chromedriver or operadriver]
164
+
165
+ ### <a name="test-url"></a> 2. TEST_URL
166
+ This variable currently only works if you create a framework from testnow command line tool. This variable is called __TEST_URL__ and it gives you the power to pass the test url as a parameter. As we know that there can be multiple test environment and not necessarily we would need to run our tests on 1 environment. So to avaoid changing the code, testnow provides exposure of test url.
167
+
168
+ For Example:
169
+ ```
170
+ rake testnow BROWSER=chrome TEST_URL=https://github.com
171
+ ```
68
172
 
69
173
 
70
174
  ## Contributing
@@ -0,0 +1,9 @@
1
+ require 'rake'
2
+ require 'rspec/core/rake_task'
3
+
4
+ namespace :testnow do
5
+ RSpec::Core::RakeTask.new('unit_test') do |t|
6
+ t.pattern = "spec/testnow/*_spec.rb"
7
+ end
8
+
9
+ end
@@ -4,8 +4,14 @@ require 'fileutils'
4
4
 
5
5
  @showtime_dir = File.join(File.dirname(__FILE__) + "/../data/showtime")
6
6
 
7
- def cucumber_now
8
- @root_dir = File.join(FileUtils.pwd, "cucumber_now")
7
+ def cucumber_now(framework="cucumber")
8
+
9
+ if framework == "watir"
10
+ @base = "watir_cucumber_now"
11
+ else
12
+ @base = "cucumber_now"
13
+ end
14
+ @root_dir = File.join(FileUtils.pwd, @base)
9
15
  @feature_dir = File.join(@root_dir,'features')
10
16
  @scenario_dir = File.join(@feature_dir, 'scenarios')
11
17
  @steps_dir = File.join(@feature_dir,'step_definition')
@@ -14,12 +20,19 @@ def cucumber_now
14
20
  @report_dir = File.join(@root_dir, 'reports')
15
21
 
16
22
  if File.exist?(@root_dir)
17
- print 'There is already cucumber_now directory. Either delete it or try running the command from some other directory.'
23
+ print 'There is already #{@base} directory. Either delete it or try running the command from some other directory.'
18
24
  exit 1
19
25
  end
20
- puts "\n"+"*"*70
21
- puts "* TestNow is creating a WebDriver-Ruby-Cucumber framework for you. *"
22
- puts "*"*70
26
+
27
+ if framework == "watir"
28
+ puts "\n"+"*"*76
29
+ puts "* TestNow is creating a Watir-WebDriver-Ruby-Cucumber framework for you. *"
30
+ puts "*"*76
31
+ else
32
+ puts "\n"+"*"*70
33
+ puts "* TestNow is creating a WebDriver-Ruby-Cucumber framework for you. *"
34
+ puts "*"*70
35
+ end
23
36
 
24
37
  print "Creating project directory."
25
38
  FileUtils.makedirs(@root_dir)
@@ -42,57 +55,84 @@ def cucumber_now
42
55
  print "Creating the reports directory where the reports will be save after execution."
43
56
  FileUtils.makedirs(@report_dir)
44
57
 
45
- print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
46
- FileUtils.copy(@showtime_dir+"/hooks.rb", @support_dir)
47
- print "Creating config files -- env.rb -- used as cucumber config"
48
- FileUtils.copy(@showtime_dir+"/env.rb", @support_dir)
49
-
50
58
  print "Creating feature file inside scenarios directory."
51
59
  FileUtils.copy(@showtime_dir+"/github.feature", @scenario_dir)
52
60
 
53
- print "Creating step definition file inside the steps directory"
54
- FileUtils.copy(@showtime_dir+"/github_steps.rb", @steps_dir)
61
+ if framework == "watir"
62
+ print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
63
+ FileUtils.copy(@showtime_dir+"/watir/hooks.rb", @support_dir)
64
+ print "Creating config files -- env.rb -- used as cucumber config"
65
+ FileUtils.copy(@showtime_dir+"/watir/env.rb", @support_dir)
55
66
 
56
- print "Creating page class file inside the page directory."
57
- FileUtils.copy(@showtime_dir+"/github_page.rb", @page_dir)
67
+ print "Creating step definition file inside the steps directory"
68
+ FileUtils.copy(@showtime_dir+"/watir/github_steps.rb", @steps_dir)
58
69
 
59
- print "Creating Gemfile -- used to contain all required gems information."
60
- FileUtils.copy(@showtime_dir+"/Gemfile", @root_dir)
70
+ print "Creating page class file inside the page directory."
71
+ FileUtils.copy(@showtime_dir+"/watir/github_page.rb", @page_dir)
61
72
 
62
- print "Creating cucumber.yml -- used to provide cucumber options"
63
- FileUtils.copy(@showtime_dir+"/cucumber.yml", @root_dir)
73
+ print "Creating Gemfile -- used to contain all required gems information."
74
+ FileUtils.copy(@showtime_dir+"/watir/Gemfile", @root_dir)
75
+ else
76
+ print "Creating config files -- hooks.rb -- used for setup and teardown purpose."
77
+ FileUtils.copy(@showtime_dir+"/hooks.rb", @support_dir)
78
+ print "Creating config files -- env.rb -- used as cucumber config"
79
+ FileUtils.copy(@showtime_dir+"/env.rb", @support_dir)
80
+
81
+ print "Creating step definition file inside the steps directory"
82
+ FileUtils.copy(@showtime_dir+"/github_steps.rb", @steps_dir)
83
+
84
+ print "Creating page class file inside the page directory."
85
+ FileUtils.copy(@showtime_dir+"/github_page.rb", @page_dir)
86
+
87
+ print "Creating Gemfile -- used to contain all required gems information."
88
+ FileUtils.copy(@showtime_dir+"/Gemfile", @root_dir)
89
+ end
64
90
 
65
91
  print "Creating Rakefile -- used to write automation execution tasks."
66
92
  FileUtils.copy(@showtime_dir+"/Rakefile", @root_dir)
93
+
94
+ print "Creating cucumber.yml -- used to provide cucumber options"
95
+ FileUtils.copy(@showtime_dir+"/cucumber.yml", @root_dir)
67
96
 
68
97
  puts "\n"+"*"*97
69
98
  puts "* TestNow completed framework creation. A sample scenario is also created for your reference. *"
70
99
  puts "*"*97
71
100
 
72
- puts "\n Would you like to continue with dependency(gems) installation? (Y/n) :"
101
+ puts "\nWould you like to continue with dependency(gems) installation? (Y/n) :"
73
102
  ans=gets
74
103
  if ans.chomp.downcase == "y"
75
104
  print "TestNow is installing gems using bundler. Please wait till process completed."
76
- system('bundle install --gemfile=$(pwd)/cucumber_now/Gemfile')
77
- print "Dependency installation completed successfully.\n"
105
+ system("bundle install --gemfile=$(pwd)/#{@base}/Gemfile")
106
+ print "Dependency installation completed successfully.\n\n"
78
107
  else
79
- print "You can do this later also. Just cd into cucumber_now directory and run 'bundle install'\n"
108
+ print "You can do this later also. Just cd into cucumber_now directory and run 'bundle install'\n\n"
80
109
  exit 1
81
110
  end
82
111
 
83
112
  puts "\n"+"*"*80
84
- puts "* Congratulations!!! Your WenDriver-Ruby-Cucumber framework is ready to use. *"
85
- puts "* To run the sample reference test, please cd into cucumber_now directory *"
86
- puts "* and run the command 'cucumber features' or 'rake cucumber_now' *"
113
+ if framework == "watir"
114
+ puts "* Congratulations!!! Your Watir-WebDriver-Ruby-Cucumber *"
115
+ puts "* framework is ready to use. *"
116
+ puts "* To run the sample test, please cd into watir_cucumber_now directory *"
117
+ else
118
+ puts "* Congratulations!!! Your WebDriver-Ruby-Cucumber framework is ready to use. *"
119
+ puts "* To run the sample test, please cd into cucumber_now directory *"
120
+ end
121
+ puts "* and run the command 'cucumber features' or 'rake testnow' *"
87
122
  puts "* A beautiful screenshot embedded report will be created in reports directory. *"
88
123
  puts "* !!! HAPPY AUTOMATION !!! *"
89
- puts "*"*80+"\n"
124
+ puts "*"*80+"\n\n\n"
90
125
 
91
126
  end
92
127
 
93
128
 
94
- def rspec_now
95
- @root_dir = File.join(FileUtils.pwd, "rspec_now")
129
+ def rspec_now(framework="cucumber")
130
+ if framework == "watir"
131
+ @base = "watir_rspec_now"
132
+ else
133
+ @base = "rspec_now"
134
+ end
135
+ @root_dir = File.join(FileUtils.pwd, @base)
96
136
  @spec_dir = File.join(@root_dir, "spec")
97
137
  @scenario_dir = File.join(@spec_dir, "scenarios")
98
138
  @pages_dir = File.join(@root_dir, "pages")
@@ -101,9 +141,16 @@ def rspec_now
101
141
  print 'There is already rspec_now directory. Either delete it or try running the command from some other directory.'
102
142
  exit 1
103
143
  end
104
- puts "\n"+"*"*67
105
- puts "* TestNow is creating a WebDriver-Ruby-RSpec framework for you. *"
106
- puts "*"*67
144
+
145
+ if framework == "watir"
146
+ puts "\n"+"*"*73
147
+ puts "* TestNow is creating a Watir-WebDriver-Ruby-RSpec framework for you. *"
148
+ puts "*"*73
149
+ else
150
+ puts "\n"+"*"*67
151
+ puts "* TestNow is creating a WebDriver-Ruby-RSpec framework for you. *"
152
+ puts "*"*67
153
+ end
107
154
 
108
155
  print "Creating project directory."
109
156
  FileUtils.makedirs(@root_dir)
@@ -117,36 +164,56 @@ def rspec_now
117
164
  print "Creating the page directory just in case if you want to use page object pattern."
118
165
  FileUtils.makedirs(@pages_dir)
119
166
 
120
- print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
121
- FileUtils.copy(@showtime_dir+"/spec_helper.rb", @spec_dir)
167
+ if framework == "watir"
168
+ print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
169
+ FileUtils.copy(@showtime_dir+"/watir/spec_helper.rb", @spec_dir)
122
170
 
123
- print "Creating Gemfile -- used to contain all required gems information."
124
- FileUtils.copy(@showtime_dir+"/Gemfile", @root_dir)
171
+ print "Creating Gemfile -- used to contain all required gems information."
172
+ FileUtils.copy(@showtime_dir+"/watir/Gemfile_rspec", @root_dir+"/Gemfile")
125
173
 
126
- print "Creating Rakefile -- used to write automation execution tasks."
127
- FileUtils.copy(@showtime_dir+"/Rakefile_rspec", @root_dir+"/Rakefile")
174
+ print "Creating spec file inside the scenarios directory."
175
+ FileUtils.copy(@showtime_dir+"/watir/github_spec.rb", @scenario_dir)
176
+
177
+ print "Creating page class file inside the pages directory."
178
+ FileUtils.copy(@showtime_dir+"/watir/github_page.rb", @pages_dir)
179
+ else
180
+ print "Creating config file -- spec_helper.rb -- used for dependency declaration and global setup-teardown"
181
+ FileUtils.copy(@showtime_dir+"/spec_helper.rb", @spec_dir)
182
+
183
+ print "Creating Gemfile -- used to contain all required gems information."
184
+ FileUtils.copy(@showtime_dir+"/Gemfile_rspec", @root_dir+"/Gemfile")
128
185
 
129
- print "Creating spec file inside the scenarios directory."
130
- FileUtils.copy(@showtime_dir+"/github_spec.rb", @scenario_dir)
186
+ print "Creating spec file inside the scenarios directory."
187
+ FileUtils.copy(@showtime_dir+"/github_spec.rb", @scenario_dir)
131
188
 
132
- print "Creating page class file inside the pages directory."
133
- FileUtils.copy(@showtime_dir+"/github_page.rb", @pages_dir)
189
+ print "Creating page class file inside the pages directory."
190
+ FileUtils.copy(@showtime_dir+"/github_page.rb", @pages_dir)
191
+ end
192
+
193
+ print "Creating Rakefile -- used to write automation execution tasks."
194
+ FileUtils.copy(@showtime_dir+"/Rakefile_rspec", @root_dir+"/Rakefile")
134
195
 
135
196
  puts "\n Would you like to continue with dependency(gems) installation? (Y/n) :"
136
197
  ans=gets
137
198
  if ans.chomp.downcase == "y"
138
199
  print "TestNow is installing gems using bundler. Please wait till process completed."
139
- system('bundle install --gemfile=$(pwd)/rspec_now/Gemfile')
200
+ system("bundle install --gemfile=$(pwd)/#{@base}/Gemfile")
140
201
  print "Dependency installation completed successfully.\n"
141
202
  else
142
- print "You can do this later. Just cd into rspec_now directory and run 'bundle install'\n"
203
+ print "You can do this later. Just cd into #{@base} directory and run 'bundle install'\n\n"
143
204
  exit 1
144
205
  end
145
206
 
146
207
  puts "\n"+"*"*77
147
- puts "* Congratulations!!! Your WenDriver-Ruby-RSpec framework is ready to use. *"
148
- puts "* To run the sample reference test, please cd into rspec_now directory *"
149
- puts "* and run the command 'rake rspec_now'. Enjoy the show!!! *"
208
+ if framework == "watir"
209
+ puts "* Congratulations!!! Your Watir-WebDriver-RSpec-Ruby *"
210
+ puts "* framework is ready to use. *"
211
+ puts "* To run the sample test, please cd into watir_rspec_now directory *"
212
+ else
213
+ puts "* Congratulations!!! Your WebDriver-RSpec-Ruby framework is ready to use. *"
214
+ puts "* To run the sample test, please cd into rspec_now directory *"
215
+ end
216
+ puts "* and run the command 'rake testnow'. Enjoy the show!!! *"
150
217
  puts "* A beautiful descriptive report will be created in reports directory. *"
151
218
  puts "* !!! HAPPY AUTOMATION !!! *"
152
219
  puts "*"*77+"\n"
@@ -156,8 +223,8 @@ end
156
223
 
157
224
  def print(msg)
158
225
  puts "\n"
159
- puts "=>=>=>=>=> " + msg
160
- sleep 1
226
+ puts "=>=>=> " + msg
227
+ sleep 0.5
161
228
  end
162
229
 
163
230
  def print_help
@@ -169,21 +236,30 @@ def print_help
169
236
  help
170
237
  cucumber_now
171
238
  rspec_now
239
+ watir_cucumber_now
240
+ watir_rspec_now
172
241
  version
173
242
 
174
243
 
175
244
  Command descriptions :
245
+
176
246
  help : Prints help information in detail.
177
247
 
178
248
  cucumber_now : Creates a WebDriver-Ruby-Cucumber skeleton framework for cross
179
249
  browser automation testing. Also creates a sample scenario for
180
- reference which can be used to add more features(tests). This
181
- framework is compatible with TestNow platform.
250
+ reference which can be used to add more features(tests).
182
251
 
183
252
  rspec_now : Creates a WebDriver-Ruby-RSpec skeleton framework for cross
184
253
  browser automation testing. Also creates a sample scenario for
185
- reference which can be used to add more specs(tests). This
186
- framework is compatible with TestNow platform.
254
+ reference which can be used to add more specs(tests).
255
+
256
+ watir_cucumber_now : Creates a Watir-WebDriver-Ruby-Cucumber skeleton framework for
257
+ cross browser automation testing. Also creates a sample scenario
258
+ for reference which can be used to add more features(tests).
259
+
260
+ watir_rspec_now : Creates a Watir-WebDriver-Ruby-RSpec skeleton framework for cross
261
+ browser automation testing. Also creates a sample scenario for
262
+ reference which can be used to add more specs(tests).
187
263
 
188
264
  version : Prints the gem version
189
265
 
@@ -200,6 +276,10 @@ else
200
276
  cucumber_now
201
277
  elsif cmd == 'rspec_now'
202
278
  rspec_now
279
+ elsif cmd == 'watir_cucumber_now'
280
+ cucumber_now("watir")
281
+ elsif cmd == 'watir_rspec_now'
282
+ rspec_now("watir")
203
283
  elsif cmd == 'version'
204
284
  puts File.read(File.expand_path("../../lib/testnow/version", __FILE__))
205
285
  else
@@ -1,6 +1,5 @@
1
1
  source "http://rubygems.org"
2
2
  gem 'selenium-webdriver'
3
- gem 'cucumber'
4
3
  gem 'rspec'
5
4
  gem 'rake'
6
5
  gem 'testnow'
@@ -1,5 +1,5 @@
1
1
  require 'cucumber/rake/task'
2
2
 
3
- Cucumber::Rake::Task.new('cucumber_now') do |feature|
3
+ Cucumber::Rake::Task.new('testnow') do |feature|
4
4
  feature.cucumber_opts = 'features --profile default'
5
5
  end
@@ -1,7 +1,7 @@
1
1
  require 'rake'
2
2
  require 'rspec/core/rake_task'
3
3
 
4
- RSpec::Core::RakeTask.new("rspec_now") do |role|
4
+ RSpec::Core::RakeTask.new("testnow") do |role|
5
5
  role.pattern="spec/scenarios/*_spec.rb"
6
6
  role.rspec_opts = ["--format", "html", "--out", "reports/github.html"]
7
7
  end
@@ -6,6 +6,6 @@ Feature: As a github user
6
6
  Given I am on github page
7
7
  When I search for "Kaushal Rupani" keyword
8
8
  And I follow the Users Tab
9
- Then I verify "Kaushal Rupani" is displayed
9
+ Then I verify "Kaushal" is displayed
10
10
  When I follow username link to view the profile page
11
11
  Then I verify "Kaushal Rupani" is displayed
@@ -10,7 +10,7 @@ describe "As a github user, my public profile" do
10
10
  git = GithubPage.new(@driver)
11
11
  git.search_github("Kaushal Rupani")
12
12
  git.click_tab("Users")
13
- git.verify_text_presence("Kaushal Rupani")
13
+ git.verify_text_presence("Kaushal")
14
14
  git.visit_profile
15
15
  git.verify_text_presence("Kaushal Rupani")
16
16
  end
@@ -1,8 +1,9 @@
1
1
  Given /^I am on github page$/ do
2
- @driver.get("https://github.com")
2
+ ENV['TEST_URL'] = "https://github.com" if ENV['TEST_URL'].nil?
3
+ @driver.get(ENV['TEST_URL'])
3
4
  end
4
5
 
5
- When /^I search for "([^"]*)" keyword$/ do |key|
6
+ When (/^I search for "([^"]*)" keyword$/) do |key|
6
7
  home = GithubPage.new(@driver)
7
8
  home.search_github(key)
8
9
  end
@@ -17,7 +18,7 @@ When /^I follow username link to view the profile page$/ do
17
18
  home.visit_profile
18
19
  end
19
20
 
20
- Then /^I verify "([^"]*)" is displayed$/ do |name|
21
+ Then (/^I verify "([^"]*)" is displayed$/) do |name|
21
22
  home = GithubPage.new(@driver)
22
23
  home.verify_text_presence(name)
23
24
  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 'testnow'
7
+ gem 'watir-webdriver'
@@ -0,0 +1,7 @@
1
+ source "http://rubygems.org"
2
+ gem 'selenium-webdriver'
3
+ gem 'cucumber'
4
+ gem 'rspec'
5
+ gem 'rake'
6
+ gem 'testnow'
7
+ gem 'watir-webdriver'
@@ -0,0 +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
9
+ include TestNow::Watir
@@ -0,0 +1,29 @@
1
+ class GithubPage
2
+
3
+ def initialize(page_browser)
4
+ @browser = page_browser
5
+ end
6
+
7
+ def search_github(key)
8
+ @browser.text_field(:name => "q").set "#{key}\n"
9
+ end
10
+
11
+ def click_tab(tab)
12
+ case tab
13
+ when "Users"
14
+ @browser.element(:css => ".menu>a[href*=Users]").click
15
+ @browser.element(:id => "user_search_results").wait_until_present(timeout=30)
16
+ else
17
+ puts "Wrong tab buddy!!"
18
+ end
19
+ end
20
+
21
+ def visit_profile
22
+ @browser.link(:text => "krupani").click
23
+ end
24
+
25
+ def verify_text_presence(word)
26
+ expect(@browser.element(:text => word).present?).to be true
27
+ end
28
+
29
+ end
@@ -0,0 +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
+
18
+ end
@@ -0,0 +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)
24
+ end
@@ -0,0 +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
40
+ end
@@ -0,0 +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,29 +1,60 @@
1
- require 'selenium-webdriver'
2
1
  require 'testnow/chrome'
3
2
  require 'testnow/opera'
4
3
  require 'testnow/firefox'
5
4
  require 'testnow/android'
6
5
  require 'testnow/android_chrome'
7
- require 'testnow/internet_explorer'
6
+ require 'testnow/ie'
8
7
 
9
8
  module TestNow
10
9
 
11
10
  def init
12
11
  ENV['BROWSER'] = "firefox" if ENV['BROWSER'].nil?
13
12
  case ENV['BROWSER'].downcase
14
- when "chrome"
15
- TestNow.launch_driver_chrome
16
- when "android"
17
- TestNow.launch_driver_android
18
- when "opera"
19
- TestNow.launch_driver_opera
20
- when "androidchrome"
21
- TestNow.launch_driver_android_chrome
22
- when "ie"
23
- TestNow.launch_driver_ie
24
- else
25
- TestNow.launch_driver_firefox
26
- end
27
- end
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
37
+ when "chrome"
38
+ chrome = Chrome.new
39
+ chrome.launch_watir_chrome
40
+ when "android"
41
+ TestNow.launch_watir_android
42
+ when "opera"
43
+ opera = Opera.new
44
+ opera.launch_watir_opera
45
+ when "androidchrome"
46
+ ac = AndroidChrome.new
47
+ ac.launch_watir_android_chrome
48
+ when "ie"
49
+ ie = IE.new
50
+ ie.launch_watir_ie
51
+ else
52
+ ff = Firefox.new
53
+ ff.launch_watir_firefox
54
+ end
55
+ end
56
+ end
57
+
58
+ end
59
+
28
60
 
29
- end
@@ -1,12 +1,27 @@
1
- module TestNow
2
-
3
- def launch_driver_android_chrome
4
- client = Selenium::WebDriver::Remote::Http::Default.new
5
- client.timeout = 120
6
- caps = {'chromeOptions'=> {'androidPackage' => 'com.android.chrome'}}
7
- @driver = Selenium::WebDriver.for(:remote, :http_client => client, :url => "http://localhost:9515", :desired_capabilities => caps)
8
- @driver.manage.timeouts.implicit_wait = 60
9
- @driver
10
- end
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
11
26
 
12
27
  end
@@ -1,5 +1,4 @@
1
- module TestNow
2
-
1
+ class Chrome
3
2
 
4
3
  # Chrome Browser
5
4
  def launch_driver_chrome
@@ -9,5 +8,13 @@ module TestNow
9
8
  @driver.manage.window.maximize
10
9
  return @driver
11
10
  end
11
+
12
+ def launch_watir_chrome
13
+ browser = Watir::Browser.new :chrome
14
+ browser.driver.manage.timeouts.implicit_wait = 30
15
+ browser.driver.manage.timeouts.page_load = 120
16
+ browser.driver.manage.window.maximize
17
+ return browser
18
+ end
12
19
 
13
20
  end
@@ -1,4 +1,5 @@
1
- module TestNow
1
+ # module TestNow
2
+ class Firefox
2
3
 
3
4
  #Firefox browser
4
5
  def launch_driver_firefox
@@ -41,4 +42,12 @@ module TestNow
41
42
  end
42
43
  end
43
44
 
45
+ def launch_watir_firefox
46
+ browser = Watir::Browser.new
47
+ browser.driver.manage.timeouts.implicit_wait = 30
48
+ browser.driver.manage.timeouts.page_load = 120
49
+ browser.driver.manage.window.maximize
50
+ return browser
51
+ end
52
+
44
53
  end
@@ -0,0 +1,38 @@
1
+ class IE
2
+
3
+ @private
4
+ def ie_config
5
+ @client = Selenium::WebDriver::Remote::Http::Default.new
6
+ @client.timeout = 120
7
+ @caps = Selenium::WebDriver::Remote::Capabilities.ie('ie.ensureCleanSession' => true, :javascript_enabled => true, :http_client => client, :native_events => false, :acceptSslCerts => true)
8
+ end
9
+
10
+ @private
11
+ def set_ie_config(driver)
12
+ driver.manage.timeouts.implicit_wait = 90
13
+ driver.manage.timeouts.page_load = 120
14
+ if ENV['RESOLUTION'].nil?
15
+ driver.manage.window.size = Selenium::WebDriver::Dimension.new(1366,768)
16
+ elsif ENV['RESOLUTION'].downcase == "max"
17
+ driver.manage.window.maximize
18
+ else
19
+ res = ENV['RESOLUTION'].split('x')
20
+ driver.manage.window.size = Selenium::WebDriver::Dimension.new(res.first.to_i, res.last.to_i)
21
+ end
22
+ end
23
+
24
+ def launch_driver_ie
25
+ self.ie_config
26
+ driver = Selenium::WebDriver.for(:ie, :desired_capabilities => @caps, :http_client => @client)
27
+ self.set_ie_config(driver)
28
+ return driver
29
+ end
30
+
31
+ def launch_watir_ie
32
+ self.ie_config
33
+ browser = Watir::Browser.new(:ie, :desired_capabilities => @caps, :http_client => @client)
34
+ self.set_ie_config(browser.driver)
35
+ return browser
36
+ end
37
+
38
+ end
@@ -1,18 +1,31 @@
1
- module TestNow
1
+ class Opera
2
2
 
3
+ @private
4
+ def opera_config
5
+ @client = Selenium::WebDriver::Remote::Http::Default.new
6
+ @client.timeout = 180 # seconds
7
+ @service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/operadriver", 48923)
8
+ @service.start
9
+ @cap = Selenium::WebDriver::Remote::Capabilities.chrome('operaOptions' => {'binary' => "#{get_binary_path}", 'args' => ["--ignore-certificate-errors"]})
10
+ end
3
11
 
4
- #Opera browser
12
+ # Opera browser
5
13
  def launch_driver_opera
6
- client = Selenium::WebDriver::Remote::Http::Default.new
7
- client.timeout = 180 # seconds
8
- service = Selenium::WebDriver::Chrome::Service.new("/usr/local/bin/operadriver", 48923)
9
- service.start
10
- cap = Selenium::WebDriver::Remote::Capabilities.chrome('operaOptions' => {'binary' => "#{get_binary_path}", 'args' => ["--ignore-certificate-errors"]})
11
- @driver = Selenium::WebDriver.for(:remote, :url => service.uri, :desired_capabilities => cap, :http_client => client)
12
- @driver.manage.timeouts.implicit_wait = 30
13
- @driver.manage.window.maximize
14
- @driver.manage.timeouts.page_load = 120
15
- return @driver
14
+ self.opera_config
15
+ @driver = Selenium::WebDriver.for(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
16
+ @driver.manage.timeouts.implicit_wait = 30
17
+ @driver.manage.window.maximize
18
+ @driver.manage.timeouts.page_load = 120
19
+ return @driver
20
+ end
21
+
22
+ def launch_watir_opera
23
+ self.opera_config
24
+ browser = Watir::Browser.new(:remote, :url => @service.uri, :desired_capabilities => @cap, :http_client => @client)
25
+ browser.driver.manage.timeouts.implicit_wait = 30
26
+ browser.driver.manage.window.maximize
27
+ browser.driver.manage.timeouts.page_load = 120
28
+ return browser
16
29
  end
17
30
 
18
31
 
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
metadata CHANGED
@@ -1,22 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: testnow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
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-20 00:00:00.000000000 Z
11
+ date: 2016-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: 1.11.2
20
17
  - - ">="
21
18
  - !ruby/object:Gem::Version
22
19
  version: 1.10.0
@@ -24,9 +21,6 @@ dependencies:
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
26
23
  requirements:
27
- - - "~>"
28
- - !ruby/object:Gem::Version
29
- version: 1.11.2
30
24
  - - ">="
31
25
  - !ruby/object:Gem::Version
32
26
  version: 1.10.0
@@ -34,9 +28,6 @@ dependencies:
34
28
  name: selenium-webdriver
35
29
  requirement: !ruby/object:Gem::Requirement
36
30
  requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '2.52'
40
31
  - - ">="
41
32
  - !ruby/object:Gem::Version
42
33
  version: '2.52'
@@ -44,14 +35,24 @@ dependencies:
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
46
37
  requirements:
47
- - - "~>"
38
+ - - ">="
48
39
  - !ruby/object:Gem::Version
49
40
  version: '2.52'
41
+ - !ruby/object:Gem::Dependency
42
+ name: watir-webdriver
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
50
45
  - - ">="
51
46
  - !ruby/object:Gem::Version
52
- version: '2.52'
53
- description: A gem to configure your WebDriver-Ruby automation suite for TestNow and
54
- local
47
+ version: 0.9.1
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: 0.9.1
55
+ description: A gem to configure your WebDriver-Ruby automation framework.
55
56
  email: kushrupani@live.com
56
57
  executables:
57
58
  - testnow
@@ -60,6 +61,7 @@ extra_rdoc_files: []
60
61
  files:
61
62
  - LICENCE
62
63
  - README.md
64
+ - Rakefile
63
65
  - bin/testnow
64
66
  - data/firebug-2.0.13.xpi
65
67
  - data/netExport-0.8.xpi
@@ -75,12 +77,20 @@ files:
75
77
  - data/showtime/github_steps.rb
76
78
  - data/showtime/hooks.rb
77
79
  - data/showtime/spec_helper.rb
80
+ - data/showtime/watir/Gemfile
81
+ - data/showtime/watir/Gemfile_rspec
82
+ - data/showtime/watir/env.rb
83
+ - data/showtime/watir/github_page.rb
84
+ - data/showtime/watir/github_spec.rb
85
+ - data/showtime/watir/github_steps.rb
86
+ - data/showtime/watir/hooks.rb
87
+ - data/showtime/watir/spec_helper.rb
78
88
  - lib/testnow.rb
79
89
  - lib/testnow/android.rb
80
90
  - lib/testnow/android_chrome.rb
81
91
  - lib/testnow/chrome.rb
82
92
  - lib/testnow/firefox.rb
83
- - lib/testnow/internet_explorer.rb
93
+ - lib/testnow/ie.rb
84
94
  - lib/testnow/opera.rb
85
95
  - lib/testnow/version
86
96
  - spec/spec_helper.rb
@@ -89,7 +99,8 @@ homepage: https://github.com/krupani/testnow
89
99
  licenses:
90
100
  - MIT
91
101
  metadata: {}
92
- post_install_message: "=>=>=>=>=> Thank you for installing TestNow gem. <=<=<=<=<= "
102
+ post_install_message: "\n\n=>=>=>=>=> Thank you for installing TestNow gem. <=<=<=<=<=
103
+ \n\n"
93
104
  rdoc_options: []
94
105
  require_paths:
95
106
  - lib
@@ -112,3 +123,4 @@ summary: 'TestNow gem : Automate in a BDD + Cross Browser style'
112
123
  test_files:
113
124
  - spec/spec_helper.rb
114
125
  - spec/testnow/testnow_spec.rb
126
+ - Rakefile
@@ -1,21 +0,0 @@
1
- module TestNow
2
-
3
- def launch_driver_ie
4
- client = Selenium::WebDriver::Remote::Http::Default.new
5
- client.timeout = 120
6
- caps = Selenium::WebDriver::Remote::Capabilities.ie('ie.ensureCleanSession' => true, :javascript_enabled => true, :http_client => client, :native_events => false, :acceptSslCerts => true)
7
- @driver = Selenium::WebDriver.for(:ie, :desired_capabilities => caps)
8
- @driver.manage.timeouts.implicit_wait = 90
9
- @driver.manage.timeouts.page_load = 120
10
- if ENV['RESOLUTION'].nil?
11
- @driver.manage.window.size = Selenium::WebDriver::Dimension.new(1366,768)
12
- elsif ENV['RESOLUTION'].downcase == "max"
13
- @driver.manage.window.maximize
14
- else
15
- res = ENV['RESOLUTION'].split('x')
16
- @driver.manage.window.size = Selenium::WebDriver::Dimension.new(res.first.to_i, res.last.to_i)
17
- end
18
- @driver
19
- end
20
-
21
- end