druid-ts 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/.travis.yml +8 -0
- data/Gemfile +7 -0
- data/README.md +11 -0
- data/Rakefile +33 -0
- data/cucumber.yml +2 -0
- data/features/button.feature +38 -0
- data/features/checkbox.feature +39 -0
- data/features/div.feature +38 -0
- data/features/element.feature +114 -0
- data/features/form.feature +29 -0
- data/features/hidden_field.feature +33 -0
- data/features/html/images/circle.png +0 -0
- data/features/html/static_elements.html +89 -0
- data/features/html/success.html +8 -0
- data/features/image.feature +33 -0
- data/features/link.feature +39 -0
- data/features/list_item.feature +31 -0
- data/features/ordered_list.feature +35 -0
- data/features/page_level_actions.feature +31 -0
- data/features/radio_button.feature +42 -0
- data/features/select_list.feature +48 -0
- data/features/span.feature +36 -0
- data/features/step_definations/button_steps.rb +24 -0
- data/features/step_definations/checkbox_steps.rb +31 -0
- data/features/step_definations/div_steps.rb +19 -0
- data/features/step_definations/element_steps.rb +29 -0
- data/features/step_definations/form_steps.rb +11 -0
- data/features/step_definations/hidden_field_steps.rb +19 -0
- data/features/step_definations/image_steps.rb +19 -0
- data/features/step_definations/link_steps.rb +29 -0
- data/features/step_definations/list_item_steps.rb +12 -0
- data/features/step_definations/ordered_list_steps.rb +33 -0
- data/features/step_definations/page_level_actions_steps.rb +48 -0
- data/features/step_definations/page_traversal_steps.rb +4 -0
- data/features/step_definations/radio_button_steps.rb +23 -0
- data/features/step_definations/select_list_steps.rb +42 -0
- data/features/step_definations/span_steps.rb +15 -0
- data/features/step_definations/table_cell_steps.rb +19 -0
- data/features/step_definations/table_steps.rb +38 -0
- data/features/step_definations/text_area_steps.rb +19 -0
- data/features/step_definations/text_field_steps.rb +23 -0
- data/features/step_definations/unordered_list_steps.rb +11 -0
- data/features/support/env.rb +17 -0
- data/features/support/page.rb +163 -0
- data/features/support/url_helper.rb +16 -0
- data/features/table.feature +43 -0
- data/features/table_cell.feature +36 -0
- data/features/text_area.feature +32 -0
- data/features/text_field.feature +42 -0
- data/features/unordered_list.feature +36 -0
- data/lib/druid.rb +80 -0
- data/lib/druid/accessors.rb +506 -0
- data/lib/druid/elements.rb +19 -0
- data/lib/druid/elements/button.rb +11 -0
- data/lib/druid/elements/check_box.rb +7 -0
- data/lib/druid/elements/div.rb +10 -0
- data/lib/druid/elements/element.rb +129 -0
- data/lib/druid/elements/form.rb +7 -0
- data/lib/druid/elements/hidden_field.rb +11 -0
- data/lib/druid/elements/image.rb +7 -0
- data/lib/druid/elements/link.rb +16 -0
- data/lib/druid/elements/list_item.rb +7 -0
- data/lib/druid/elements/ordered_list.rb +30 -0
- data/lib/druid/elements/radio_button.rb +7 -0
- data/lib/druid/elements/select_list.rb +18 -0
- data/lib/druid/elements/span.rb +11 -0
- data/lib/druid/elements/table.rb +30 -0
- data/lib/druid/elements/table_cell.rb +7 -0
- data/lib/druid/elements/table_row.rb +22 -0
- data/lib/druid/elements/text_area.rb +11 -0
- data/lib/druid/elements/text_field.rb +11 -0
- data/lib/druid/elements/unordered_list.rb +28 -0
- data/lib/druid/page_factory.rb +58 -0
- data/spec/druid/druid_spec.rb +38 -0
- data/spec/spec_helper.rb +7 -0
- metadata +224 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 181b245e5051d6a93aeb37fb0bcc085df08af882
|
4
|
+
data.tar.gz: 811f5667bce43ddbd185e0b981dc8910c25b0491
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 41377cfa4542f102a921be37370dcc350d0b76c97e5764437e7d4eab1ff486392271e181f188b2d2f85c040f86f47e6116d4123e0c7c7fc19585315a08d31b2b
|
7
|
+
data.tar.gz: d03f1173add3fdc7ac149e299405c960e9ae752d383aaa6b28e6d7f697498d57da5ef94b90df038cddab8264ce50b0ad948ad1567a144ad61ba07afdce75b946
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
# druid
|
2
|
+
|
3
|
+
A simple gem that assists testers in creating flexible page objects for testing browser based applications
|
4
|
+
|
5
|
+
# Note on Patches/Pull Requests
|
6
|
+
|
7
|
+
Fork the project
|
8
|
+
Test drive your feature addition or bug fix. Adding specs is importing so I don't break it in a future version unintentionally.
|
9
|
+
Commit, do not mess with rakefile, version, or history.
|
10
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
11
|
+
Send me a pull request. Bonus points for topic branches.
|
data/Rakefile
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
require 'cucumber'
|
5
|
+
require 'cucumber/rake/task'
|
6
|
+
|
7
|
+
RSpec::Core::RakeTask.new(:spec) do |spec|
|
8
|
+
spec.ruby_opts = "-I lib:spec"
|
9
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
10
|
+
end
|
11
|
+
|
12
|
+
namespace :spec do
|
13
|
+
RSpec::Core::RakeTask.new(:html) do |spec|
|
14
|
+
spec.ruby_opts = "-I lib:spec"
|
15
|
+
spec.pattern = 'spec/**/*_spec.rb'
|
16
|
+
spec.rspec_opts = "--format html --out #{ENV["SPEC_REPORT"] || "specs.html"}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
task :spec
|
21
|
+
|
22
|
+
task :lib do
|
23
|
+
$LOAD_PATH.unshift(File.expand_xpath("lib", File.dirname(__FILE__)))
|
24
|
+
end
|
25
|
+
|
26
|
+
task :default => :spec
|
27
|
+
|
28
|
+
|
29
|
+
namespace :features do
|
30
|
+
Cucumber::Rake::Task.new(:watir, "Run features with Watir") do |t|
|
31
|
+
t.profile = "watir"
|
32
|
+
end
|
33
|
+
end
|
data/cucumber.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Button
|
2
|
+
In order to interact with buttons
|
3
|
+
Testers will need access and interrogation ability
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I am on the static elements page
|
7
|
+
|
8
|
+
Scenario: Selecting a button
|
9
|
+
When I click the button
|
10
|
+
Then I should be on the success page
|
11
|
+
|
12
|
+
Scenario Outline: Locating buttons on the page
|
13
|
+
When I locate the button by "<locate_by>"
|
14
|
+
Then I should be able to click the button
|
15
|
+
|
16
|
+
Examples:
|
17
|
+
| locate_by |
|
18
|
+
| id |
|
19
|
+
| class |
|
20
|
+
| name |
|
21
|
+
| xpath |
|
22
|
+
| index |
|
23
|
+
| text |
|
24
|
+
|
25
|
+
Scenario: Retrieve a button element
|
26
|
+
When I retrieve a button element
|
27
|
+
Then I should know it exists
|
28
|
+
And I should know it is visible
|
29
|
+
|
30
|
+
@multi
|
31
|
+
Scenario Outline: Locating button using multiple parameters
|
32
|
+
When I search for the button by "<param1>" and "<param2>"
|
33
|
+
Then I should be able to click the button
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
| param1 | param2 |
|
37
|
+
| class | index |
|
38
|
+
| name | index |
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: Check Box
|
2
|
+
In order to interact with check boxes
|
3
|
+
Testers will need access and interrogation ability
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I am on the static elements page
|
7
|
+
|
8
|
+
Scenario: Selecting an element on the checkbox
|
9
|
+
When I select the First check box
|
10
|
+
Then the First check box should be selected
|
11
|
+
When I unselect the First check box
|
12
|
+
Then the First check box should not be selected
|
13
|
+
|
14
|
+
Scenario Outline: Locating check boxes on the page
|
15
|
+
When I locate the check box by "<locate_by>"
|
16
|
+
Then I should be able to check the check box
|
17
|
+
|
18
|
+
Examples:
|
19
|
+
| locate_by |
|
20
|
+
| id |
|
21
|
+
| class |
|
22
|
+
| name |
|
23
|
+
| xpath |
|
24
|
+
| index |
|
25
|
+
|
26
|
+
Scenario: Retrieve a CheckBox
|
27
|
+
When I retrieve a check box element
|
28
|
+
Then I should know it exists
|
29
|
+
And I should know it is visible
|
30
|
+
|
31
|
+
@multi
|
32
|
+
Scenario Outline: Locating check boxes using multiple paramters
|
33
|
+
When I search for the check box by "<param1>" and "<param2>"
|
34
|
+
Then I should be able to check the check box
|
35
|
+
|
36
|
+
Examples:
|
37
|
+
| param1 | param2 |
|
38
|
+
| class | index |
|
39
|
+
| name | index |
|
@@ -0,0 +1,38 @@
|
|
1
|
+
Feature: Div
|
2
|
+
In order to interact with divs
|
3
|
+
Testers will need access and interrogation ability
|
4
|
+
|
5
|
+
Background:
|
6
|
+
Given I am on the static elements page
|
7
|
+
|
8
|
+
Scenario: Getting the text from a div
|
9
|
+
When I get the text from the div
|
10
|
+
Then the text should be "page-object rocks!"
|
11
|
+
|
12
|
+
@name
|
13
|
+
Scenario Outline: Locating divs on the page
|
14
|
+
When I locate the div by "<locate_by>"
|
15
|
+
Then the text should be "page-object rocks!"
|
16
|
+
|
17
|
+
Examples:
|
18
|
+
| locate_by |
|
19
|
+
| id |
|
20
|
+
| class |
|
21
|
+
| xpath |
|
22
|
+
| index |
|
23
|
+
| name |
|
24
|
+
|
25
|
+
Scenario: Getting the div element
|
26
|
+
When I retrieve the div element
|
27
|
+
Then I should know it exists
|
28
|
+
And I should know it is visible
|
29
|
+
|
30
|
+
@multi
|
31
|
+
Scenario Outline: locating divs using multiple parameters
|
32
|
+
When I search for the div by "<param1>" and "<param2>"
|
33
|
+
Then the text should be "page-object rocks!"
|
34
|
+
|
35
|
+
Examples:
|
36
|
+
| param1 | param2 |
|
37
|
+
| class | index |
|
38
|
+
| name | index |
|
@@ -0,0 +1,114 @@
|
|
1
|
+
Feature: Elements
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Link element methods
|
7
|
+
When I retrieve a link element
|
8
|
+
Then I should know it exists
|
9
|
+
And I should know it is visible
|
10
|
+
And I should know its' text is "Google Search"
|
11
|
+
And I should know it is equal to itself
|
12
|
+
And I should know its' tag name is "a"
|
13
|
+
And I should know the attribute "readonly" is false
|
14
|
+
And I should know its' value is ""
|
15
|
+
And I should be able to click it
|
16
|
+
|
17
|
+
Scenario: Button element methods
|
18
|
+
When I retrieve a button element
|
19
|
+
Then I should know it exists
|
20
|
+
And I should know it is visible
|
21
|
+
And I should know its' value is "Click Me"
|
22
|
+
And I should know its' text is "Click Me"
|
23
|
+
And I should know it is equal to itself
|
24
|
+
And I should know its' tag name is "input"
|
25
|
+
And I should know the attribute "readonly" is false
|
26
|
+
And I should be able to click it
|
27
|
+
|
28
|
+
Scenario: Check Box element methods
|
29
|
+
When I retrieve a check box element
|
30
|
+
Then I should know it exists
|
31
|
+
And I should know it is visible
|
32
|
+
And I should know its' text is ""
|
33
|
+
And I should know its' value is "1"
|
34
|
+
And I should know it is equal to itself
|
35
|
+
And I should know its' tag name is "input"
|
36
|
+
And I should know the attribute "readonly" is false
|
37
|
+
And I should be able to click it
|
38
|
+
|
39
|
+
Scenario: Div element methods
|
40
|
+
When I retrieve the div element
|
41
|
+
Then I should know it exists
|
42
|
+
And I should know it is visible
|
43
|
+
And I should know its' text is "page-object rocks!"
|
44
|
+
And I should know its' value is ""
|
45
|
+
And I should know it is equal to itself
|
46
|
+
And I should know its' tag name is "div"
|
47
|
+
And I should know the attribute "readonly" is false
|
48
|
+
And I should be able to click it
|
49
|
+
|
50
|
+
Scenario: Radio Button element methods
|
51
|
+
When I retrieve a radio button
|
52
|
+
Then I should know it exists
|
53
|
+
And I should know it is visible
|
54
|
+
And I should know its' text is ""
|
55
|
+
And I should know its' value is "Milk"
|
56
|
+
And I should know it is equal to itself
|
57
|
+
And I should know its' tag name is "input"
|
58
|
+
And I should know the attribute "readonly" is false
|
59
|
+
And I should be able to click it
|
60
|
+
|
61
|
+
Scenario: Select List element methods
|
62
|
+
When I retrieve a select list
|
63
|
+
Then I should know it exists
|
64
|
+
And I should know it is visible
|
65
|
+
And I should know its' text includes "Test 1"
|
66
|
+
And I should know its' value is "option1"
|
67
|
+
And I should know it is equal to itself
|
68
|
+
And I should know its' tag name is "select"
|
69
|
+
And I should know the attribute "readonly" is false
|
70
|
+
And I should be able to click it
|
71
|
+
|
72
|
+
Scenario: Table element methods
|
73
|
+
When I retrieve a table element
|
74
|
+
Then I should know it is visible
|
75
|
+
Then I should know it exists
|
76
|
+
And I should know its' value is ""
|
77
|
+
And I should know its' text includes "Data1"
|
78
|
+
And I should know it is equal to itself
|
79
|
+
And I should know its' tag name is "table"
|
80
|
+
And I should know the attribute "readonly" is false
|
81
|
+
And I should be able to click it
|
82
|
+
|
83
|
+
Scenario: Table Cell element methods
|
84
|
+
When I retrieve table cell
|
85
|
+
Then I should know it exists
|
86
|
+
And I should know it is visible
|
87
|
+
Then I should know its' value is ""
|
88
|
+
And I should know its' text includes "Data4"
|
89
|
+
And I should know it is equal to itself
|
90
|
+
And I should know its' tag name is "td"
|
91
|
+
And I should know the attribute "readonly" is false
|
92
|
+
And I should be able to click it
|
93
|
+
|
94
|
+
Scenario: Text Field element methods
|
95
|
+
When I retrieve a text field
|
96
|
+
Then I should know it exists
|
97
|
+
And I should know it is visible
|
98
|
+
And I should know its' text includes ""
|
99
|
+
And I should know its' value is ""
|
100
|
+
And I should know it is equal to itself
|
101
|
+
And I should know its' tag name is "input"
|
102
|
+
And I should know the attribute "readonly" is false
|
103
|
+
And I should be able to click it
|
104
|
+
|
105
|
+
Scenario: Image element methods
|
106
|
+
When I get the image element
|
107
|
+
Then I should know it exists
|
108
|
+
Then I should know its' value is ""
|
109
|
+
And I should know it is visible
|
110
|
+
And I should know its' text includes ""
|
111
|
+
And I should know it is equal to itself
|
112
|
+
And I should know its' tag name is "img"
|
113
|
+
And I should know the attribute "readonly" is false
|
114
|
+
And I should be able to click it
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Feature: Form
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Submitting a form
|
7
|
+
When I locate the form by "id"
|
8
|
+
Then I should be able to submit the form
|
9
|
+
|
10
|
+
Scenario Outline: Locating a form on the page
|
11
|
+
When I locate the form by "<locate_by>"
|
12
|
+
Then I should be able to submit the form
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
| locate_by |
|
16
|
+
| id |
|
17
|
+
| class |
|
18
|
+
| xpath |
|
19
|
+
| index |
|
20
|
+
|
21
|
+
@multi
|
22
|
+
Scenario Outline: Locating table using multiple parameters
|
23
|
+
When I locate the form using "<param1>" and "<param2>"
|
24
|
+
Then I should be able to submit the form
|
25
|
+
|
26
|
+
Examples:
|
27
|
+
| param1 | param2 |
|
28
|
+
| class | index |
|
29
|
+
| name | index |
|
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Hidden Fields
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting a value from a hidden field
|
7
|
+
When I retrieve the hidden field element
|
8
|
+
Then I should see the hidden field contains "12345"
|
9
|
+
|
10
|
+
Scenario Outline: Locating hidden fields on the Page
|
11
|
+
When I locate the hidden field by "<locate_by>"
|
12
|
+
Then hidden field element should contains "12345"
|
13
|
+
|
14
|
+
Examples:
|
15
|
+
| locate_by |
|
16
|
+
| id |
|
17
|
+
| class |
|
18
|
+
| name |
|
19
|
+
| xpath |
|
20
|
+
| css |
|
21
|
+
| tag_name |
|
22
|
+
| index |
|
23
|
+
| text |
|
24
|
+
|
25
|
+
@multi
|
26
|
+
Scenario Outline: Locating a hidden field using multiple parameters
|
27
|
+
When I search for the hidden field by "<param1>" and "<param2>"
|
28
|
+
Then hidden field element should contains "12345"
|
29
|
+
|
30
|
+
Examples:
|
31
|
+
| param1 | param2 |
|
32
|
+
| class | index |
|
33
|
+
| name | index |
|
Binary file
|
@@ -0,0 +1,89 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<title>Static Elements Page</title>
|
4
|
+
</head>
|
5
|
+
<body>
|
6
|
+
<h2>Static Elements Page</h2>
|
7
|
+
|
8
|
+
|
9
|
+
<h3>Text Field</h3>
|
10
|
+
<input id="text_field_id" name="text_field_name" class="text_field_class"
|
11
|
+
size="40" type="text" />
|
12
|
+
|
13
|
+
<h3>Hidden Field</h3>
|
14
|
+
<input id="hidden_field_id" name="hidden_field_name" class="hidden_field_class"
|
15
|
+
size="40" type="hidden" value="12345" />
|
16
|
+
|
17
|
+
<h3>Text Area</h3>
|
18
|
+
<textarea rows="2" cols="20" id="text_area_id" class="text_area_class" name="text_area_name"></textarea>
|
19
|
+
|
20
|
+
<h3>Select List</h3>
|
21
|
+
<select name="sel_list_name" id="sel_list_id", class="sel_list_class">
|
22
|
+
<option value="option1">Test 1</option>
|
23
|
+
<option value="option2">Test 2</option>
|
24
|
+
</select>
|
25
|
+
|
26
|
+
|
27
|
+
<h3>Link</h3>
|
28
|
+
<a href="success.html" id="link_id" name="link_name" class="link_class" >Google Search</a>
|
29
|
+
|
30
|
+
<h3>Check Boxes</h3>
|
31
|
+
<input id="cb_id" name="cb_name" class="cb_class" type="checkbox" value="1" />
|
32
|
+
|
33
|
+
<h3>Radio Buttons</h3>
|
34
|
+
<input type="radio" id="milk_id" name="milk_name" class="milk_class" value="Milk"> Milk <br />
|
35
|
+
<input type="radio" id="butter_id" name="butter_name" class="butter_class" value="Butter">Butter
|
36
|
+
|
37
|
+
<h3>Div</h3>
|
38
|
+
<div id="div_id" name="div_name" class="div_class">
|
39
|
+
page-object rocks!
|
40
|
+
</div>
|
41
|
+
|
42
|
+
<h3>Span</h3>
|
43
|
+
<span id="span_id" name="span_name" class="span_class">
|
44
|
+
My alert
|
45
|
+
</span>
|
46
|
+
|
47
|
+
<h3>Table</h3>
|
48
|
+
<table id='table_id' name='table_name' class='table_class' border='1'>
|
49
|
+
<tr>
|
50
|
+
<td>Data1</td><td>Data2</td>
|
51
|
+
</tr>
|
52
|
+
<tr>
|
53
|
+
<td>Data3</td><td id='cell_id', name='cell_name' class='cell_class'>Data4</td>
|
54
|
+
</tr>
|
55
|
+
</table>
|
56
|
+
|
57
|
+
<h3>Button</h3>
|
58
|
+
<form method="get" action="success.html">
|
59
|
+
<input id='button_id' name='button_name' class='button_class' type="submit" value="Click Me">
|
60
|
+
</form>
|
61
|
+
|
62
|
+
<h3>Image</h3>
|
63
|
+
<img src="images/circle.png" id="image_id" name="image_name" class="image_class">
|
64
|
+
|
65
|
+
<h3>Form</h3>
|
66
|
+
<form id="form_id" class="form_class" name="form_name" action="/">
|
67
|
+
</form>
|
68
|
+
|
69
|
+
<h3>Unordered List</h3>
|
70
|
+
<ul id="ul_id" name="ul_name" class="ul_class">
|
71
|
+
<li id="li_id" name="li_name" class="li_class">Item One</li>
|
72
|
+
<li>Item Two</li>
|
73
|
+
<li>Item Three</li>
|
74
|
+
</ul>
|
75
|
+
|
76
|
+
<h3>Ordered List</h3>
|
77
|
+
<ol id="ol_id" name="ol_name" class="ol_class">
|
78
|
+
<li>Number One</li>
|
79
|
+
<li>Number Two</li>
|
80
|
+
<li>Number Three</li>
|
81
|
+
</ol>
|
82
|
+
|
83
|
+
<h3>Links for multi select</h3>
|
84
|
+
<a href="success.html">Hello</a>
|
85
|
+
<a href="success.html">Hello</a>
|
86
|
+
<a href="success.html">Hello</a>
|
87
|
+
|
88
|
+
</body>
|
89
|
+
</html>
|