page-object 0.7.6 → 0.8

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/ChangeLog CHANGED
@@ -1,3 +1,40 @@
1
+ === Version 0.8 / 2012-12-22
2
+ * Enhancements
3
+ * Added the following class level methods to return all elements matching the locator
4
+ * divs
5
+ * buttons
6
+ * text_fields
7
+ * hidden_fields
8
+ * text_areas
9
+ * select_lists
10
+ * links
11
+ * checkboxes
12
+ * radio_buttons
13
+ * spans
14
+ * tables
15
+ * cells
16
+ * images
17
+ * forms
18
+ * list_items
19
+ * unordered_lists
20
+ * ordered_lists
21
+ * h1s
22
+ * h2s
23
+ * h3s
24
+ * h4s
25
+ * h5s
26
+ * h6s
27
+ * paragraphs
28
+ * labels
29
+ * file_fields
30
+ * Added ability to register and use custom elements based on standard elements (William Powell)
31
+ * Added generated method to return text for a table
32
+ * Added generated method to return text for an unordered list
33
+ * Added generated method to return text for an ordered list
34
+ * Added html method to Element
35
+ * Updated to use the latest selenium-webdriver 2.27.2
36
+ * Updated to use the latest watir-webdriver 0.6.2
37
+
1
38
  === Version 0.7.6 / 2012-11-28
2
39
  * Fixes
3
40
  * Fixed attach_to_window workes with partial url on Selenium (George Shakhnazaryan)
@@ -26,6 +26,7 @@ Feature: Elements
26
26
  Then I should know it exists
27
27
  And I should know it is visible
28
28
  And I should know the text is "Google Search"
29
+ And I should know the html is "<a href="success.html" id="link_id" name="link_name" class="link_class" title="link_title">Google Search</a>"
29
30
  And I should know it is equal to itself
30
31
  And I should know the tag name is "a"
31
32
  And I should know the attribute "readonly" is false
@@ -289,4 +290,4 @@ Feature: Elements
289
290
  Scenario: Double Clicking
290
291
  Given I am on the Double Click page
291
292
  When I double click the button
292
- Then the paragraph should read "Double Click Received"
293
+ Then the paragraph should read "Double Click Received"
@@ -0,0 +1,24 @@
1
+ Feature: Gxt Table Extension
2
+ As a Quality Engineer working on a Gxt or Gwt project
3
+ In order to easily create test widgets to interact with application widgets
4
+ I need to define, register and use widgets as if they were normal elements
5
+
6
+ Background:
7
+ Given I have defined a GxtTable class extending Table
8
+ And I have registered the GxtTable with PageObject
9
+ And I define a page-object using that widget
10
+ And I am on the Gxt Examples page
11
+ And I have the Basic Grid opened
12
+
13
+ Scenario: Retrieve a GxtTable
14
+ When I retrieve a GxtTable widget
15
+ Then I should know it is visible
16
+
17
+ @watir_only
18
+ Scenario: Determine if a GxtTable exists
19
+ When I retrieve a GxtTable widget
20
+ Then I should know it exists
21
+
22
+ Scenario: Confirm a correct row count from a GxtTable
23
+ When I retrieve a GxtTable widget
24
+ And the GxtTable should have "13" rows
@@ -288,3 +288,185 @@ Feature: Multi Elements
288
288
  Scenario: Selecting file fields using no identifier
289
289
  When I select the file fields using no identifier
290
290
  Then I should have 3 file fields
291
+
292
+ Scenario: Selecting all divs based on a class declaration
293
+ When I select the divs using the generated method
294
+ Then I should have 3 divs
295
+ And the text of div 1 should be "Div 1"
296
+ And the text of div 2 should be "Div 2"
297
+ And the text of div 3 should be "Div 3"
298
+
299
+ Scenario: Selecting buttons based on a class declaration
300
+ When I select the buttons using the generated method
301
+ Then I should have 3 buttons
302
+ And the value of button 1 should be "Button 1"
303
+ And the value of button 2 should be "Button 2"
304
+ And the value of button 3 should be "Button 3"
305
+
306
+ Scenario: Selecting text fields based on a class declaration
307
+ When I select the text fields using the generated method
308
+ Then I should have 3 text fields
309
+ And the value of text field 1 should be "text 1"
310
+ And the value of text field 2 should be "text 2"
311
+ And the value of text field 3 should be "text 3"
312
+
313
+ Scenario: Selecting hidden fields based on a class declaration
314
+ When I select the hidden fields using the generated method
315
+ Then I should have 3 hidden fields
316
+ And the value of hidden field 1 should be "hidden 1"
317
+ And the value of hidden field 2 should be "hidden 2"
318
+ And the value of hidden field 3 should be "hidden 3"
319
+
320
+ Scenario: Selecting text areas based on a class declaration
321
+ When I select the text areas using the generated method
322
+ Then I should have 3 text areas
323
+ And the value of text area 1 should be "textarea 1"
324
+ And the value of text area 2 should be "textarea 2"
325
+ And the value of text area 3 should be "textarea 3"
326
+
327
+ Scenario: Selecting select lists based on a class declaration
328
+ When I select the select lists using the generated method
329
+ Then I should have 3 select lists
330
+ And the value of select list 1 should be "selectlist 1"
331
+ And the value of select list 2 should be "selectlist 2"
332
+ And the value of select list 3 should be "selectlist 3"
333
+
334
+ Scenario: Selecting links based on a class declaration
335
+ When I select the link using the generated method
336
+ Then I should have 3 links
337
+ And the text of link 1 should be "link 1"
338
+ And the text of link 2 should be "link 2"
339
+ And the text of link 3 should be "link 3"
340
+
341
+ Scenario: Selecting checkboxes based on a class declaration
342
+ When I select the check boxes using the generated method
343
+ Then I should have 3 checkboxes
344
+ And the value of checkbox 1 should be "checkbox 1"
345
+ And the value of checkbox 2 should be "checkbox 2"
346
+ And the value of checkbox 3 should be "checkbox 3"
347
+
348
+ Scenario: Selecting radio buttons based on a class declaration
349
+ When I select the radio button using the generated method
350
+ Then I should have 3 radio buttons
351
+ And the value of radio button 1 should be "radio 1"
352
+ And the value of radio button 2 should be "radio 2"
353
+ And the value of radio button 3 should be "radio 3"
354
+
355
+ Scenario: Selecting spans based on a class declaration
356
+ When I select the spans using the generated method
357
+ Then I should have 3 spans
358
+ And the text of span 1 should be "Span 1"
359
+ And the text of span 2 should be "Span 2"
360
+ And the text of span 3 should be "Span 3"
361
+
362
+ Scenario: Selecting tables based on a class declaration
363
+ When I select the tables using the generated method
364
+ Then I should have 3 tables
365
+ And the first row first column for table 1 should have "Data 1"
366
+ And the first row first column for table 2 should have "Data 4"
367
+ And the first row first column for table 3 should have "Data 7"
368
+
369
+ Scenario: Selecting cells based on a class declaration
370
+ When I select the cells using the generated method
371
+ Then I should have 3 cells
372
+ And the text for cell 1 should be "Data 1"
373
+ And the text for cell 2 should be "Data 2"
374
+ And the text for cell 3 should be "Data 3"
375
+
376
+ Scenario: Selecting images based on a class declaration
377
+ When I select the images using the generated method
378
+ Then I should have 3 images
379
+ And the alt for image 1 should be "image 1"
380
+ And the alt for image 2 should be "image 2"
381
+ And the alt for image 3 should be "image 3"
382
+
383
+ Scenario: Selecting forms based on a class declaration
384
+ When I select the forms using the generated method
385
+ Then I should have 3 forms
386
+ And the action for form 1 should be "form1"
387
+ And the action for form 2 should be "form2"
388
+ And the action for form 3 should be "form3"
389
+
390
+ Scenario: Selecting list items based on a class declaration
391
+ When I select the list items using the generated method
392
+ Then I should have 3 list items
393
+ And the text for list item 1 should be "Item One"
394
+ And the text for list item 2 should be "Item Two"
395
+ And the text for list item 3 should be "Item Three"
396
+
397
+ Scenario: Selecting unordered lists based on a class declaration
398
+ When I select the unordered list using the generated method
399
+ Then I should have 3 unordered lists
400
+ And the text for the first item in unordered list 1 should be "Item One"
401
+ And the text for the first item in unordered list 2 should be "Item Four"
402
+ And the text for the first item in unordered list 3 should be "Item Five"
403
+
404
+ Scenario: Selecting ordered lists based on a class declaration
405
+ When I select the ordered lists using the generated method
406
+ Then I should have 3 ordered lists
407
+ And the text for the first item in ordered list 1 should be "Number One"
408
+ And the text for the first item in ordered list 2 should be "Number Two"
409
+ And the text for the first item in ordered list 3 should be "Number Three"
410
+
411
+ Scenario: Selecting h1s based on a class declaration
412
+ When I select the h1s using the generated method
413
+ Then I should have 3 h1s
414
+ And the text for h1 1 should be "H1 One"
415
+ And the text for h1 2 should be "H1 Two"
416
+ And the text for h1 3 should be "H1 Three"
417
+
418
+ Scenario: Selecting h2s based on a class declaration
419
+ When I select the h2s using the generated method
420
+ Then I should have 3 h2s
421
+ And the text for h2 1 should be "H2 One"
422
+ And the text for h2 2 should be "H2 Two"
423
+ And the text for h2 3 should be "H2 Three"
424
+
425
+ Scenario: Selecting h3s based on a class declaration
426
+ When I select the h3s using the generated method
427
+ Then I should have 3 h3s
428
+ And the text for h3 1 should be "H3 One"
429
+ And the text for h3 2 should be "H3 Two"
430
+ And the text for h3 3 should be "H3 Three"
431
+
432
+ Scenario: Selecting h4s based on a class declaration
433
+ When I select the h4s using the generated method
434
+ Then I should have 3 h4s
435
+ And the text for H4 1 should be "H4 One"
436
+ And the text for H4 2 should be "H4 Two"
437
+ And the text for H4 3 should be "H4 Three"
438
+
439
+ Scenario: Selecting h5s based on a class declaration
440
+ When I select the h5s using the generated method
441
+ Then I should have 3 h5s
442
+ And the text for H5 1 should be "H5 One"
443
+ And the text for H5 2 should be "H5 Two"
444
+ And the text for H5 3 should be "H5 Three"
445
+
446
+ Scenario: Selecting h6s based on a class declaration
447
+ When I select the h6s using the generated method
448
+ Then I should have 3 h6s
449
+ And the text for H6 1 should be "H6 One"
450
+ And the text for H6 2 should be "H6 Two"
451
+ And the text for H6 3 should be "H6 Three"
452
+
453
+ Scenario: Selecting paragraphs based on a class declaration
454
+ When I select the paragraph using the generated method
455
+ Then I should have 3 paragraphs
456
+ And the text for paragraph 1 should be "Paragraph One"
457
+ And the text for paragraph 2 should be "Paragraph Two"
458
+ And the text for paragraph 3 should be "Paragraph Three"
459
+
460
+ Scenario: Selecting labels based on a class declaration
461
+ When I select the labels using the generated method
462
+ Then I should have 3 labels
463
+ And the text for label 1 should be "Label 1"
464
+ And the text for label 2 should be "Label 2"
465
+ And the text for label 3 should be "Label 3"
466
+
467
+ Scenario: Selecting file fields based on a class declaration
468
+ When I select the file fields using the generated method
469
+ Then I should have 3 file fields
470
+ And the title for file field 1 should be "File Field 1"
471
+ And the title for file field 2 should be "File Field 2"
472
+ And the title for file field 3 should be "File Field 3"
@@ -49,3 +49,8 @@ Feature: Ordered list
49
49
  Then I should see that the ordered list exists
50
50
  When I get the first item from the list
51
51
  Then the list items text should be "Number One"
52
+
53
+ Scenario: Getting the test for an ordered list
54
+ Then the text for the ordered list should contain "Number One"
55
+ And the text for the ordered list should contain "Number Two"
56
+ And the text for the ordered list should contain "Number Three"
@@ -78,6 +78,10 @@ Then /^I should know the text is "(.*)"$/ do |text|
78
78
  @element.text.should == text
79
79
  end
80
80
 
81
+ Then /^I should know the html is "(.*)"$/ do |html|
82
+ @element.html.should == html
83
+ end
84
+
81
85
  Then /^I should know the text includes "(.*)"$/ do |text|
82
86
  @element.text.should include text
83
87
  end
@@ -228,6 +232,7 @@ When /^I double click the button$/ do
228
232
  @page.click_element.double_click
229
233
  end
230
234
 
231
- Then /^the paragraph should read "([^"]*)"$/ do |expected_text|
235
+ Then /^the paragraph should read "([^\"]*)"$/ do |expected_text|
232
236
  @page.text.should == expected_text
233
- end
237
+ end
238
+
@@ -0,0 +1,40 @@
1
+ Given /^I am on the Gxt Examples page$/ do
2
+ @page = GxtSamplePageObject.new(@browser)
3
+ @page.navigate_to "http://gxtexamplegallery.appspot.com/"
4
+ end
5
+
6
+ When /^I have the Basic Grid opened$/ do
7
+ @page.basic_grid_element.click
8
+ end
9
+
10
+ When /^I have defined a GxtTable class extending Table$/ do
11
+ class GxtTable < PageObject::Elements::Table
12
+
13
+ protected
14
+ def child_xpath
15
+ ".//descendant::tr"
16
+ end
17
+ end
18
+ end
19
+
20
+ When /^I have registered the GxtTable with PageObject$/ do
21
+ PageObject.register_widget :gxt_table, GxtTable, 'div'
22
+ end
23
+
24
+ When /^I retrieve a GxtTable widget$/ do
25
+ @element = @page.gxt_table_element
26
+ end
27
+
28
+
29
+ When /^the GxtTable should have "(\d+)" rows$/ do |rows|
30
+ @element.rows.should == rows.to_i
31
+ end
32
+
33
+ When /^I define a page-object using that widget$/ do
34
+ class GxtSamplePageObject
35
+ include PageObject
36
+
37
+ div(:basic_grid, :class => "label_basic_grid")
38
+ gxt_table(:gxt_table, :class => "x-grid3")
39
+ end
40
+ end
@@ -1,5 +1,32 @@
1
1
  class MultiElementsPage
2
2
  include PageObject
3
+
4
+ divs(:the_divs, :class => 'div')
5
+ buttons(:the_buttons, :class => 'button')
6
+ text_fields(:the_text_fields, :class => 'textfield')
7
+ hidden_fields(:the_hidden_fields, :class => 'hiddenfield')
8
+ text_areas(:the_text_areas, :class => 'textarea')
9
+ select_lists(:the_select_lists, :class => 'selectlist')
10
+ links(:the_links, :class => 'link')
11
+ checkboxes(:the_checkboxes, :class => 'checkbox')
12
+ radio_buttons(:the_radio_buttons, :class => 'radio')
13
+ spans(:the_spans, :class => 'span')
14
+ tables(:the_tables, :class => 'table')
15
+ cells(:the_cells, :class => 'td')
16
+ images(:the_images, :class => 'image')
17
+ forms(:the_forms, :class => 'form')
18
+ list_items(:the_list_items, :class => 'li')
19
+ unordered_lists(:the_unordered_lists, :class => 'ul')
20
+ ordered_lists(:the_ordered_lists, :class => 'ol')
21
+ h1s(:the_h1s, :class => 'h1')
22
+ h2s(:the_h2s, :class => 'h2')
23
+ h3s(:the_h3s, :class => 'h3')
24
+ h4s(:the_h4s, :class => 'h4')
25
+ h5s(:the_h5s, :class => 'h5')
26
+ h6s(:the_h6s, :class => 'h6')
27
+ paragraphs(:the_paragraphs, :class => 'p')
28
+ labels(:the_labels, :class => 'label')
29
+ file_fields(:the_file_fields, :class => 'file_field_class')
3
30
  end
4
31
 
5
32
 
@@ -403,3 +430,87 @@ end
403
430
  When /^I select the file fields using no identifier$/ do
404
431
  @elements = @page.file_field_elements
405
432
  end
433
+
434
+ When /^I select the divs using the generated method$/ do
435
+ @elements = @page.the_divs_elements
436
+ end
437
+
438
+ When /^I select the buttons using the generated method$/ do
439
+ @elements = @page.the_buttons_elements
440
+ end
441
+
442
+ When /^I select the text fields using the generated method$/ do
443
+ @elements = @page.the_text_fields_elements
444
+ end
445
+
446
+ When /^I select the hidden fields using the generated method$/ do
447
+ @elements = @page.the_hidden_fields_elements
448
+ end
449
+
450
+ When /^I select the text areas using the generated method$/ do
451
+ @elements = @page.the_text_areas_elements
452
+ end
453
+
454
+ When /^I select the select lists using the generated method$/ do
455
+ @elements = @page.the_select_lists_elements
456
+ end
457
+
458
+ When /^I select the link using the generated method$/ do
459
+ @elements = @page.the_links_elements
460
+ end
461
+
462
+ When /^I select the check boxes using the generated method$/ do
463
+ @elements = @page.the_checkboxes_elements
464
+ end
465
+
466
+ When /^I select the radio button using the generated method$/ do
467
+ @elements = @page.the_radio_buttons_elements
468
+ end
469
+
470
+ When /^I select the spans using the generated method$/ do
471
+ @elements = @page.the_spans_elements
472
+ end
473
+
474
+ When /^I select the tables using the generated method$/ do
475
+ @elements = @page.the_tables_elements
476
+ end
477
+
478
+ When /^I select the cells using the generated method$/ do
479
+ @elements = @page.the_cells_elements
480
+ end
481
+
482
+ When /^I select the images using the generated method$/ do
483
+ @elements = @page.the_images_elements
484
+ end
485
+
486
+ When /^I select the forms using the generated method$/ do
487
+ @elements = @page.the_forms_elements
488
+ end
489
+
490
+ When /^I select the list items using the generated method$/ do
491
+ @elements = @page.the_list_items_elements
492
+ end
493
+
494
+ When /^I select the unordered list using the generated method$/ do
495
+ @elements = @page.the_unordered_lists_elements
496
+ end
497
+
498
+ When /^I select the ordered lists using the generated method$/ do
499
+ @elements = @page.the_ordered_lists_elements
500
+ end
501
+
502
+ When /^I select the h(\d+)s using the generated method$/ do |num|
503
+ @elements = @page.send "the_h#{num.to_i}s_elements"
504
+ end
505
+
506
+ When /^I select the paragraph using the generated method$/ do
507
+ @elements = @page.the_paragraphs_elements
508
+ end
509
+
510
+ When /^I select the labels using the generated method$/ do
511
+ @elements = @page.the_labels_elements
512
+ end
513
+
514
+ When /^I select the file fields using the generated method$/ do
515
+ @elements = @page.the_file_fields_elements
516
+ end