whirlwind 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.autotest +23 -0
- data/.gemtest +0 -0
- data/History.txt +6 -0
- data/Manifest.txt +79 -0
- data/README.txt +76 -0
- data/Rakefile +15 -0
- data/bin/whirlwind +99 -0
- data/demo_test_site/demo_site.rb +37 -0
- data/demo_test_site/public/images/arrow_left_48.png +0 -0
- data/demo_test_site/public/images/arrow_right_48.png +0 -0
- data/demo_test_site/public/images/down.gif +0 -0
- data/demo_test_site/public/images/header.jpg +0 -0
- data/demo_test_site/public/images/menu.gif +0 -0
- data/demo_test_site/public/images/menuhover.gif +0 -0
- data/demo_test_site/public/javascripts/browser.menu.js +61 -0
- data/demo_test_site/public/javascripts/cyberconnect_helpers.js +369 -0
- data/demo_test_site/public/javascripts/jquery-1.5.1.min.js +16 -0
- data/demo_test_site/public/javascripts/jquery-1.6.2.min.js +18 -0
- data/demo_test_site/public/javascripts/jquery-ui-1.8.10.custom.min.js +1370 -0
- data/demo_test_site/public/javascripts/jquery.layout.min-1.2.0.js +80 -0
- data/demo_test_site/public/javascripts/jqueryslidemenu.css +93 -0
- data/demo_test_site/public/javascripts/jqueryslidemenu.js +48 -0
- data/demo_test_site/public/javascripts/ui.accordion.js +477 -0
- data/demo_test_site/public/jquery.ui.all.css +11 -0
- data/demo_test_site/public/jquery.ui.base.css +11 -0
- data/demo_test_site/public/jquery.ui.theme.css +252 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-icons_222222_256x240.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-icons_2e83ff_256x240.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-icons_454545_256x240.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-icons_888888_256x240.png +0 -0
- data/demo_test_site/public/jquery_css/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/demo_test_site/public/jquery_css/jquery-ui-1.8.10.custom.css +573 -0
- data/demo_test_site/public/jquery_layout.css +14 -0
- data/demo_test_site/public/jqueryslidemenu.css +93 -0
- data/demo_test_site/public/menu.css +12 -0
- data/demo_test_site/public/style.css +196 -0
- data/demo_test_site/views/index.erb +294 -0
- data/images/.placeholder +0 -0
- data/lib/browser.rb +22 -0
- data/lib/cucumber/formatter/cucumber.css +282 -0
- data/lib/cucumber/formatter/html_image.rb +750 -0
- data/lib/cucumber/formatter/jquery-min.js +154 -0
- data/lib/cucumber.rb +68 -0
- data/lib/duration.rb +13 -0
- data/lib/io.rb +31 -0
- data/lib/ordered_xml_markup.rb +24 -0
- data/lib/rspec.rb +75 -0
- data/lib/watir.rb +105 -0
- data/lib/whirlwind.rb +39 -0
- data/sites/demo/conf/base_urls.yml +6 -0
- data/sites/demo/conf/browser.yaml +1 -0
- data/sites/demo/conf/html_elements.yaml +22 -0
- data/sites/demo/conf/remote_machine.yaml +12 -0
- data/sites/demo/conf/users.yaml +21 -0
- data/sites/demo/elements/demo_common_elements.rb +42 -0
- data/sites/demo/elements/demo_elements.rb +18 -0
- data/sites/demo/elements/demo_registration_elements.rb +27 -0
- data/sites/demo/features/click_links.feature +21 -0
- data/sites/demo/features/register_user.feature +27 -0
- data/sites/demo/features/step_defn/demo.rb +62 -0
- data/sites/demo/flows/home_flows.rb +25 -0
- data/sites/demo/flows/registration_flows.rb +21 -0
- data/sites/demo/results/.placeholder +0 -0
- data/test/features/browser_types.feature +22 -0
- data/test/features/open_browser.feature +20 -0
- data/test/features/resource_size.feature +13 -0
- data/test/features/step_defn/browser.rb +61 -0
- data/test/test_whirlwind.rb +8 -0
- metadata +198 -0
data/lib/whirlwind.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
base = File.expand_path(File.dirname(__FILE__) + '/..')
|
2
|
+
|
3
|
+
require 'RMagick'
|
4
|
+
require 'platform_helpers'
|
5
|
+
require base + '/lib/cucumber'
|
6
|
+
require 'watir-webdriver'
|
7
|
+
require base + '/lib/watir'
|
8
|
+
require base + '/lib/rspec'
|
9
|
+
require 'wait_for'
|
10
|
+
require base + '/lib/cucumber/formatter/html_image'
|
11
|
+
require 'rspec'
|
12
|
+
require 'find'
|
13
|
+
require 'win32screenshot' if RUBY_PLATFORM =~ /win/i
|
14
|
+
|
15
|
+
Before do |i|
|
16
|
+
load_fixtures
|
17
|
+
|
18
|
+
if $browser_type
|
19
|
+
@browser = Watir::Browser.new $browser_type
|
20
|
+
else
|
21
|
+
if @test_data[$site_name].has_key?(:browser)
|
22
|
+
@browser = Watir::Browser.new @test_data[$site_name][:browser][:browser]
|
23
|
+
else
|
24
|
+
raise ArgumentError
|
25
|
+
end
|
26
|
+
end
|
27
|
+
site_requires
|
28
|
+
site_objects
|
29
|
+
end
|
30
|
+
|
31
|
+
After do
|
32
|
+
@browser.close if @browser.kind_of?(Watir::Browser)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
class Whirlwind
|
37
|
+
include RSpec::Core::DSL
|
38
|
+
VERSION = '0.1.0'
|
39
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
:browser: chrome
|
@@ -0,0 +1,22 @@
|
|
1
|
+
---
|
2
|
+
:some_page:
|
3
|
+
:page_element1:
|
4
|
+
:type: text_field
|
5
|
+
:what: "watir's what parameter"
|
6
|
+
:what: "watir's how parameter"
|
7
|
+
:page_element2:
|
8
|
+
:type: text_field
|
9
|
+
:what: "watir's what parameter"
|
10
|
+
:what: "watir's how parameter"
|
11
|
+
:another_page:
|
12
|
+
:page_element1:
|
13
|
+
:type: text_field
|
14
|
+
:what: "watir's what parameter"
|
15
|
+
:what: "watir's how parameter"
|
16
|
+
:page_element2:
|
17
|
+
:type: text_field
|
18
|
+
:what: "watir's what parameter"
|
19
|
+
:what: "watir's how parameter"
|
20
|
+
|
21
|
+
|
22
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
:development:
|
2
|
+
:manager:
|
3
|
+
:user: 'user1'
|
4
|
+
:password: 'user1_password'
|
5
|
+
:employee:
|
6
|
+
:user: 'user2'
|
7
|
+
:password: 'user2_password'
|
8
|
+
:test:
|
9
|
+
:manager:
|
10
|
+
:user: 'user1'
|
11
|
+
:password: 'user1_password'
|
12
|
+
:employee:
|
13
|
+
:user: 'user2'
|
14
|
+
:password: 'user2_password'
|
15
|
+
:production:
|
16
|
+
:manager:
|
17
|
+
:user: 'user1'
|
18
|
+
:password: 'user1_password'
|
19
|
+
:employee:
|
20
|
+
:user: 'user2'
|
21
|
+
:password: 'user2_password'
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Demo
|
2
|
+
module Elements
|
3
|
+
class Tabs
|
4
|
+
include RSpec::Core::DSL
|
5
|
+
def initialize
|
6
|
+
define_me(:base) {@browser.link(:href, '#tab_base')}
|
7
|
+
define_me(:registration) {@browser.link(:href, '#tab_user_reg')}
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
class Dialogs
|
12
|
+
include RSpec::Core::DSL
|
13
|
+
def initialize
|
14
|
+
define_me(:modal_dialog) { @browser.div(:id => 'test_modal_dialog') }
|
15
|
+
define_me(:dialog) { @browser.div(:id => 'test_dialog') }
|
16
|
+
define_me(:close_modal_dialog) { @browser.link(:class => /ui-dialog-titlebar-close/) }
|
17
|
+
define_me(:close_dialog) { @browser.links(:class => /ui-dialog-titlebar-close/).last }
|
18
|
+
define_me(:close_modal_dialog) { @browser.links(:class => /ui-dialog-titlebar-close/).first }
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class Menu
|
23
|
+
include RSpec::Core::DSL
|
24
|
+
def initialize
|
25
|
+
define_me(:full_menu_div) {@browser.div(:id, 'main_menu')}
|
26
|
+
define_me(:actions) { full_menu_div.link(:text, 'Actions') }
|
27
|
+
define_me(:test_alert) {
|
28
|
+
actions.mouseover
|
29
|
+
full_menu_div.link(:text, 'Test Alert')
|
30
|
+
}
|
31
|
+
define_me(:test_dialog) {
|
32
|
+
actions.mouseover
|
33
|
+
full_menu_div.link(:text, 'Test Dialog')
|
34
|
+
}
|
35
|
+
define_me(:test_modal_dialog) {
|
36
|
+
actions.mouseover
|
37
|
+
full_menu_div.link(:text, 'Test Modal Dialog')
|
38
|
+
}
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Demo
|
2
|
+
module Elements
|
3
|
+
class HomePage
|
4
|
+
include RSpec::Core::DSL
|
5
|
+
attr_accessor :tabs, :menu, :dialogs
|
6
|
+
def initialize
|
7
|
+
@tabs = Demo::Elements::Tabs.new
|
8
|
+
@menu = Demo::Elements::Menu.new
|
9
|
+
@dialogs = Demo::Elements::Dialogs.new
|
10
|
+
define_me(:file_status) {@browser.div(:id, 'create_file_status')}
|
11
|
+
define_me(:create_file_text_field) {@browser.text_field(:id, 'create_file_name')}
|
12
|
+
define_me(:submit_create_file) {@browser.button(:id, 'create_file')}
|
13
|
+
define_me(:link_with_id) {@browser.link(:id, 'link_with_id_and_no_name')}
|
14
|
+
define_me(:link_with_name) {@browser.link(:name, 'link_with_no_id_but_has_name')}
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Demo
|
2
|
+
module Elements
|
3
|
+
class RegistrationPage
|
4
|
+
include RSpec::Core::DSL
|
5
|
+
attr_accessor :tabs, :menu, :dialogs
|
6
|
+
def initialize
|
7
|
+
@tabs = Demo::Elements::Tabs.new
|
8
|
+
@menu = Demo::Elements::Menu.new
|
9
|
+
@dialogs = Demo::Elements::Dialogs.new
|
10
|
+
define_me(:email) { @browser.text_field(:id, 'email') }
|
11
|
+
define_me(:email_error) { @browser.div(:id, 'email_error') }
|
12
|
+
define_me(:password) { @browser.text_field(:id, 'password') }
|
13
|
+
define_me(:password_error) { @browser.div(:id, 'password_error') }
|
14
|
+
define_me(:password) { @browser.text_field(:id, 'password') }
|
15
|
+
define_me(:step_1_div) { @browser.div(:id => 'step_1') }
|
16
|
+
define_me(:step_2_div) { @browser.div(:id => 'step_2') }
|
17
|
+
define_me(:step_1_displayed?) { step_1_div.html.grep(/ui-accordion-content-active/).length > 0 }
|
18
|
+
define_me(:step_2_displayed?) { step_2_div.html.grep(/ui-accordion-content-active/).length > 0 }
|
19
|
+
define_me(:step_navigation_div) { @browser.div(:id, 'step_navigation_left') }
|
20
|
+
define_me(:step_1_next) { step_1_div.link(:title => 'Move on to Step 2') }
|
21
|
+
define_me(:step_2_next) { step_2_div.link(:title => 'Move on to Step 3') }
|
22
|
+
define_me(:step_2_prev) { step_2_div.link(:title => 'Go back to Step 1') }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
Feature: Menu links should take an appropriate action
|
2
|
+
from all pages requiring the main menu
|
3
|
+
|
4
|
+
Scenario: Click Home Page Menu Links
|
5
|
+
Given a user navigates to the home page
|
6
|
+
Then the user clicks on the Test Alert link
|
7
|
+
Then the user closes the Test Alert box
|
8
|
+
Then the user clicks on the Test Modal Dialog link
|
9
|
+
Then the user closes the Test Modal Dialog
|
10
|
+
Then the user clicks on the Test Dialog link
|
11
|
+
Then the user closes the Test Dialog
|
12
|
+
|
13
|
+
Scenario: Click Registration Page Menu Links
|
14
|
+
Given a user navigates to the registration page
|
15
|
+
Then the user clicks on the Test Alert link
|
16
|
+
Then the user closes the Test Alert box
|
17
|
+
Then the user clicks on the Test Modal Dialog link
|
18
|
+
Then the user closes the Test Modal Dialog
|
19
|
+
Then the user clicks on the Test Dialog link
|
20
|
+
Then the user closes the Test Dialog
|
21
|
+
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Feature: In order to charge a customer for services
|
2
|
+
the user must be able
|
3
|
+
to complete registration
|
4
|
+
|
5
|
+
Scenario: Invalid Email
|
6
|
+
Given a user navigates to the registration page
|
7
|
+
Then the user enters an invalid entry in the email field
|
8
|
+
Then the user enters blah into the password field
|
9
|
+
And tries to move to step 2
|
10
|
+
# using a instead of an for a common step definition
|
11
|
+
Then a email error is displayed
|
12
|
+
|
13
|
+
Scenario: Invalid Password
|
14
|
+
Given a user navigates to the registration page
|
15
|
+
Then the user enters blah into the email field
|
16
|
+
Then the user enters an invalid entry in the password field
|
17
|
+
And tries to move to step 2
|
18
|
+
Then a password error is displayed
|
19
|
+
|
20
|
+
Scenario: Invalid Email and Password
|
21
|
+
Given a user navigates to the registration page
|
22
|
+
Then the user enters an invalid entry in the email field
|
23
|
+
Then the user enters an invalid entry in the password field
|
24
|
+
And tries to move to step 2
|
25
|
+
Then a email error is displayed
|
26
|
+
Then a password error is displayed
|
27
|
+
|
@@ -0,0 +1,62 @@
|
|
1
|
+
base = File.expand_path(File.dirname(__FILE__) + '/../../../..')
|
2
|
+
require base + '/lib/whirlwind'
|
3
|
+
|
4
|
+
Given /a user navigates to the (.+) page/ do |page|
|
5
|
+
@demo_homepage.send(page)
|
6
|
+
end
|
7
|
+
|
8
|
+
Then /menu items should exists/ do
|
9
|
+
@demo_homepage.elements.menu.actions.exists?.should == true
|
10
|
+
@demo_homepage.elements.menu.test_alert.exists?.should == true
|
11
|
+
@demo_homepage.elements.menu.test_modal_dialog.exists?.should == true
|
12
|
+
@demo_homepage.elements.menu.test_dialog.exists?.should == true
|
13
|
+
end
|
14
|
+
|
15
|
+
Then /the user clicks on the Test Alert link/ do
|
16
|
+
@demo_homepage.elements.menu.test_alert.click
|
17
|
+
wait_for(2) { @browser.alert_box.text == 'QA Robusta Test Alert' }
|
18
|
+
screen_shot('Test Alert menu item clicked')
|
19
|
+
@browser.alert_box.text.should == 'QA Robusta Test Alert'
|
20
|
+
end
|
21
|
+
|
22
|
+
Then /the user closes the Test Alert box/ do
|
23
|
+
@browser.alert_box.dismiss
|
24
|
+
end
|
25
|
+
|
26
|
+
Then /the user clicks on the Test Modal Dialog link/ do
|
27
|
+
@demo_homepage.elements.menu.test_modal_dialog.click
|
28
|
+
wait_for(2) { @demo_homepage.elements.dialogs.modal_dialog.text == 'Test some modal dialog actions' }
|
29
|
+
screen_shot('Test Modal Dialog menu item clicked')
|
30
|
+
@demo_homepage.elements.dialogs.modal_dialog.text.should == 'Test some modal dialog actions'
|
31
|
+
end
|
32
|
+
|
33
|
+
Then /the user clicks on the Test Dialog link/ do
|
34
|
+
@demo_homepage.elements.menu.test_dialog.click
|
35
|
+
wait_for(2) { @demo_homepage.elements.dialogs.dialog.text == 'Test some dialog actions' }
|
36
|
+
screen_shot('Test Dialog menu item clicked')
|
37
|
+
@demo_homepage.elements.dialogs.dialog.text.should == 'Test some dialog actions'
|
38
|
+
end
|
39
|
+
|
40
|
+
Then /the user closes the Test Dialog/ do
|
41
|
+
@demo_homepage.elements.dialogs.close_dialog.click
|
42
|
+
end
|
43
|
+
|
44
|
+
Then /the user closes the Test Modal Dialog/ do
|
45
|
+
@demo_homepage.elements.dialogs.close_modal_dialog.click
|
46
|
+
end
|
47
|
+
|
48
|
+
Then /the user enters (.+) into the (.+) field/ do |val, field|
|
49
|
+
@demo_registrationpage.elements.send(field).set(val)
|
50
|
+
end
|
51
|
+
|
52
|
+
Then /the user enters an invalid entry in the (.+) field/ do |field|
|
53
|
+
end
|
54
|
+
|
55
|
+
Then /tries to move to step (\d+)/ do |step_n|
|
56
|
+
@demo_registrationpage.elements.send("step_#{step_n.to_i-1}_next").click
|
57
|
+
end
|
58
|
+
|
59
|
+
Then /a (.+) error is displayed/ do |field|
|
60
|
+
@demo_registrationpage.elements.send("#{field}_error").text.should == 'Enter a value'
|
61
|
+
screen_shot("#{field} error")
|
62
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Demo
|
2
|
+
class HomePage
|
3
|
+
include RSpec::Core::DSL
|
4
|
+
attr_reader :elements
|
5
|
+
def initialize
|
6
|
+
@elements = Demo::Elements::HomePage.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def home
|
10
|
+
@browser.goto(@test_data['demo'][:base_urls][$environment][:demo_home])
|
11
|
+
@elements.tabs.registration.wait_until_present
|
12
|
+
screen_shot('Landed on Home Page')
|
13
|
+
end
|
14
|
+
|
15
|
+
def registration
|
16
|
+
home
|
17
|
+
@elements.tabs.registration.wait_until_present
|
18
|
+
@elements.tabs.registration.click
|
19
|
+
@demo_registrationpage.elements.step_1_next.wait_until_present
|
20
|
+
screen_shot('Landed on Registration Page')
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Demo
|
2
|
+
class RegistrationPage
|
3
|
+
include RSpec::Core::DSL
|
4
|
+
attr_reader :elements
|
5
|
+
def initialize
|
6
|
+
@elements = Demo::Elements::RegistrationPage.new
|
7
|
+
end
|
8
|
+
|
9
|
+
def step_1(params={})
|
10
|
+
params[:submit] ||= 'true'
|
11
|
+
params[:submit] = params[:submit].to_bool
|
12
|
+
params[:email] ||= ''
|
13
|
+
params[:password] ||= ''
|
14
|
+
@elements.email.set(params[:email]) if params[:email] != ''
|
15
|
+
@elements.password.set(params[:password]) if params[:password] != ''
|
16
|
+
@elements.step_1_next.click if params[:submit]
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
File without changes
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Feature: Supported Browsers
|
2
|
+
In order to release supported browsers are allowed
|
3
|
+
@skip
|
4
|
+
Scenario Outline: Is Supported
|
5
|
+
Given a supported browser <supported_browsers>
|
6
|
+
Then the browser is allowed
|
7
|
+
|
8
|
+
Examples:
|
9
|
+
| supported_browsers |
|
10
|
+
| firefox |
|
11
|
+
| ff |
|
12
|
+
| chrome |
|
13
|
+
| ie |
|
14
|
+
|
15
|
+
@run
|
16
|
+
Scenario Outline: Is Not Supported
|
17
|
+
Given an unsupported browser <unsupported_browsers>
|
18
|
+
Then the browser is not allowed
|
19
|
+
|
20
|
+
Examples:
|
21
|
+
| unsupported_browsers |
|
22
|
+
| opera |
|
@@ -0,0 +1,20 @@
|
|
1
|
+
Feature: Open Browser
|
2
|
+
In order to test a web application one needs to open a browser
|
3
|
+
# Scenario: No block provided
|
4
|
+
# Given I have not provided a block to the browser
|
5
|
+
# Then the result should be a browser is not opened
|
6
|
+
|
7
|
+
Scenario Outline: Block provided
|
8
|
+
Given I have provided a block to the site with <browser_type>
|
9
|
+
Then the result should be the browser instances it returned and available inside of the block
|
10
|
+
Scenario Outline: No Block provided
|
11
|
+
Given I have not provided a block to the site with <browser_type>
|
12
|
+
Then the result should be the browser instances it returned as a variable
|
13
|
+
|
14
|
+
|
15
|
+
Examples:
|
16
|
+
|browser_type|
|
17
|
+
|chrome|
|
18
|
+
|ff|
|
19
|
+
|firefox|
|
20
|
+
|
@@ -0,0 +1,13 @@
|
|
1
|
+
Feature: Download elements from source html
|
2
|
+
In order to release all images, external javascript and
|
3
|
+
css files must download and be the correct size
|
4
|
+
|
5
|
+
Scenario Outline: Download
|
6
|
+
Given a user has landed on a <page>
|
7
|
+
Then all resource elements should download with the correct size
|
8
|
+
|
9
|
+
Examples:
|
10
|
+
|page |
|
11
|
+
|http://slashdot.org |
|
12
|
+
|http://yahoo.com |
|
13
|
+
|http://github.com |
|
@@ -0,0 +1,61 @@
|
|
1
|
+
base = File.expand_path(File.dirname(__FILE__) + '/../../..')
|
2
|
+
require base + '/lib/whirlwind'
|
3
|
+
require base + '/elements/demo_elements'
|
4
|
+
|
5
|
+
|
6
|
+
Before do
|
7
|
+
@__cucumber_step_mother.delete_images
|
8
|
+
@b = nil
|
9
|
+
end
|
10
|
+
|
11
|
+
After do
|
12
|
+
puts "BLAH: #{@blah}"
|
13
|
+
@b.close if @b.kind_of?(Watir::Browser)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
Given /a supported browser (.+)/ do |browser|
|
18
|
+
@b = browser
|
19
|
+
end
|
20
|
+
Then /the browser is allowed/ do
|
21
|
+
screen_shot
|
22
|
+
Constants::ALLOWED_BROWSERS.should include(@b.to_sym)
|
23
|
+
end
|
24
|
+
|
25
|
+
Given /an unsupported browser (.+)/ do |browser|
|
26
|
+
screen_shot
|
27
|
+
screen_shot
|
28
|
+
#require 'ruby-debug';debugger
|
29
|
+
@b = browser
|
30
|
+
end
|
31
|
+
Then /the browser is not allowed/ do
|
32
|
+
Constants::ALLOWED_BROWSERS.should_not include(@b)
|
33
|
+
end
|
34
|
+
|
35
|
+
|
36
|
+
Given /a user has landed on a (.+)/ do |url|
|
37
|
+
@element_info = HTTP::Validator.run(url)
|
38
|
+
end
|
39
|
+
|
40
|
+
Then /all resource elements should download with the correct size/ do
|
41
|
+
@element_info.each_pair { |resource, values|
|
42
|
+
values.each { |item|
|
43
|
+
puts "Verifying #{resource} downloaded size #{item[:actual_size]} matches Content-Length #{item[:expected_size]}\n"
|
44
|
+
item[:actual_size].should equal item[:expected_size]
|
45
|
+
}
|
46
|
+
}
|
47
|
+
end
|
48
|
+
|
49
|
+
Given /I have provided a block to the site with (.+)/ do |browser|
|
50
|
+
Site.browser(:browser => browser) { |b| @b = b }
|
51
|
+
end
|
52
|
+
Then /the result should be the browser instances it returned and available inside of the block/ do
|
53
|
+
@b.should be_a_kind_of(Watir::Browser)
|
54
|
+
end
|
55
|
+
|
56
|
+
Given /I have not provided a block to the site with (.+)/ do |browser|
|
57
|
+
@b = Site.browser(:browser => browser)
|
58
|
+
end
|
59
|
+
Then /the result should be the browser instances it returned as a variable/ do
|
60
|
+
@b.should be_a_kind_of(Watir::Browser)
|
61
|
+
end
|