soda 1.3.4 → 1.3.5
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.
- data/lib/Soda.rb +78 -19
- data/lib/SodaElements.xml +77 -1
- data/lib/SodaFireFox.rb +6 -11
- data/lib/SodaLogReporter.rb +1 -1
- data/lib/SodaUtils.rb +219 -0
- data/lib/sodainfo.rb +1 -1
- metadata +4 -4
data/lib/Soda.rb
CHANGED
@@ -233,6 +233,8 @@ class Soda
|
|
233
233
|
Watir::Browser.default = @params['browser']
|
234
234
|
end
|
235
235
|
|
236
|
+
# sleeping here because watir has issues if a new browsers comes up
|
237
|
+
# after a firefox process is killed.
|
236
238
|
sleep(10)
|
237
239
|
|
238
240
|
if (@params['browser'] =~ /firefox/i)
|
@@ -815,32 +817,18 @@ class Soda
|
|
815
817
|
###############################################################################
|
816
818
|
def RestartBrowserTest(suitename)
|
817
819
|
|
818
|
-
# if (!@GotWatchDog)
|
819
|
-
# begin
|
820
|
-
# @browser.close()
|
821
|
-
# sleep(1)
|
822
|
-
# rescue Exception => e
|
823
|
-
# end
|
824
|
-
# @GotWatchDog = false
|
825
|
-
# end
|
826
|
-
|
827
820
|
RestartGlobalTime()
|
828
821
|
|
829
822
|
if (@params['browser'] =~ /firefox/i)
|
830
|
-
print "Calling: SodaFireFox.KillProcesses().\n"
|
831
823
|
SodaFireFox.KillProcesses()
|
832
|
-
print "Finished: Calling SodaFireFox.KillProcesses().\n"
|
833
824
|
end
|
834
825
|
|
835
|
-
print "Calling: NewBrowser().\n"
|
836
826
|
err = NewBrowser()
|
837
827
|
if (err != 0)
|
838
828
|
print "(!)Failed to restart browser!\n"
|
839
829
|
end
|
840
|
-
print "Finished: Calling NewBrowser().\n"
|
841
830
|
|
842
831
|
if (!@restart_test.empty?)
|
843
|
-
print "Starting Restart Test: #{@restart_test}.\n"
|
844
832
|
resultdir = "#{@resultsDir}/#{suitename}"
|
845
833
|
@rep = SodaReporter.new(@restart_test, @saveHtml, resultdir,
|
846
834
|
0, nil, false);
|
@@ -849,7 +837,6 @@ class Soda
|
|
849
837
|
handleEvents(restart_script)
|
850
838
|
@rep.log("Finished: Browser restart.\n")
|
851
839
|
@rep.EndTestReport()
|
852
|
-
print "Finished Restart Test.\n"
|
853
840
|
end
|
854
841
|
|
855
842
|
RestartGlobalTime()
|
@@ -1833,22 +1820,37 @@ class Soda
|
|
1833
1820
|
def CheckJavaScriptErrors()
|
1834
1821
|
result = nil
|
1835
1822
|
data = nil
|
1823
|
+
error_hash = {}
|
1836
1824
|
|
1837
1825
|
if (Watir::Browser.default == "firefox")
|
1838
1826
|
result = @browser.execute_script(
|
1839
1827
|
"#{SodaUtils::FIREFOX_JS_ERROR_CHECK_SRC}")
|
1840
1828
|
data = result.split(/######/)
|
1841
1829
|
data.each do |line|
|
1830
|
+
line = line.chomp()
|
1831
|
+
|
1842
1832
|
if ( (line != "") &&
|
1843
1833
|
(line !~ /chrome:\/\/browser\/content\/tabbrowser\.xm/) &&
|
1844
1834
|
(line !~ /SShStarter.js/i ))
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1835
|
+
if (error_hash.key?(line))
|
1836
|
+
error_hash[line] += 1
|
1837
|
+
else
|
1838
|
+
error_hash[line] = 1
|
1839
|
+
end
|
1848
1840
|
end
|
1849
1841
|
end
|
1850
1842
|
end
|
1851
1843
|
|
1844
|
+
error_hash.each do |error, count|
|
1845
|
+
if (count > 1)
|
1846
|
+
msg = "Javascript Error (repeated #{count} times):#{error}\n"
|
1847
|
+
else
|
1848
|
+
msg = "Javascript Error:#{error}\n"
|
1849
|
+
end
|
1850
|
+
|
1851
|
+
@rep.ReportJavaScriptError(msg, $skip_css_errors)
|
1852
|
+
end
|
1853
|
+
|
1852
1854
|
return 0
|
1853
1855
|
end
|
1854
1856
|
|
@@ -2114,7 +2116,9 @@ JSCode
|
|
2114
2116
|
'link',
|
2115
2117
|
'append',
|
2116
2118
|
'disabled',
|
2117
|
-
'jscriptevent'
|
2119
|
+
'jscriptevent',
|
2120
|
+
'cssprop',
|
2121
|
+
'cssvalue'
|
2118
2122
|
]
|
2119
2123
|
|
2120
2124
|
if (@SIGNAL_STOP != false)
|
@@ -2149,6 +2153,8 @@ JSCode
|
|
2149
2153
|
end
|
2150
2154
|
|
2151
2155
|
case (foundaction)
|
2156
|
+
when /cssprop|cssvalue/i
|
2157
|
+
cssInfoEvent(event)
|
2152
2158
|
when "jscriptevent"
|
2153
2159
|
fieldType.jsevent(@curEl, js, true)
|
2154
2160
|
js_fired = true
|
@@ -2325,6 +2331,59 @@ JSCode
|
|
2325
2331
|
|
2326
2332
|
end
|
2327
2333
|
|
2334
|
+
###############################################################################
|
2335
|
+
# cssInfoEvent -- method
|
2336
|
+
# This method checks that css values for a given soda element.
|
2337
|
+
#
|
2338
|
+
# Input:
|
2339
|
+
# event: A soda event.
|
2340
|
+
#
|
2341
|
+
# Output:
|
2342
|
+
# returns 0 on success or -1 on error.
|
2343
|
+
#
|
2344
|
+
###############################################################################
|
2345
|
+
def cssInfoEvent(event)
|
2346
|
+
jssh_var = ""
|
2347
|
+
jssh_data = nil
|
2348
|
+
css_data = nil
|
2349
|
+
|
2350
|
+
if (!event.key?('cssprop'))
|
2351
|
+
@rep.ReportFailure("Missing attribte: 'cssprop' on line: "+
|
2352
|
+
"#{event[line_number]}!\n")
|
2353
|
+
return -1
|
2354
|
+
elsif (!event.key?('cssvalue'))
|
2355
|
+
@rep.ReportFailure("Missing attribte: 'cssvalue' on line: "+
|
2356
|
+
"#{event['line_number']}!\n")
|
2357
|
+
return -1
|
2358
|
+
end
|
2359
|
+
|
2360
|
+
event['cssprop'] = replaceVars(event['cssprop'])
|
2361
|
+
event['cssvalue'] = replaceVars(event['cssvalue'])
|
2362
|
+
|
2363
|
+
if (@params['browser'] =~ /firefox/i)
|
2364
|
+
css_data = SodaUtils.GetFireFoxStyle(@curEl, event['cssprop'],
|
2365
|
+
@rep, @browser)
|
2366
|
+
elsif (@params['browser'] =~ /ie/i)
|
2367
|
+
css_data = SodaUtils.GetIEStyle(@curEl, event['cssprop'], @rep)
|
2368
|
+
end
|
2369
|
+
|
2370
|
+
return -1 if (css_data == nil)
|
2371
|
+
|
2372
|
+
if (event['cssvalue'] == "#{css_data}")
|
2373
|
+
msg = "CSS property '#{event['cssprop']}' => "+
|
2374
|
+
"'#{css_data}'"
|
2375
|
+
@rep.Assert(true, msg)
|
2376
|
+
else
|
2377
|
+
msg = "CSS propery '#{event['cssprop']}' => "+
|
2378
|
+
"'#{css_data}' was expecting value: "+
|
2379
|
+
"'#{event['cssvalue']}'!"
|
2380
|
+
@rep.Assert(false, msg, @currentTestFile,
|
2381
|
+
"#{event['line_number']}")
|
2382
|
+
end
|
2383
|
+
|
2384
|
+
return 0
|
2385
|
+
end
|
2386
|
+
|
2328
2387
|
###############################################################################
|
2329
2388
|
# crazyEvilIETabHack -- Method
|
2330
2389
|
# This method make ie's tab pages act like firefox's in the since that,
|
data/lib/SodaElements.xml
CHANGED
@@ -72,6 +72,11 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
72
72
|
<accessor type="string">jscriptevent</accessor>
|
73
73
|
<accessor type="boolean">exists</accessor>
|
74
74
|
</accessor_attributes>
|
75
|
+
|
76
|
+
<soda_attributes>
|
77
|
+
<accessor type="string">cssprop</accessor>
|
78
|
+
<accessor type="string">cssvalue</accessor>
|
79
|
+
</soda_attributes>
|
75
80
|
</filefield>
|
76
81
|
|
77
82
|
<browser>
|
@@ -85,7 +90,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
85
90
|
<name>refresh</name>
|
86
91
|
<name>forward</name>
|
87
92
|
</action>
|
88
|
-
|
93
|
+
<accessor type="string">cssprop</accessor>
|
94
|
+
<accessor type="string">cssvalue</accessor>
|
89
95
|
<accessor type="string">assertnot</accessor>
|
90
96
|
<accessor type="string">assert</accessor>
|
91
97
|
<accessor type="string">url</accessor>
|
@@ -121,6 +127,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
121
127
|
<accessor type="boolean">jswait</accessor>
|
122
128
|
<accessor type="boolean">disabled</accessor>
|
123
129
|
<accessor type="boolean">exists</accessor>
|
130
|
+
<accessor type="string">cssprop</accessor>
|
131
|
+
<accessor type="string">cssvalue</accessor>
|
124
132
|
</soda_attributes>
|
125
133
|
</textfield>
|
126
134
|
|
@@ -143,6 +151,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
143
151
|
<accessor type="boolean">disabled</accessor>
|
144
152
|
<accessor type="string">jscriptevent</accessor>
|
145
153
|
<accessor type="boolean">exists</accessor>
|
154
|
+
<accessor type="string">cssprop</accessor>
|
155
|
+
<accessor type="string">cssvalue</accessor>
|
146
156
|
</soda_attributes>
|
147
157
|
</textarea>
|
148
158
|
|
@@ -157,6 +167,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
157
167
|
</accessor_attributes>
|
158
168
|
|
159
169
|
<soda_attributes>
|
170
|
+
<accessor type="string">cssprop</accessor>
|
171
|
+
<accessor type="string">cssvalue</accessor>
|
160
172
|
</soda_attributes>
|
161
173
|
</h3>
|
162
174
|
|
@@ -172,6 +184,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
172
184
|
</accessor_attributes>
|
173
185
|
|
174
186
|
<soda_attributes>
|
187
|
+
<accessor type="string">cssprop</accessor>
|
188
|
+
<accessor type="string">cssvalue</accessor>
|
175
189
|
</soda_attributes>
|
176
190
|
</label>
|
177
191
|
|
@@ -198,6 +212,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
198
212
|
<accessor type="boolean">jswait</accessor>
|
199
213
|
<accessor type="string">assertPage</accessor>
|
200
214
|
<accessor type="boolean">disabled</accessor>
|
215
|
+
<accessor type="string">cssprop</accessor>
|
216
|
+
<accessor type="string">cssvalue</accessor>
|
201
217
|
</soda_attributes>
|
202
218
|
</button>
|
203
219
|
|
@@ -212,6 +228,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
212
228
|
</accessor_attributes>
|
213
229
|
|
214
230
|
<soda_attributes>
|
231
|
+
<accessor type="string">cssprop</accessor>
|
232
|
+
<accessor type="string">cssvalue</accessor>
|
215
233
|
</soda_attributes>
|
216
234
|
</h4>
|
217
235
|
|
@@ -226,6 +244,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
226
244
|
</accessor_attributes>
|
227
245
|
|
228
246
|
<soda_attributes>
|
247
|
+
<accessor type="string">cssprop</accessor>
|
248
|
+
<accessor type="string">cssvalue</accessor>
|
229
249
|
</soda_attributes>
|
230
250
|
</ul>
|
231
251
|
|
@@ -244,6 +264,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
244
264
|
<accessor type="string">set</accessor>
|
245
265
|
<accessor type="string">jscriptevent</accessor>
|
246
266
|
<accessor type="boolean">exists</accessor>
|
267
|
+
<accessor type="string">cssprop</accessor>
|
268
|
+
<accessor type="string">cssvalue</accessor>
|
247
269
|
</soda_attributes>
|
248
270
|
</filefield>
|
249
271
|
|
@@ -261,6 +283,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
261
283
|
<soda_attributes>
|
262
284
|
<accessor type="string">jscriptevent</accessor>
|
263
285
|
<accessor type="boolean">exists</accessor>
|
286
|
+
<accessor type="string">cssprop</accessor>
|
287
|
+
<accessor type="string">cssvalue</accessor>
|
264
288
|
</soda_attributes>
|
265
289
|
</file_field>
|
266
290
|
|
@@ -277,6 +301,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
277
301
|
<soda_attributes>
|
278
302
|
<accessor type="string">assert</accessor>
|
279
303
|
<accessor type="string">assertnot</accessor>
|
304
|
+
<accessor type="string">cssprop</accessor>
|
305
|
+
<accessor type="string">cssvalue</accessor>
|
280
306
|
</soda_attributes>
|
281
307
|
</h5>
|
282
308
|
|
@@ -295,6 +321,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
295
321
|
<accessor type="string">assertnot</accessor>
|
296
322
|
<accessor type="string">jscriptevent</accessor>
|
297
323
|
<accessor type="boolean">exists</accessor>
|
324
|
+
<accessor type="string">cssprop</accessor>
|
325
|
+
<accessor type="string">cssvalue</accessor>
|
298
326
|
</soda_attributes>
|
299
327
|
</cell>
|
300
328
|
|
@@ -313,6 +341,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
313
341
|
<accessor type="string">assertnot</accessor>
|
314
342
|
<accessor type="string">jscriptevent</accessor>
|
315
343
|
<accessor type="boolean">exists</accessor>
|
344
|
+
<accessor type="string">cssprop</accessor>
|
345
|
+
<accessor type="string">cssvalue</accessor>
|
316
346
|
</soda_attributes>
|
317
347
|
</td>
|
318
348
|
|
@@ -327,6 +357,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
327
357
|
</accessor_attributes>
|
328
358
|
|
329
359
|
<soda_attributes>
|
360
|
+
<accessor type="string">cssprop</accessor>
|
361
|
+
<accessor type="string">cssvalue</accessor>
|
330
362
|
</soda_attributes>
|
331
363
|
</h6>
|
332
364
|
|
@@ -351,6 +383,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
351
383
|
<accessor type="boolean">disabled</accessor>
|
352
384
|
<accessor type="boolean">exists</accessor>
|
353
385
|
<accessor type="string">jscriptevent</accessor>
|
386
|
+
<accessor type="string">cssprop</accessor>
|
387
|
+
<accessor type="string">cssvalue</accessor>
|
354
388
|
</soda_attributes>
|
355
389
|
</select>
|
356
390
|
|
@@ -371,6 +405,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
371
405
|
<accessor type="boolean">disabled</accessor>
|
372
406
|
<accessor type="string">jscriptevent</accessor>
|
373
407
|
<accessor type="boolean">exists</accessor>
|
408
|
+
<accessor type="string">cssprop</accessor>
|
409
|
+
<accessor type="string">cssvalue</accessor>
|
374
410
|
</soda_attributes>
|
375
411
|
</select_list>
|
376
412
|
|
@@ -385,6 +421,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
385
421
|
</accessor_attributes>
|
386
422
|
|
387
423
|
<soda_attributes>
|
424
|
+
<accessor type="string">cssprop</accessor>
|
425
|
+
<accessor type="string">cssvalue</accessor>
|
388
426
|
</soda_attributes>
|
389
427
|
</pre>
|
390
428
|
|
@@ -402,6 +440,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
402
440
|
<accessor type="string">jscriptevent</accessor>
|
403
441
|
<accessor type="boolean">click</accessor>
|
404
442
|
<accessor type="boolean">exists</accessor>
|
443
|
+
<accessor type="string">cssprop</accessor>
|
444
|
+
<accessor type="string">cssvalue</accessor>
|
405
445
|
</soda_attributes>
|
406
446
|
</row>
|
407
447
|
|
@@ -418,6 +458,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
418
458
|
<soda_attributes>
|
419
459
|
<accessor type="string">jscriptevent</accessor>
|
420
460
|
<accessor type="boolean">exists</accessor>
|
461
|
+
<accessor type="string">cssprop</accessor>
|
462
|
+
<accessor type="string">cssvalue</accessor>
|
421
463
|
</soda_attributes>
|
422
464
|
</tr>
|
423
465
|
|
@@ -437,6 +479,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
437
479
|
<accessor type="string">jscriptevent</accessor>
|
438
480
|
<accessor type="boolean">click</accessor>
|
439
481
|
<accessor type="boolean">exists</accessor>
|
482
|
+
<accessor type="string">cssprop</accessor>
|
483
|
+
<accessor type="string">cssvalue</accessor>
|
440
484
|
</soda_attributes>
|
441
485
|
</table>
|
442
486
|
|
@@ -457,6 +501,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
457
501
|
<accessor type="boolean">disabled</accessor>
|
458
502
|
<accessor type="string">jscriptevent</accessor>
|
459
503
|
<accessor type="boolean">exists</accessor>
|
504
|
+
<accessor type="string">cssprop</accessor>
|
505
|
+
<accessor type="string">cssvalue</accessor>
|
460
506
|
</soda_attributes>
|
461
507
|
</radio>
|
462
508
|
|
@@ -471,6 +517,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
471
517
|
</accessor_attributes>
|
472
518
|
|
473
519
|
<soda_attributes>
|
520
|
+
<accessor type="string">cssprop</accessor>
|
521
|
+
<accessor type="string">cssvalue</accessor>
|
474
522
|
</soda_attributes>
|
475
523
|
</p>
|
476
524
|
|
@@ -496,6 +544,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
496
544
|
<accessor type="boolean">assertPage</accessor>
|
497
545
|
<accessor type="string">jscriptevent</accessor>
|
498
546
|
<accessor type="boolean">exists</accessor>
|
547
|
+
<accessor type="string">cssprop</accessor>
|
548
|
+
<accessor type="string">cssvalue</accessor>
|
499
549
|
</soda_attributes>
|
500
550
|
</checkbox>
|
501
551
|
|
@@ -513,6 +563,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
513
563
|
<soda_attributes>
|
514
564
|
<accessor type="string">jscriptevent</accessor>
|
515
565
|
<accessor type="boolean">exists</accessor>
|
566
|
+
<accessor type="string">cssprop</accessor>
|
567
|
+
<accessor type="string">cssvalue</accessor>
|
516
568
|
</soda_attributes>
|
517
569
|
</map>
|
518
570
|
|
@@ -529,6 +581,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
529
581
|
<soda_attributes>
|
530
582
|
<accessor type="string">jscriptevent</accessor>
|
531
583
|
<accessor type="boolean">exists</accessor>
|
584
|
+
<accessor type="string">cssprop</accessor>
|
585
|
+
<accessor type="string">cssvalue</accessor>
|
532
586
|
</soda_attributes>
|
533
587
|
</frame>
|
534
588
|
|
@@ -547,6 +601,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
547
601
|
<accessor type="boolean">exist</accessor>
|
548
602
|
<accessor type="string">jscriptevent</accessor>
|
549
603
|
<accessor type="boolean">exists</accessor>
|
604
|
+
<accessor type="string">cssprop</accessor>
|
605
|
+
<accessor type="string">cssvalue</accessor>
|
550
606
|
</soda_attributes>
|
551
607
|
</form>
|
552
608
|
|
@@ -567,6 +623,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
567
623
|
<accessor type="string">assertnot</accessor>
|
568
624
|
<accessor type="string">jscriptevent</accessor>
|
569
625
|
<accessor type="boolean">exists</accessor>
|
626
|
+
<accessor type="string">cssprop</accessor>
|
627
|
+
<accessor type="string">cssvalue</accessor>
|
570
628
|
</soda_attributes>
|
571
629
|
</div>
|
572
630
|
|
@@ -583,6 +641,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
583
641
|
<soda_attributes>
|
584
642
|
<accessor type="string">jscriptevent</accessor>
|
585
643
|
<accessor type="boolean">exists</accessor>
|
644
|
+
<accessor type="string">cssprop</accessor>
|
645
|
+
<accessor type="string">cssvalue</accessor>
|
586
646
|
</soda_attributes>
|
587
647
|
</area>
|
588
648
|
|
@@ -600,6 +660,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
600
660
|
<accessor type="boolean">click</accessor>
|
601
661
|
<accessor type="string">jscriptevent</accessor>
|
602
662
|
<accessor type="boolean">exists</accessor>
|
663
|
+
<accessor type="string">cssprop</accessor>
|
664
|
+
<accessor type="string">cssvalue</accessor>
|
603
665
|
</soda_attributes>
|
604
666
|
</li>
|
605
667
|
|
@@ -625,6 +687,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
625
687
|
<accessor type="boolean">jswait</accessor>
|
626
688
|
<accessor type="boolean">assertPage</accessor>
|
627
689
|
<accessor type="boolean">disabled</accessor>
|
690
|
+
<accessor type="string">cssprop</accessor>
|
691
|
+
<accessor type="string">cssvalue</accessor>
|
628
692
|
</soda_attributes>
|
629
693
|
</link>
|
630
694
|
|
@@ -639,6 +703,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
639
703
|
</accessor_attributes>
|
640
704
|
|
641
705
|
<soda_attributes>
|
706
|
+
<accessor type="string">cssprop</accessor>
|
707
|
+
<accessor type="string">cssvalue</accessor>
|
642
708
|
</soda_attributes>
|
643
709
|
</h1>
|
644
710
|
|
@@ -660,6 +726,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
660
726
|
<accessor type="string">jscriptevent</accessor>
|
661
727
|
<accessor type="boolean">exists</accessor>
|
662
728
|
<accessor type="boolean">alert</accessor>
|
729
|
+
<accessor type="string">cssprop</accessor>
|
730
|
+
<accessor type="string">cssvalue</accessor>
|
663
731
|
</soda_attributes>
|
664
732
|
</image>
|
665
733
|
|
@@ -675,6 +743,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
675
743
|
|
676
744
|
<soda_attributes>
|
677
745
|
<accessor type="boolean">click</accessor>
|
746
|
+
<accessor type="string">cssprop</accessor>
|
747
|
+
<accessor type="string">cssvalue</accessor>
|
678
748
|
</soda_attributes>
|
679
749
|
</h2>
|
680
750
|
|
@@ -693,6 +763,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
693
763
|
<accessor type="boolean">disabled</accessor>
|
694
764
|
<accessor type="string">jscriptevent</accessor>
|
695
765
|
<accessor type="boolean">exists</accessor>
|
766
|
+
<accessor type="string">cssprop</accessor>
|
767
|
+
<accessor type="string">cssvalue</accessor>
|
696
768
|
</soda_attributes>
|
697
769
|
</text_field>
|
698
770
|
|
@@ -714,6 +786,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
714
786
|
<accessor type="string">jscriptevent</accessor>
|
715
787
|
<accessor type="boolean">jswait</accessor>
|
716
788
|
<accessor type="boolean">exists</accessor>
|
789
|
+
<accessor type="string">cssprop</accessor>
|
790
|
+
<accessor type="string">cssvalue</accessor>
|
717
791
|
</soda_attributes>
|
718
792
|
</span>
|
719
793
|
|
@@ -732,6 +806,8 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
732
806
|
<soda_attributes>
|
733
807
|
<accessor type="string">var</accessor>
|
734
808
|
<accessor type="boolean">exists</accessor>
|
809
|
+
<accessor type="string">cssprop</accessor>
|
810
|
+
<accessor type="string">cssvalue</accessor>
|
735
811
|
</soda_attributes>
|
736
812
|
</hidden>
|
737
813
|
|
data/lib/SodaFireFox.rb
CHANGED
@@ -70,7 +70,6 @@ def SodaFireFox.CreateFireFoxBrowser(options = nil)
|
|
70
70
|
result['exception'] = e
|
71
71
|
result['browser'] = nil
|
72
72
|
ensure
|
73
|
-
|
74
73
|
end
|
75
74
|
|
76
75
|
return result
|
@@ -133,17 +132,12 @@ def SodaFireFox.KillProcessWindows()
|
|
133
132
|
tmp = nil
|
134
133
|
result = 0
|
135
134
|
|
136
|
-
print "Calling: Kernel.open(| tasklist /NH).\n"
|
137
135
|
tmp = Kernel.open("| tasklist /NH")
|
138
|
-
print "Readling Lines...\n"
|
139
136
|
lines = tmp.readlines()
|
140
|
-
print "Lines Read.\n"
|
141
137
|
tmp.close()
|
142
|
-
print "Closing process IO handle.\n"
|
143
138
|
|
144
139
|
lines.each do |l|
|
145
140
|
l = l.chomp()
|
146
|
-
print "Process Line: '#{l}'\n"
|
147
141
|
if (l =~ /firefox/i)
|
148
142
|
hash = {
|
149
143
|
'pid' => nil,
|
@@ -157,21 +151,22 @@ def SodaFireFox.KillProcessWindows()
|
|
157
151
|
end
|
158
152
|
|
159
153
|
len = firefox.length()
|
160
|
-
print "Processes found length: #{len}\n"
|
161
|
-
|
162
154
|
if (firefox.length < 1)
|
163
155
|
print "(*)No firefox processes to kill, browser closed clean.\n"
|
164
156
|
end
|
165
157
|
|
166
158
|
firefox.each do |hash|
|
167
159
|
begin
|
160
|
+
res = false
|
168
161
|
print "Killing Process ID: #{hash['pid']}, Name:"+
|
169
162
|
"#{hash['name']}\n"
|
170
163
|
cmd = "taskkill /F /T /PID #{hash['pid']}"
|
171
|
-
print "Calling Command: '#{cmd}'\n"
|
172
164
|
res = Kernel.system(cmd)
|
173
|
-
|
174
|
-
|
165
|
+
|
166
|
+
if (res =! true)
|
167
|
+
print "Failed calling command: #{cmd}!\n"
|
168
|
+
result = -1
|
169
|
+
end
|
175
170
|
rescue Exception => e
|
176
171
|
print "(!)Exception : #{e.message}\n"
|
177
172
|
result = -1
|
data/lib/SodaLogReporter.rb
CHANGED
@@ -737,7 +737,7 @@ HTML
|
|
737
737
|
row_data = FormatEventDump(line)
|
738
738
|
when /major\sexception/i
|
739
739
|
row_data = FormatMajorException(line)
|
740
|
-
when /javascript\s+error
|
740
|
+
when /javascript\s+error:|javascript\s+error\s+\(repeated/i
|
741
741
|
row_data = FormatJSError(line)
|
742
742
|
when /css\s+error:/i
|
743
743
|
row_data = FormatJSError(line)
|
data/lib/SodaUtils.rb
CHANGED
@@ -874,6 +874,225 @@ JAVA
|
|
874
874
|
return result
|
875
875
|
end
|
876
876
|
|
877
|
+
###############################################################################
|
878
|
+
# GetJsshVar -- function
|
879
|
+
# This function is a total hack to get an the watirobj's instance var
|
880
|
+
# @element_name which holds the internal jssh var names for accessing
|
881
|
+
# the wair object in jssh. This is needed bcause the firewatir style
|
882
|
+
# merhod isn't working. So I cause an internal class error which I
|
883
|
+
# then parse to get the needed var name.
|
884
|
+
#
|
885
|
+
# Input:
|
886
|
+
# watirobj: This is the watir object which you want to get the jssh var of.
|
887
|
+
#
|
888
|
+
# Output:
|
889
|
+
# Returns a string with the jssh var name.
|
890
|
+
#
|
891
|
+
###############################################################################
|
892
|
+
def SodaUtils.GetJsshVar(watirobj)
|
893
|
+
err = ""
|
894
|
+
|
895
|
+
err = watirobj.class_eval(%q{@element_name})
|
896
|
+
err = err.gsub(/^typeerror:\s+/i, "")
|
897
|
+
err = err.gsub(/\.\D+/, "")
|
898
|
+
|
899
|
+
return err
|
900
|
+
end
|
901
|
+
|
902
|
+
###############################################################################
|
903
|
+
# GetJsshStyle -- function
|
904
|
+
# This function gets the style information from from a watir object using
|
905
|
+
# jssh.
|
906
|
+
#
|
907
|
+
# Input:
|
908
|
+
# jssh_var: This is the internal firewatir jssh var used to access the
|
909
|
+
# watir object. This is returned from calling the GetJsshVar function.
|
910
|
+
#
|
911
|
+
# Output:
|
912
|
+
# Returns a hash with all of the style info, or an empty hash if there is
|
913
|
+
# no information to get.
|
914
|
+
#
|
915
|
+
###############################################################################
|
916
|
+
def SodaUtils.GetJsshStyle(jssh_var, browser)
|
917
|
+
hash = {}
|
918
|
+
|
919
|
+
java = <<JS
|
920
|
+
var style = #{jssh_var}.style;
|
921
|
+
var data = "";
|
922
|
+
var len = style.length -1;
|
923
|
+
|
924
|
+
for (var i = 0; i <= len; i++) {
|
925
|
+
var name = style[i];
|
926
|
+
var value = style.getPropertyValue(name);
|
927
|
+
var splitter = "---";
|
928
|
+
|
929
|
+
if (i == 0) {
|
930
|
+
splitter = ""
|
931
|
+
}
|
932
|
+
|
933
|
+
data = data + splitter + name + "=>" + value;
|
934
|
+
}
|
935
|
+
|
936
|
+
if (data.length < 1) {
|
937
|
+
data = "null";
|
938
|
+
}
|
939
|
+
|
940
|
+
print(data)
|
941
|
+
JS
|
942
|
+
|
943
|
+
out = browser.execute_script(java)
|
944
|
+
if (out != "null")
|
945
|
+
data = out.split("---")
|
946
|
+
data.each do |item|
|
947
|
+
tmp = item.split("=>")
|
948
|
+
hash[tmp[0]] = tmp[1]
|
949
|
+
end
|
950
|
+
end
|
951
|
+
|
952
|
+
return hash
|
953
|
+
end
|
954
|
+
|
955
|
+
|
956
|
+
###############################################################################
|
957
|
+
# GetIEStyle -- function
|
958
|
+
# This function get a style property from a watir object in IE.
|
959
|
+
#
|
960
|
+
# Intput:
|
961
|
+
# watirobj: The IE watir object.
|
962
|
+
# css_prop: The property name to get the info for.
|
963
|
+
# reportobj: The soda reporter object.
|
964
|
+
#
|
965
|
+
# Output:
|
966
|
+
# returns nil on error or a string on success.
|
967
|
+
#
|
968
|
+
###############################################################################
|
969
|
+
def SodaUtils.GetIEStyle(watirobj, css_prop, reportobj)
|
970
|
+
err = nil
|
971
|
+
prop_data = nil
|
972
|
+
new_prop = ""
|
973
|
+
len = 0
|
974
|
+
|
975
|
+
# because the IE access functions do not use the same names as the
|
976
|
+
# standard css property names, we need con convert the names into
|
977
|
+
# IE's ole friendly method name.
|
978
|
+
prop_data = css_prop.split("-")
|
979
|
+
len = prop_data.length() -1
|
980
|
+
if (len > 0)
|
981
|
+
i = 1
|
982
|
+
for i in i..len do
|
983
|
+
prop_data[i].capitalize!
|
984
|
+
end
|
985
|
+
|
986
|
+
prop_data.each do |d|
|
987
|
+
new_prop << "#{d}"
|
988
|
+
end
|
989
|
+
else
|
990
|
+
new_prop = css_prop
|
991
|
+
end
|
992
|
+
|
993
|
+
begin
|
994
|
+
err = eval("watirobj.style.#{new_prop}")
|
995
|
+
rescue Exception => e
|
996
|
+
err = nil
|
997
|
+
reportobj.ReportFailure("Failed to find any CSS data for"+
|
998
|
+
" property: '#{new_prop}'!\n")
|
999
|
+
end
|
1000
|
+
|
1001
|
+
return err
|
1002
|
+
end
|
1003
|
+
|
1004
|
+
###############################################################################
|
1005
|
+
# GetFireFoxStyle -- function
|
1006
|
+
# This function get a style property from a watir object in firefox.
|
1007
|
+
#
|
1008
|
+
# Intput:
|
1009
|
+
# watirobj: The IE watir object.
|
1010
|
+
# css_prop: The property name to get the info for.
|
1011
|
+
# reportobj: The soda reporter object.
|
1012
|
+
# browser: The currenlt Watir::Browser object.
|
1013
|
+
#
|
1014
|
+
# Output:
|
1015
|
+
# returns nil on error or a string on success.
|
1016
|
+
#
|
1017
|
+
###############################################################################
|
1018
|
+
def SodaUtils.GetFireFoxStyle(watirobj, css_prop, reportobj, browser)
|
1019
|
+
jssh_var = ""
|
1020
|
+
jssh_data = nil
|
1021
|
+
result = nil
|
1022
|
+
|
1023
|
+
jssh_var = SodaUtils.GetJsshVar(watirobj)
|
1024
|
+
if (jssh_var.empty?)
|
1025
|
+
reportobj.ReportFailure("Failed to find needed jssh var!\n")
|
1026
|
+
e_dump = SodaUtils.DumpEvent(event)
|
1027
|
+
reportobj.log("Event Dump for empty jssh var: #{e_dump}!\n",
|
1028
|
+
SodaUtils::EVENT)
|
1029
|
+
return nil
|
1030
|
+
else
|
1031
|
+
reportobj.log("Found internal jssh var: '#{jssh_var}'.\n")
|
1032
|
+
end
|
1033
|
+
|
1034
|
+
jssh_data = SodaUtils.GetJsshStyle(jssh_var, browser)
|
1035
|
+
|
1036
|
+
if (jssh_data.empty?)
|
1037
|
+
reportobj.ReportFailure("Failed to find any CSS data for"+
|
1038
|
+
" property: '#{css_prop}'!\n")
|
1039
|
+
e_dump = SodaUtils.DumpEvent(event)
|
1040
|
+
reportobj.log("Event Dump for empty CSS data: #{e_dump}!\n",
|
1041
|
+
SodaUtils::EVENT)
|
1042
|
+
return nil
|
1043
|
+
end
|
1044
|
+
|
1045
|
+
if (!jssh_data.key?("#{css_prop}"))
|
1046
|
+
reportobj.ReportFailure("Failed to find CSS key: '#{css_prop}'"+
|
1047
|
+
" for element!\n")
|
1048
|
+
e_dump = SodaUtils.DumpEvent(event)
|
1049
|
+
reportobj.log("Event Dump for missing CSS key: #{e_dump}!\n",
|
1050
|
+
SodaUtils::EVENT)
|
1051
|
+
return nil
|
1052
|
+
else
|
1053
|
+
result = jssh_data[css_prop]
|
1054
|
+
end
|
1055
|
+
|
1056
|
+
return result
|
1057
|
+
end
|
1058
|
+
|
1059
|
+
###############################################################################
|
1060
|
+
# cssInfoEvent -- method
|
1061
|
+
# This method checks that css values for a given soda element.
|
1062
|
+
#
|
1063
|
+
# Input:
|
1064
|
+
# event: A soda event.
|
1065
|
+
# watirobj: The watir element object.
|
1066
|
+
# browser: The watir browser object.
|
1067
|
+
# reportobj: The current sodareporter object.
|
1068
|
+
#
|
1069
|
+
# Output:
|
1070
|
+
# returns 0 on success or -1 on error.
|
1071
|
+
#
|
1072
|
+
###############################################################################
|
1073
|
+
def SodaUtils.GetStyleInfo(event, watirobj, browser, reportobj)
|
1074
|
+
|
1075
|
+
if (!event.key?('cssprop'))
|
1076
|
+
reportobj.ReportFailure("Missing attribte: 'cssprop' on line: "+
|
1077
|
+
"#{event[line_number]}!\n")
|
1078
|
+
return -1
|
1079
|
+
elsif (!event.key?('cssvalue'))
|
1080
|
+
reportobj.ReportFailure("Missing attribte: 'cssvalue' on line: "+
|
1081
|
+
"#{event['line_number']}!\n")
|
1082
|
+
return -1
|
1083
|
+
end
|
1084
|
+
|
1085
|
+
if (@params['browser'] !~ /firefox/i)
|
1086
|
+
@reportobj.log("Currently this function is only supported on firefox!",
|
1087
|
+
SodaUtils::WARN)
|
1088
|
+
return -1
|
1089
|
+
end
|
1090
|
+
|
1091
|
+
event['cssprop'] = replaceVars(event['cssprop'])
|
1092
|
+
event['cssvalue'] = replaceVars(event['cssvalue'])
|
1093
|
+
|
1094
|
+
return 0
|
1095
|
+
end
|
877
1096
|
|
878
1097
|
###############################################################################
|
879
1098
|
###############################################################################
|
data/lib/sodainfo.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: soda
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 17
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 1
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 1.3.
|
9
|
+
- 5
|
10
|
+
version: 1.3.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Trampus Richmond
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-31 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|