Skip to content

Commit

Permalink
Fix up all tests
Browse files Browse the repository at this point in the history
  • Loading branch information
obscurerichard committed Aug 21, 2014
1 parent d8a575d commit 973cc41
Show file tree
Hide file tree
Showing 7 changed files with 100 additions and 112 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.bundle
/vendor
/results
2 changes: 1 addition & 1 deletion config/cucumber.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
default: features --tag ~@wip -tag ~@manual
default: features --tag ~@wip --tag ~@manual
11 changes: 7 additions & 4 deletions features/main.feature
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
Feature: Main tests
In order to make sure that the web page is working
As a normal user
I want to check out the home page in a variety of aspect ratios

@smoke @regression @desktop
Scenario: Visit the home page
Given I am on the moduscreate home page
Given I am on the desktop home page
Then I must see the page title "Modus Create | HTML5 Application Development & Training"
Given I click the "Services" span
Then I must see the page title "Services | Modus Create"

@regression @mobile
Scenario: Visit the home page on a mobile device
Given I am on the moduscreate home page
Given I am on the desktop home page
Then I must see the page title "Modus Create | HTML5 Application Development & Training"
Given I click the "icon-reorder" icon
And I wait for the menu to b displayed
And I wait for the menu to be displayed

@wip @tablet
Scenario: Visit the home page on a tablet
Given I am on the moduscreate home page
Given I am on the desktop home page
Then I must see the page title "Modus Create | HTML5 Application Development & Training"
Given I click the "Blog" span
Then I must see the page title "Blog | Modus Create"
94 changes: 82 additions & 12 deletions features/step_definitions/common_steps.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
puts "URL = #{@browser.url}" #This step links up with the "path_to" method found in support/paths.rb
end

Then(/^I must see the page title "(.*?)"$/) do |title|
assert_equal(@browser.title, title)
end

Given(/^I fill in the text field "(.*?)" with "(.*?)"$/) do |text_field_name, text|
@browser.text_field(:name => text_field_name).set text
end
Expand All @@ -19,10 +15,6 @@
@browser.button(:text => button_text).click
end

Given(/^I click the "(.*?)" span$/) do |span_text|
@browser.span(:text => span_text).click
end

Given(/^I wait for the "(.*?)" text to be displayed$/) do |text|
Watir::Wait.until { @browser.text.include? text }
end
Expand All @@ -31,10 +23,6 @@
assert_equal(true,@browser.text.include?(text))
end

Given(/^I click the "(.*?)" link$/) do |link_text|
@browser.link(:text => link_text).click
end

Given(/^I wait for the "(.*?)" message\-box to be displayed$/) do |arg1|
@browser.div(:class => "popover-content").wait_until_present
end
Expand All @@ -51,3 +39,85 @@
end
end


Then(/^I must see the page title "(.*?)"$/) do |title|
assert_equal(title,@browser.title)
end

###### Links
Given(/^I click the "(.*?)" link$/) do |ele|
case
when @browser.link(:id, ele).exists?
@browser.link(:id, ele).click

when @browser.link(:text, ele).exists?
@browser.link(:text, ele).click

when @browser.link(:class, ele).exists?
@browser.link(:class, ele).click

when @browser.link(:href, ele).exists?
@browser.link(:href, ele).click

else
fail("Link => #{ele} NOT FOUND")
end
end

###### Span
Given(/^I click the "(.*?)" span$/) do |ele|
case
when @browser.span(:id, ele).exists?
@browser.span(:id, ele).click

when @browser.span(:text, ele).exists?
@browser.span(:text, ele).click

when @browser.span(:class, ele).exists?
@browser.span(:class, ele).click

else
fail("Span => #{ele} NOT FOUND")
end
end

###### Icon
Given(/^I click the "(.*?)" icon$/) do |ele|
case
when @browser.i(:id, ele).exists?
@browser.i(:id, ele).click

when @browser.i(:text, ele).exists?
@browser.i(:text, ele).click

when @browser.i(:class, ele).exists?
@browser.i(:class, ele).click

else
fail("Icon => #{ele} NOT FOUND")
end
end

Given(/^I wait for the menu to be displayed$/) do
@browser.ul(:class => "off-canvas-list").wait_until_present
end
Given(/^I wait for the form name "(.*?)"$/) do |arg1|
@browser.form(:name => arg1).wait_until_present
end

Given(/^I click the "(.*?)" bs popover$/) do |arg1|
@browser.button(:text => button_text).click
end

Given(/^I click the "(.*?)" path class$/) do |arg1|
@browser.div(:class => "uv.bubble-foreground").click
end

Given(/^I click the "(.*?)" h(\d+)$/) do |arg1, arg2|
@browser.div(:class => 'container').h4(:text => arg1).click
end

Then(/^I must see the "(.*?)" text field has a class attribute of "(.*?)"$/) do |textfield_name, attribute|
class_attr_values = @browser.input(:name,textfield_name).attribute_value('class')
assert_includes(class_attr_values,attribute)
end
29 changes: 0 additions & 29 deletions features/step_definitions/example_steps.rb

This file was deleted.

66 changes: 0 additions & 66 deletions features/step_definitions/myapp_steps.rb

This file was deleted.

9 changes: 9 additions & 0 deletions features/support/hooks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ def get_browser
end
end

Before ('@tablet') do
@browser = get_browser
if DRIVER == "chrome"
@browser.window.resize_to(1024,768)
else
@browser.window.maximize
end
end

After do
@browser.close
end
Expand Down

0 comments on commit 973cc41

Please sign in to comment.