Skip to content

Commit

Permalink
Merge pull request cheezy#334 from morozgrafix/master
Browse files Browse the repository at this point in the history
Add support for 'i' tag
  • Loading branch information
cheezy committed Jan 6, 2016
2 parents 4a40405 + 6f93ca9 commit b577b2a
Show file tree
Hide file tree
Showing 18 changed files with 409 additions and 158 deletions.
21 changes: 11 additions & 10 deletions features/html/multi_elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<textarea rows="2" cols="20" class="textarea">textarea 1</textarea>
<textarea rows="2" cols="20" class="textarea">textarea 2</textarea>
<textarea rows="2" cols="20" class="textarea">textarea 3</textarea>

<select class="selectlist">
<option value="selectlist 1">Option 1</option>
</select>
Expand All @@ -33,23 +33,23 @@
<a href="blah.html" class="link">link 1</a>
<a href="blah.html" class="link">link 2</a>
<a href="blah.html" class="link">link 3</a>

<input class="checkbox" type="checkbox" value="checkbox 1"/>
<input class="checkbox" type="checkbox" value="checkbox 2"/>
<input class="checkbox" type="checkbox" value="checkbox 3"/>

<input type="radio" class="radio" value="radio 1">
<input type="radio" class="radio" value="radio 2">
<input type="radio" class="radio" value="radio 3">

<div class="div">Div 1</div>
<div class="div">Div 2</div>
<div class="div">Div 3</div>

<span class="span">Span 1</span>
<span class="span">Span 2</span>
<span class="span">Span 3</span>

<label class="label">Label 1</label>
<label class="label">Label 2</label>
<label class="label">Label 3</label>
Expand Down Expand Up @@ -77,7 +77,7 @@
<td>Data 9</td>
</tr>
</table>

<img src="images/circle.png" class="image", alt="image 1">
<img src="images/circle.png" class="image", alt="image 2">
<img src="images/circle.png" class="image", alt="image 3">
Expand Down Expand Up @@ -115,30 +115,31 @@ <h1 class="h1">H1 Three</h1>
<h2 class="h2">H2 One</h2>
<h2 class="h2">H2 Two</h2>
<h2 class="h2">H2 Three</h2>

<h3 class="h3">H3 One</h3>
<h3 class="h3">H3 Two</h3>
<h3 class="h3">H3 Three</h3>

<h4 class="h4">H4 One</h4>
<h4 class="h4">H4 Two</h4>
<h4 class="h4">H4 Three</h4>

<h5 class="h5">H5 One</h5>
<h5 class="h5">H5 Two</h5>
<h5 class="h5">H5 Three</h5>

<h6 class="h6">H6 One</h6>
<h6 class="h6">H6 Two</h6>
<h6 class="h6">H6 Three</h6>

<p class="p">Paragraph One</p>
<p class="p">Paragraph Two</p>
<p class="p">Paragraph Three</p>

<input type="file" class="file_field_class" title="File Field 1" />
<input type="file" class="file_field_class" title="File Field 2" />
<input type="file" class="file_field_class" title="File Field 3" />
In bold <b>One B</b> and <b>Two B</b> for example text
In italic <i>One I</i> and <i>Two I</i> for example text
</body>
</html>
3 changes: 2 additions & 1 deletion features/html/static_elements.html
Original file line number Diff line number Diff line change
Expand Up @@ -180,11 +180,12 @@ <h6 id="h6_id" class="h6_class" name="h6_name">h6's are cool</h6>
<summary id='summary_id'>The summary</summary>
The details
</details>

<figure id='figure_id'>
<img src="images/img_pulpit.jpg" alt="The Pulpit Rock" width="304" height="228">
</figure>
This text have <b id="b_id" class="b_class" name="b_name">some text in bold</b>
This text have <i id="i_id" class="i_class" name="i_name">some text in italic</i>
<button id="button_button">This button is a button</button>
<input id="input_button" type="button" value="This button is a input" />
</body>
Expand Down
21 changes: 21 additions & 0 deletions features/italic.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feature: Italic

Background:
Given I am on the static elements page

Scenario: Getting the text of headings
When I get the italic text for the "i" element
Then I should see "some text in italic" in italic

Scenario Outline: Locating i on the Page
When I search italic text for the i by "<search_by>"
Then I should see "some text in italic" in italic

Scenarios:
| search_by |
| id |
| class |
| name |
| xpath |
| index |
| css |
50 changes: 28 additions & 22 deletions features/multi_elements.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Feature: Multi Elements
And the value of button 1 should be "Button 1"
And the value of button 2 should be "Button 2"
And the value of button 3 should be "Button 3"

Scenario: Selecting buttons using no identifier
When I select all buttons using no identifier
Then I should have 3 buttons
Expand All @@ -20,7 +20,7 @@ Feature: Multi Elements
And the value of text field 1 should be "text 1"
And the value of text field 2 should be "text 2"
And the value of text field 3 should be "text 3"

Scenario: Selecting text fields using no identifier
When I select all text fields using no identifier
Then I should have 3 text fields
Expand Down Expand Up @@ -79,7 +79,7 @@ Feature: Multi Elements
Scenario: Selecting checkboxes using no identifier
When I select checboxes using no identifier
Then I should have 3 checkboxes

Scenario: Selecting radio buttons using an identifier
When I select the radio button with class "radio"
Then I should have 3 radio buttons
Expand Down Expand Up @@ -141,7 +141,7 @@ Feature: Multi Elements
And the alt for image 1 should be "image 1"
And the alt for image 2 should be "image 2"
And the alt for image 3 should be "image 3"

Scenario: Selecting images using no identifier
When I select the images using no identifier
Then I should have 3 images
Expand All @@ -152,7 +152,7 @@ Feature: Multi Elements
And the action for form 1 should be "form1"
And the action for form 2 should be "form2"
And the action for form 3 should be "form3"

Scenario: Selecting forms using no identifier
When I select the forms using no identifier
Then I should have 3 forms
Expand All @@ -163,7 +163,7 @@ Feature: Multi Elements
And the text for list item 1 should be "Item One"
And the text for list item 2 should be "Item Two"
And the text for list item 3 should be "Item Three"

Scenario: Selecting list items using no identifier
When I select the list items using no identifier
Then I should have 8 list items
Expand All @@ -174,18 +174,18 @@ Feature: Multi Elements
And the text for the first item in unordered list 1 should be "Item One"
And the text for the first item in unordered list 2 should be "Item Four"
And the text for the first item in unordered list 3 should be "Item Five"

Scenario: Selecting unordered lists using no identifier
When I select the unordered list using no parameter
Then I should have 3 unordered lists

Scenario: Selecting ordered lists using an identifier
When I select the ordered lists with class "ol"
Then I should have 3 ordered lists
And the text for the first item in ordered list 1 should be "Number One"
And the text for the first item in ordered list 2 should be "Number Two"
And the text for the first item in ordered list 3 should be "Number Three"

Scenario: Selecting ordered lists using no identifier
When I select the ordered lists using no identifier
Then I should have 3 ordered lists
Expand All @@ -196,7 +196,7 @@ Feature: Multi Elements
And the text for h1 1 should be "H1 One"
And the text for h1 2 should be "H1 Two"
And the text for h1 3 should be "H1 Three"

Scenario: Selecting h1s using no identifier
When I select h1s using no identifier
Then I should have 3 h1s
Expand All @@ -207,7 +207,7 @@ Feature: Multi Elements
And the text for h2 1 should be "H2 One"
And the text for h2 2 should be "H2 Two"
And the text for h2 3 should be "H2 Three"

Scenario: Selecting h2s using no identifier
When I select h2s using no identifier
Then I should have 3 h2s
Expand All @@ -218,7 +218,7 @@ Feature: Multi Elements
And the text for h3 1 should be "H3 One"
And the text for h3 2 should be "H3 Two"
And the text for h3 3 should be "H3 Three"

Scenario: Selecting h3s using no identifier
When I select h3s using no identifier
Then I should have 3 h3s
Expand All @@ -229,18 +229,18 @@ Feature: Multi Elements
And the text for H4 1 should be "H4 One"
And the text for H4 2 should be "H4 Two"
And the text for H4 3 should be "H4 Three"

Scenario: Selecting h4s using no identifier
When I select h4s using no identifier
Then I should have 3 h4s

Scenario: Selecting h5s using an identifier
When I select the h5s with the class "h5"
Then I should have 3 h5s
And the text for H5 1 should be "H5 One"
And the text for H5 2 should be "H5 Two"
And the text for H5 3 should be "H5 Three"

Scenario: Selecting h5s using no identifier
When I select h5s using no identifier
Then I should have 3 h5s
Expand All @@ -251,7 +251,7 @@ Feature: Multi Elements
And the text for H6 1 should be "H6 One"
And the text for H6 2 should be "H6 Two"
And the text for H6 3 should be "H6 Three"

Scenario: Selecting h6s using no identifier
When I select h6s using no identifier
Then I should have 3 h6s
Expand Down Expand Up @@ -295,7 +295,7 @@ Feature: Multi Elements
And the text of div 1 should be "Div 1"
And the text of div 2 should be "Div 2"
And the text of div 3 should be "Div 3"

Scenario: Selecting all divs using a block instead of an identifier
When I select the divs using a block
Then I should have 3 divs
Expand Down Expand Up @@ -421,35 +421,35 @@ Feature: Multi Elements
And the text for h1 1 should be "H1 One"
And the text for h1 2 should be "H1 Two"
And the text for h1 3 should be "H1 Three"

Scenario: Selecting h2s based on a class declaration
When I select the h2s using the generated method
Then I should have 3 h2s
And the text for h2 1 should be "H2 One"
And the text for h2 2 should be "H2 Two"
And the text for h2 3 should be "H2 Three"

Scenario: Selecting h3s based on a class declaration
When I select the h3s using the generated method
Then I should have 3 h3s
And the text for h3 1 should be "H3 One"
And the text for h3 2 should be "H3 Two"
And the text for h3 3 should be "H3 Three"

Scenario: Selecting h4s based on a class declaration
When I select the h4s using the generated method
Then I should have 3 h4s
And the text for H4 1 should be "H4 One"
And the text for H4 2 should be "H4 Two"
And the text for H4 3 should be "H4 Three"

Scenario: Selecting h5s based on a class declaration
When I select the h5s using the generated method
Then I should have 3 h5s
And the text for H5 1 should be "H5 One"
And the text for H5 2 should be "H5 Two"
And the text for H5 3 should be "H5 Three"

Scenario: Selecting h6s based on a class declaration
When I select the h6s using the generated method
Then I should have 3 h6s
Expand Down Expand Up @@ -490,3 +490,9 @@ Feature: Multi Elements
Then I should have 2 bs
And the text for b 1 should be "One B"
And the text for b 2 should be "Two B"

Scenario: Selecting is using an identifier
When I select the is
Then I should have 2 is
And the text for i 1 should be "One I"
And the text for i 2 should be "Two I"
12 changes: 12 additions & 0 deletions features/step_definitions/italic_steps.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
When /^I get the italic text for the "([^\"]*)" element$/ do |el|
@i = @page.send "#{el}_id"
end

Then /^I should see "([^\"]*)" in italic$/ do |text|
@i.should == text
end

When /^I search italic text for the (\w+) by "([^"]*)"$/ do |text_decorator, type|
@i = @page.send "#{text_decorator}_#{type}"
end

13 changes: 13 additions & 0 deletions features/step_definitions/multi_elements_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class MultiElementsPage
file_fields(:the_file_fields, :class => 'file_field_class')
elements(:generic_label, :label, :class => 'label')
b(:bs)
i(:is)
end


Expand Down Expand Up @@ -539,3 +540,15 @@ class MultiElementsPage
Then /^the text for b (\d+) should be "([^\"]*)"$/ do |b_num, text|
@elements[b_num.to_i - 1].text.should == text
end

When /^I select the is$/ do
@elements = @page.i_elements
end

Then /^I should have (\d+) is$/ do |num_is|
@elements.size.should == num_is.to_i
end

Then /^the text for i (\d+) should be "([^\"]*)"$/ do |i_num, text|
@elements[i_num.to_i - 1].text.should == text
end
13 changes: 11 additions & 2 deletions features/support/page.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ class Page
div(:div_title, :title => 'div_title')
div(:div_class_index, :class => "div_class", :index => 0)
div(:div_name_index, :name => "div_name", :index => 0)

div(:div_data_entity, :data_entity => "test")

span(:span_id, :id => 'span_id')
Expand Down Expand Up @@ -349,7 +349,7 @@ class Page
element(:details_id, :details, :id => 'details_id')

figure(:figure_id, :id => 'figure_id')

svg(:svg_id, :id => 'the_svg')

b(:b_id, :id => 'b_id')
Expand All @@ -360,5 +360,14 @@ class Page
b(:b_xpath, :xpath => '//b')
b(:b_class_index, :class => 'b_class', :index => 0)
b(:b_name_index, :name => 'b_name', :index => 0)

i(:i_id, :id => 'i_id')
i(:i_class, :class => 'i_class')
i(:i_css, :css => '.i_class')
i(:i_name, :name => 'i_name')
i(:i_index, :index => 0)
i(:i_xpath, :xpath => '//i')
i(:i_class_index, :class => 'i_class', :index => 0)
i(:i_name_index, :name => 'i_name', :index => 0)
end

Loading

0 comments on commit b577b2a

Please sign in to comment.