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
@@ -0,0 +1,33 @@
|
|
1
|
+
Feature: Image
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting the image element
|
7
|
+
When I get the image element
|
8
|
+
Then the image should be "106" pixels wide
|
9
|
+
And the image should be "106" pixels tall
|
10
|
+
|
11
|
+
Scenario Outline: Locating an image on the page
|
12
|
+
When I get the image element by "<locate_by>"
|
13
|
+
Then the image should be "106" pixels wide
|
14
|
+
And the image should be "106" pixels tall
|
15
|
+
|
16
|
+
Examples:
|
17
|
+
| locate_by |
|
18
|
+
| id |
|
19
|
+
| class |
|
20
|
+
| name |
|
21
|
+
| xpath |
|
22
|
+
| index |
|
23
|
+
|
24
|
+
@multi
|
25
|
+
Scenario Outline: Locating an image using multiple parameters
|
26
|
+
When I get the image element bys "<param1>" and "<param2>"
|
27
|
+
Then the image should be "106" pixels wide
|
28
|
+
And the image should be "106" pixels tall
|
29
|
+
|
30
|
+
Examples:
|
31
|
+
| param1 | param2 |
|
32
|
+
| class | index |
|
33
|
+
| name | index |
|
@@ -0,0 +1,39 @@
|
|
1
|
+
Feature: Links
|
2
|
+
In order to interact with Links
|
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 link
|
9
|
+
When I select the link labeled "Google Search"
|
10
|
+
Then the page should contain the text "Success"
|
11
|
+
|
12
|
+
Scenario Outline: Locating links on the Page
|
13
|
+
When I locate the link by "<locate_by>"
|
14
|
+
Then I should be able to select the link
|
15
|
+
|
16
|
+
Examples:
|
17
|
+
| locate_by |
|
18
|
+
| class |
|
19
|
+
| href |
|
20
|
+
| id |
|
21
|
+
| index |
|
22
|
+
| name |
|
23
|
+
| text |
|
24
|
+
| xpath |
|
25
|
+
| link |
|
26
|
+
| link_text |
|
27
|
+
|
28
|
+
Scenario: Retrieve a Link
|
29
|
+
When I retrieve a link element
|
30
|
+
Then I should know it exists
|
31
|
+
And I should know it is visible
|
32
|
+
|
33
|
+
@multi
|
34
|
+
Scenario: Support for multiple parameters
|
35
|
+
When I select a link labeled "Hello" and index "0"
|
36
|
+
Then the page should contain the text "Success"
|
37
|
+
Given I am on the static elements page
|
38
|
+
When I select a link labeled "Hello" and index "1"
|
39
|
+
Then the page should contain the text "Success"
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: List item
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting the text from a list item
|
7
|
+
When I get the text from the list item
|
8
|
+
Then the text should be "Item One"
|
9
|
+
|
10
|
+
@name
|
11
|
+
Scenario Outline: Locating list items on the page
|
12
|
+
When I locate the list item by "<locate_by>"
|
13
|
+
Then the text should be "Item One"
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
| locate_by |
|
17
|
+
| id |
|
18
|
+
| class |
|
19
|
+
| xpath |
|
20
|
+
| index |
|
21
|
+
| name |
|
22
|
+
|
23
|
+
@multi
|
24
|
+
Scenario Outline: Locating list items using multiple parameters
|
25
|
+
When I search for the list item by "<param1>" and "<param2>"
|
26
|
+
Then the text should be "Item One"
|
27
|
+
|
28
|
+
Examples:
|
29
|
+
| param1 | param2 |
|
30
|
+
| class | index |
|
31
|
+
| name | index |
|
@@ -0,0 +1,35 @@
|
|
1
|
+
Feature: Ordered list
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting the first element from the ordered list
|
7
|
+
When I get the first item from the ordered list
|
8
|
+
Then the list item's text should be "Number One"
|
9
|
+
|
10
|
+
@name
|
11
|
+
Scenario Outline: Locating ordered lists on the page
|
12
|
+
When I locate the ordered list by "<locate_by>"
|
13
|
+
And I get the first item from the list
|
14
|
+
Then the list item's text should be "Number One"
|
15
|
+
And the list should contain 3 items
|
16
|
+
And each item should contain "Number"
|
17
|
+
|
18
|
+
Examples:
|
19
|
+
| locate_by |
|
20
|
+
| id |
|
21
|
+
| class |
|
22
|
+
| xpath |
|
23
|
+
| index |
|
24
|
+
| name |
|
25
|
+
|
26
|
+
@multi
|
27
|
+
Scenario Outline: Locating ordered lists using multiple parameters
|
28
|
+
When I search for the ordered list by "<param1>" and "<param2>"
|
29
|
+
And I get the first item from the list
|
30
|
+
Then the list items text should be "Number One"
|
31
|
+
|
32
|
+
Examples:
|
33
|
+
| param1 | param2 |
|
34
|
+
| class | index |
|
35
|
+
| name | index |
|
@@ -0,0 +1,31 @@
|
|
1
|
+
Feature: Page level actions
|
2
|
+
In order to act on pages from a web site
|
3
|
+
Testers will need to use the page object to encapsulate access
|
4
|
+
|
5
|
+
Scenario: Getting the text from a web page
|
6
|
+
Given I am on the static elements page
|
7
|
+
Then the page should contain the text "Static Elements Page"
|
8
|
+
|
9
|
+
Scenario: Getting the html from a web page
|
10
|
+
Given I am on the static elements page
|
11
|
+
Then the page should contain the html "<title>Static Elements Page</title>"
|
12
|
+
|
13
|
+
Scenario: Getting the title from a web page
|
14
|
+
Given I am on the static elements page
|
15
|
+
Then the page should have the title "Static Elements Page"
|
16
|
+
|
17
|
+
Scenario: Going to baidu.com from a web page
|
18
|
+
Given I am on the static elements page
|
19
|
+
Then I am able to go to baidu.com
|
20
|
+
|
21
|
+
Scenario: Going to baidu.com by default
|
22
|
+
Given I can goto baidu.com by default
|
23
|
+
Then the page should have the title "百度"
|
24
|
+
|
25
|
+
Scenario: Using the visit_page methods without block
|
26
|
+
Given I can goto baidu.com using visit_page without block
|
27
|
+
Then the page should have the title "百度" using on_page without block
|
28
|
+
|
29
|
+
Scenario: Using the visit_page methods with block
|
30
|
+
Given I can goto baidu.com using visit_page with block
|
31
|
+
Then the page should have the title "百度" using on_page with block
|
@@ -0,0 +1,42 @@
|
|
1
|
+
Feature: Radio Buttons
|
2
|
+
In order to interact with radio 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 radio button
|
9
|
+
When I select the "Milk" radio button
|
10
|
+
Then the "Milk" radio button should be selected
|
11
|
+
When I select the "Butter" radio button
|
12
|
+
Then the "Butter" radio button should be selected
|
13
|
+
|
14
|
+
@dev
|
15
|
+
Scenario Outline: Locating radio buttons on the Page
|
16
|
+
When I locate the radio button by "<locate_by>"
|
17
|
+
And I select the radio button
|
18
|
+
Then the "Milk" radio button should be selected
|
19
|
+
|
20
|
+
Scenarios:
|
21
|
+
| locate_by |
|
22
|
+
| id |
|
23
|
+
| class |
|
24
|
+
| name |
|
25
|
+
| xpath |
|
26
|
+
| index |
|
27
|
+
|
28
|
+
Scenario: Retrieve a radio button
|
29
|
+
When I retrieve a radio button
|
30
|
+
Then I should know it exists
|
31
|
+
And I should know it is visible
|
32
|
+
|
33
|
+
@multi
|
34
|
+
Scenario Outline: Locating radio buttons using multiple parameters
|
35
|
+
When I search for the radio button by "<param1>" and "<param2>"
|
36
|
+
And I select the radio button
|
37
|
+
Then the "Milk" radio button should be selected
|
38
|
+
|
39
|
+
Examples:
|
40
|
+
| param1 | param2 |
|
41
|
+
| class | index |
|
42
|
+
| name | index |
|
@@ -0,0 +1,48 @@
|
|
1
|
+
Feature: Select List
|
2
|
+
In order to interact with select lists
|
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 select list
|
9
|
+
When I select "Test 2" from the select list
|
10
|
+
Then the current item should be "option2"
|
11
|
+
|
12
|
+
Scenario Outline: Locating select lists on the Page
|
13
|
+
When I locate the select list by "<locate_by>"
|
14
|
+
Then I should be able to select "Test 2"
|
15
|
+
And the value for the selected item should be "option2"
|
16
|
+
|
17
|
+
Examples:
|
18
|
+
| locate_by |
|
19
|
+
| id |
|
20
|
+
| class |
|
21
|
+
| name |
|
22
|
+
| xpath |
|
23
|
+
| index |
|
24
|
+
# | value |
|
25
|
+
# | text |
|
26
|
+
|
27
|
+
Scenario: Retrieve a select list
|
28
|
+
When I retrieve a select list
|
29
|
+
Then I should know it exists
|
30
|
+
And I should know it is visible
|
31
|
+
|
32
|
+
@dev
|
33
|
+
Scenario: Iterating through the options in the select list
|
34
|
+
When I search for the select list by "id"
|
35
|
+
Then option "1" should contain "Test 1"
|
36
|
+
And option "2" should contain "Test 2"
|
37
|
+
And each option should contain "Test"
|
38
|
+
|
39
|
+
@multi
|
40
|
+
Scenario Outline: Locating a hidden field using multiple parameters
|
41
|
+
When I search for the select list bys "<param1>" and "<param2>"
|
42
|
+
Then I should be able to select "Test 2"
|
43
|
+
And the value for the selected item should be "option2"
|
44
|
+
|
45
|
+
Examples:
|
46
|
+
| param1 | param2 |
|
47
|
+
| class | index |
|
48
|
+
| name | index |
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Feature: Span
|
2
|
+
|
3
|
+
Background:
|
4
|
+
Given I am on the static elements page
|
5
|
+
|
6
|
+
Scenario: Getting the text from a span
|
7
|
+
When I get the text from the span
|
8
|
+
Then the text should be "My alert"
|
9
|
+
|
10
|
+
@name
|
11
|
+
Scenario Outline: Locating spans on the page
|
12
|
+
When I locate the span by "<locate_by>"
|
13
|
+
Then the text should be "My alert"
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
| locate_by |
|
17
|
+
| id |
|
18
|
+
| class |
|
19
|
+
| xpath |
|
20
|
+
| index |
|
21
|
+
| name |
|
22
|
+
|
23
|
+
Scenario: Retrieve a Span
|
24
|
+
When I retrieve a span element
|
25
|
+
Then I should know it exists
|
26
|
+
And I should know it is visible
|
27
|
+
|
28
|
+
@multi
|
29
|
+
Scenario Outline: Locating span using multiple parameters
|
30
|
+
When I search for the span by "<param1>" and "<param2>"
|
31
|
+
Then the text should be "My alert"
|
32
|
+
|
33
|
+
Examples:
|
34
|
+
| param1 | param2 |
|
35
|
+
| class | index |
|
36
|
+
| name | index |
|
@@ -0,0 +1,24 @@
|
|
1
|
+
When(/^I click the button$/) do
|
2
|
+
@page.button_id
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I should be on the success page$/) do
|
6
|
+
expect(@page.text).to include 'Success'
|
7
|
+
expect(@page.title).to eql 'Success'
|
8
|
+
end
|
9
|
+
|
10
|
+
When(/^I locate the button by "(.*?)"$/) do |how|
|
11
|
+
@how = how
|
12
|
+
end
|
13
|
+
|
14
|
+
Then(/^I should be able to click the button$/) do
|
15
|
+
@page.send "button_#{@how}".to_sym
|
16
|
+
end
|
17
|
+
|
18
|
+
When(/^I retrieve a button element$/) do
|
19
|
+
@element = @page.send "button_id_button".to_sym
|
20
|
+
end
|
21
|
+
|
22
|
+
When(/^I search for the button by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
23
|
+
@how = "#{param1}_#{param2}"
|
24
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
When(/^I select the First check box$/) do
|
2
|
+
@page.check_cb_id
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^the First check box should be selected$/) do
|
6
|
+
expect(@page.cb_id_checked?).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I unselect the First check box$/) do
|
10
|
+
@page.uncheck_cb_id
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^the First check box should not be selected$/) do
|
14
|
+
expect(@page.cb_id_checked?).to be false
|
15
|
+
end
|
16
|
+
|
17
|
+
When(/^I locate the check box by "(.*?)"$/) do |how|
|
18
|
+
@how = how
|
19
|
+
end
|
20
|
+
|
21
|
+
Then(/^I should be able to check the check box$/) do
|
22
|
+
@page.send "check_cb_#{@how}".to_sym
|
23
|
+
end
|
24
|
+
|
25
|
+
When(/^I retrieve a check box element$/) do
|
26
|
+
@element = @page.cb_id_checkbox
|
27
|
+
end
|
28
|
+
|
29
|
+
When(/^I search for the check box by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
30
|
+
@how = "#{param1}_#{param2}"
|
31
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
When(/^I get the text from the div$/) do
|
2
|
+
@text = @page.div_id
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^the text should be "(.*?)"$/) do |expected_text|
|
6
|
+
expect(@text).to eql expected_text
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I locate the div by "(.*?)"$/) do |how|
|
10
|
+
@text = @page.send "div_#{how}".to_sym
|
11
|
+
end
|
12
|
+
|
13
|
+
When(/^I retrieve the div element$/) do
|
14
|
+
@element = @page.div_id_div
|
15
|
+
end
|
16
|
+
|
17
|
+
When(/^I search for the div by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
18
|
+
@text = @page.send "div_#{param1}_#{param2}".to_sym
|
19
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
Then(/^I should know its' text is "(.*?)"$/) do |text|
|
2
|
+
expect(@element.text).to eql text
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I should know it is equal to itself$/) do
|
6
|
+
expect(@element==@element).to be true
|
7
|
+
end
|
8
|
+
|
9
|
+
Then(/^I should know its' tag name is "(.*?)"$/) do |tagname|
|
10
|
+
expect(@element.tag_name).to eql tagname
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^I should know the attribute "(.*?)" is false$/) do |attr_name|
|
14
|
+
@attr = @element.attribute_value(attr_name)
|
15
|
+
# expect(@attr.is_a? NilClass).to be true
|
16
|
+
expect(@attr).to be_nil
|
17
|
+
end
|
18
|
+
|
19
|
+
Then(/^I should be able to click it$/) do
|
20
|
+
@element.click
|
21
|
+
end
|
22
|
+
|
23
|
+
Then(/^I should know its' value is "(.*?)"$/) do |value|
|
24
|
+
expect(@element.value).to eql value
|
25
|
+
end
|
26
|
+
|
27
|
+
Then(/^I should know its' text includes "(.*?)"$/) do |text|
|
28
|
+
expect(@element.text).to include text
|
29
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
When(/^I locate the form by "(.*?)"$/) do |how|
|
2
|
+
@element = @page.send "form_#{how}_form"
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I should be able to submit the form$/) do
|
6
|
+
@element.submit
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I locate the form using "(.*?)" and "(.*?)"$/) do |param1, param2|
|
10
|
+
@element = @page.send "form_#{param1}_#{param2}_form"
|
11
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
When(/^I retrieve the hidden field element$/) do
|
2
|
+
@page.hidden_field_id_hidden_field
|
3
|
+
end
|
4
|
+
|
5
|
+
Then(/^I should see the hidden field contains "(.*?)"$/) do |text|
|
6
|
+
expect(@page.hidden_field_id).to eql text
|
7
|
+
end
|
8
|
+
|
9
|
+
When(/^I locate the hidden field by "(.*?)"$/) do |how|
|
10
|
+
@element = @page.send "hidden_field_#{how}_hidden_field".to_sym
|
11
|
+
end
|
12
|
+
|
13
|
+
Then(/^hidden field element should contains "(.*?)"$/) do |text|
|
14
|
+
expect(@element.value).to eql text
|
15
|
+
end
|
16
|
+
|
17
|
+
When(/^I search for the hidden field by "(.*?)" and "(.*?)"$/) do |param1, param2|
|
18
|
+
@element = @page.send "hidden_field_#{param1}_#{param2}_hidden_field".to_sym
|
19
|
+
end
|