qa_robusta 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +4 -0
- data/Manifest.txt +41 -4
- data/common/lib/gems/.svn/entries +1 -1
- data/common/lib/gems/cache/.svn/entries +1 -1
- data/common/lib/gems/doc/.svn/entries +1 -1
- data/common/lib/gems/gems/.svn/entries +1 -1
- data/common/lib/gems/installed/.svn/entries +1 -1
- data/common/lib/gems/installed/cache/.svn/entries +1 -1
- data/common/lib/gems/installed/doc/.svn/entries +1 -1
- data/common/lib/gems/installed/gems/.svn/entries +1 -1
- data/common/lib/gems/installed/specifications/.svn/entries +1 -1
- data/common/lib/gems/specifications/.svn/entries +1 -1
- data/demo/public/images/arrow_left_48.png +0 -0
- data/demo/public/images/arrow_right_48.png +0 -0
- data/demo/public/images/down.gif +0 -0
- data/demo/public/images/header.jpg +0 -0
- data/demo/public/images/menu.gif +0 -0
- data/demo/public/images/menuhover.gif +0 -0
- data/demo/public/javascripts/browser.menu.js +61 -0
- data/demo/public/javascripts/cyberconnect_helpers.js +369 -0
- data/demo/public/javascripts/jquery-1.5.1.min.js +16 -0
- data/demo/public/javascripts/jquery-ui-1.8.10.custom.min.js +1370 -0
- data/demo/public/javascripts/jquery.layout.min-1.2.0.js +80 -0
- data/demo/public/javascripts/jqueryslidemenu.css +93 -0
- data/demo/public/javascripts/jqueryslidemenu.js +48 -0
- data/demo/public/javascripts/ui.accordion.js +477 -0
- data/demo/public/jquery.ui.all.css +11 -0
- data/demo/public/jquery.ui.base.css +11 -0
- data/demo/public/jquery.ui.theme.css +252 -0
- data/demo/public/jquery_css/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/demo/public/jquery_css/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/demo/public/jquery_css/images/ui-icons_222222_256x240.png +0 -0
- data/demo/public/jquery_css/images/ui-icons_2e83ff_256x240.png +0 -0
- data/demo/public/jquery_css/images/ui-icons_454545_256x240.png +0 -0
- data/demo/public/jquery_css/images/ui-icons_888888_256x240.png +0 -0
- data/demo/public/jquery_css/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/demo/public/jquery_css/jquery-ui-1.8.10.custom.css +573 -0
- data/demo/public/jquery_layout.css +14 -0
- data/demo/public/jqueryslidemenu.css +93 -0
- data/demo/public/menu.css +12 -0
- data/demo/public/style.css +193 -1
- data/demo/views/index.erb +263 -9
- data/lib/qa_robusta.rb +1 -1
- data/qa_observer/lib/doc.rb +8 -4
- data/qa_observer/lib/form_helpers.rb +1 -1
- data/qa_observer/lib/watir.rb +41 -41
- data/qa_observer/sites/demo/elements/demo_elements.rb +50 -1
- data/qa_observer/sites/demo/flows/demo_flows.rb +32 -7
- data/qa_observer/sites/demo/test_cases/home_page.rb +34 -17
- data/qa_observer/sites/demo/test_cases/test_element_scroll_to.rb +9 -9
- data/qa_observer/sites/demo/test_cases/test_menu.rb +59 -0
- data/qa_observer/sites/demo/test_cases/test_registration.rb +140 -0
- data/qa_observer/suites/demo_release_decision/release.yaml +23 -0
- data/qa_observer/suites/init.rb +45 -2
- data/qa_observer/test_runner.rb +3 -5
- metadata +45 -9
- data/test/test_qa_robusta.rb +0 -8
data/lib/qa_robusta.rb
CHANGED
data/qa_observer/lib/doc.rb
CHANGED
@@ -20,14 +20,18 @@ module TCDoc
|
|
20
20
|
}
|
21
21
|
}
|
22
22
|
html += "</body></html>"
|
23
|
-
|
24
|
-
|
25
|
-
|
23
|
+
begin
|
24
|
+
fd = File.open(save_to, 'w+')
|
25
|
+
fd.puts html
|
26
|
+
fd.close
|
27
|
+
rescue => e
|
28
|
+
end
|
26
29
|
end
|
27
30
|
|
28
31
|
def self.class_names_from_file(file_content)
|
29
32
|
class_names = file_content.grep(/class .* <.*SystemTest/)
|
30
33
|
class_names.each_with_index { |name, ct|
|
34
|
+
|
31
35
|
class_names[ct] = name.gsub!(/\n|class| |<|SystemTest/, '')
|
32
36
|
}
|
33
37
|
class_names
|
@@ -61,7 +65,7 @@ module TCDoc
|
|
61
65
|
}
|
62
66
|
|
63
67
|
html=''
|
64
|
-
`#{$test_case_dir}/../../../../common/gems/installed/
|
68
|
+
`#{$test_case_dir}/../../../../common/gems/installed/bin/rdoc -o #{rdoc_dir} #{execution_file}`
|
65
69
|
current_test_class.gsub!(/\r/, '')
|
66
70
|
rdoc_content = File.read("#{rdoc_dir}/#{current_test_class}.html")
|
67
71
|
doc=Hpricot(rdoc_content)
|
data/qa_observer/lib/watir.rb
CHANGED
@@ -1,8 +1,23 @@
|
|
1
|
-
module
|
1
|
+
module WatirBrowserExtention
|
2
|
+
def self.included(klass)
|
3
|
+
add_alert_box(klass)
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.add_alert_box(klass)
|
7
|
+
klass.class_eval {
|
8
|
+
define_method('alert_box') { |*args, &block|
|
9
|
+
driver.switch_to.alert
|
10
|
+
}
|
11
|
+
}
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module WatirElementExtention
|
2
16
|
def self.included(klass)
|
3
17
|
image_wrap(klass)
|
4
18
|
add_scroll_to(klass)
|
5
19
|
add_in_viewable_area?(klass)
|
20
|
+
add_mouseover(klass)
|
6
21
|
end
|
7
22
|
|
8
23
|
def self.image_wrap(klass)
|
@@ -30,25 +45,18 @@ module WatirExtention
|
|
30
45
|
var w = 0;
|
31
46
|
var h = 0;
|
32
47
|
if(!window.innerWidth) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
} else {
|
41
|
-
w = window.pageXOffset;
|
42
|
-
h = window.pageYOffset;
|
43
|
-
// w = document.body.clientWidth + window.pageXOffset;
|
44
|
-
// h = document.body.clientHeight + window.pageYOffset;
|
45
|
-
}
|
46
|
-
*/
|
47
|
-
} else { w = window.pageXOffset; h = window.pageYOffset; }
|
48
|
-
return {x: h, y: w}
|
48
|
+
x = document.documentElement.clientWidth + document.body.scrollLeft;
|
49
|
+
y = document.documentElement.clientHeight + document.body.scrollTop;
|
50
|
+
} else {
|
51
|
+
x = window.pageXOffset + window.innerWidth;
|
52
|
+
y = window.pageYOffset + window.innerHeight;
|
53
|
+
}
|
54
|
+
return {x: x, y: y}
|
49
55
|
EOF
|
56
|
+
|
50
57
|
d = driver.execute_script(script)
|
51
|
-
element_location.x
|
58
|
+
element_location.x <= d['x'] && element_location.y <= d['y']
|
59
|
+
|
52
60
|
else
|
53
61
|
return false
|
54
62
|
end
|
@@ -59,30 +67,20 @@ module WatirExtention
|
|
59
67
|
def self.add_scroll_to(klass)
|
60
68
|
klass.class_eval {
|
61
69
|
define_method('scroll_to') { |*args, &block|
|
62
|
-
|
63
|
-
if self.id == '' && self.name != ''
|
64
|
-
element = "element = document.getElementsByName(\"#{self.name}\")[0];"
|
65
|
-
elsif self.id != '' && self.name == ''
|
66
|
-
element = "element = document.getElementById(\"#{self.id}\");"
|
67
|
-
end
|
68
|
-
|
69
|
-
if element
|
70
|
-
# javascript borrowed from:
|
71
|
-
# http://radio.javaranch.com/pascarello/2005/01/09/1105293729000.html
|
72
|
-
script=<<-EOF
|
73
|
-
function ScrollToElementByID(id){
|
74
|
-
#{element} var selectedPosX = 0; var selectedPosY = 0;
|
75
|
-
while(element != null) { selectedPosX += element.offsetLeft; selectedPosY += element.offsetTop; element = element.offsetParent; }
|
76
|
-
window.scrollTo(selectedPosX,selectedPosY);
|
77
|
-
}
|
78
|
-
ScrollToElementByID("#{self.id}");
|
79
|
-
EOF
|
80
|
-
driver.execute_script(script)
|
81
|
-
end
|
70
|
+
wd.location_once_scrolled_into_view
|
82
71
|
}
|
83
72
|
}
|
84
73
|
|
85
74
|
end
|
75
|
+
|
76
|
+
def self.add_mouseover(klass)
|
77
|
+
klass.class_eval {
|
78
|
+
define_method('mouseover') { |*args, &block|
|
79
|
+
driver.mouse.move_to(wd)
|
80
|
+
}
|
81
|
+
}
|
82
|
+
end
|
83
|
+
|
86
84
|
end
|
87
85
|
|
88
86
|
module Watir
|
@@ -90,8 +88,7 @@ module Watir
|
|
90
88
|
def self.shot
|
91
89
|
if RUBY_PLATFORM =~ /win/i
|
92
90
|
width, height, bitmap = Win32::Screenshot.desktop
|
93
|
-
|
94
|
-
img_lst.from_blob(bitmap)
|
91
|
+
Magick::ImageList.new.from_blob(bitmap)
|
95
92
|
else
|
96
93
|
Magick::Image.capture(silent=true, frame=false, descent=false,
|
97
94
|
screen=true, borders=false) { self.filename = 'root' }
|
@@ -99,7 +96,10 @@ module Watir
|
|
99
96
|
end
|
100
97
|
end
|
101
98
|
class Element
|
102
|
-
include
|
99
|
+
include WatirElementExtention
|
100
|
+
end
|
101
|
+
class Browser
|
102
|
+
include WatirBrowserExtention
|
103
103
|
end
|
104
104
|
end
|
105
105
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
module Demo
|
2
|
-
class
|
2
|
+
class HomeElements < SystemTest
|
3
3
|
def initialize
|
4
4
|
element(:file_status) {$browser.div(:id, 'create_file_status')}
|
5
5
|
element(:create_file_text_field) {$browser.text_field(:id, 'create_file_name')}
|
@@ -8,4 +8,53 @@ module Demo
|
|
8
8
|
element(:link_with_name) {$browser.link(:name, 'link_with_no_id_but_has_name')}
|
9
9
|
end
|
10
10
|
end
|
11
|
+
|
12
|
+
class RegisterElements < SystemTest
|
13
|
+
def initialize
|
14
|
+
element(:email) { $browser.text_field(:id, 'email') }
|
15
|
+
element(:email_error) { $browser.div(:id, 'email_error') }
|
16
|
+
element(:password) { $browser.text_field(:id, 'password') }
|
17
|
+
element(:password_error) { $browser.div(:id, 'password_error') }
|
18
|
+
element(:password) { $browser.text_field(:id, 'password') }
|
19
|
+
element(:step_1_div) { $browser.div(:id => 'step_1') }
|
20
|
+
element(:step_2_div) { $browser.div(:id => 'step_2') }
|
21
|
+
element(:step_1_displayed?) { step_1_div.html.grep(/ui-accordion-content-active/).length > 0 }
|
22
|
+
element(:step_2_displayed?) { step_2_div.html.grep(/ui-accordion-content-active/).length > 0 }
|
23
|
+
element(:step_navigation_div) { $browser.div(:id, 'step_navigation_left') }
|
24
|
+
element(:step_1_next) { step_1_div.link(:title => 'Move on to Step 2') }
|
25
|
+
element(:step_2_next) { step_2_div.link(:title => 'Move on to Step 3') }
|
26
|
+
element(:step_2_prev) { step_2_div.link(:title => 'Go back to Step 1') }
|
27
|
+
|
28
|
+
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class TabElements < SystemTest
|
33
|
+
def initialize
|
34
|
+
element(:base) {$browser.link(:href, '#tab_base')}
|
35
|
+
element(:registration) {$browser.link(:href, '#tab_user_reg')}
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class MenuElements < SystemTest
|
40
|
+
def initialize
|
41
|
+
element(:full_menu_div) {$browser.div(:id, 'main_menu')}
|
42
|
+
element(:actions_menu_item) { full_menu_div.link(:text, 'Actions') }
|
43
|
+
element(:test_alert_menu_item) {
|
44
|
+
actions_menu_item.mouseover
|
45
|
+
full_menu_div.link(:text, 'Test Alert')
|
46
|
+
}
|
47
|
+
element(:test_modal_dialog_menu_item) {
|
48
|
+
actions_menu_item.mouseover
|
49
|
+
full_menu_div.link(:text, 'Test Modal Dialog')
|
50
|
+
}
|
51
|
+
|
52
|
+
element(:test_dialog_menu_item) {
|
53
|
+
actions_menu_item.mouseover
|
54
|
+
full_menu_div.link(:text, 'Test Dialog')
|
55
|
+
}
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
11
60
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
base = File.expand_path(File.dirname(__FILE__))
|
2
2
|
require "#{$qa_observer_client}/lib/system_test"
|
3
3
|
|
4
|
-
class
|
4
|
+
class SiteFlows < SystemTest
|
5
5
|
# provide a means for the flow instance to access the elements.
|
6
6
|
# this is handy from the test case perspective as it will have
|
7
7
|
# access to the flow's but not the elements directly
|
8
|
-
attr_reader :
|
8
|
+
attr_reader :home_page_elements, :register_flows, :menu_elements, :tab_elements
|
9
9
|
def initialize
|
10
10
|
# NOTE: Define an instance of an element page
|
11
11
|
# in order for flow methods to be able to access
|
@@ -15,7 +15,10 @@ class DemoFlows < SystemTest
|
|
15
15
|
# instance defined in a test class can access the element
|
16
16
|
# objects without the need to re-instantiate from the test
|
17
17
|
|
18
|
-
@
|
18
|
+
@home_page_elements = Demo::HomeElements.new
|
19
|
+
@register_flows = RegisterFlows.new
|
20
|
+
@tab_elements = Demo::TabElements.new
|
21
|
+
@menu_elements = Demo::MenuElements.new
|
19
22
|
end
|
20
23
|
|
21
24
|
=begin
|
@@ -24,14 +27,36 @@ class DemoFlows < SystemTest
|
|
24
27
|
=end
|
25
28
|
def home
|
26
29
|
$browser.goto($test_data[:base_urls][$test_environment][:demo_home])
|
27
|
-
|
30
|
+
@home_page_elements.submit_create_file.wait_until_present
|
28
31
|
end
|
29
32
|
|
30
33
|
def create_file(file_name='')
|
31
34
|
home
|
32
|
-
@
|
33
|
-
@
|
34
|
-
wait_for(2) { @
|
35
|
+
@home_page_elements.create_file_text_field.set(file_name)
|
36
|
+
@home_page_elements.submit_create_file.click
|
37
|
+
wait_for(2) { @home_page_elements.file_status.text != '' }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
class RegisterFlows < SiteFlows
|
43
|
+
attr_reader :register_elements, :tab_elements
|
44
|
+
def initialize
|
45
|
+
@register_elements = Demo::RegisterElements.new
|
46
|
+
@tab_elements = Demo::TabElements.new
|
47
|
+
end
|
48
|
+
def home
|
49
|
+
$browser.goto($test_data[:base_urls][$test_environment][:demo_home])
|
50
|
+
@tab_elements.registration.click
|
51
|
+
end
|
52
|
+
def step_1(params={})
|
53
|
+
params[:submit] ||= 'true'
|
54
|
+
params[:submit] = params[:submit].to_bool
|
55
|
+
params[:email] ||= ''
|
56
|
+
params[:password] ||= ''
|
57
|
+
@register_elements.email.set(params[:email]) if params[:email] != ''
|
58
|
+
@register_elements.password.set(params[:password]) if params[:password] != ''
|
59
|
+
@register_elements.step_1_next.click if params[:submit]
|
35
60
|
end
|
36
61
|
end
|
37
62
|
|
@@ -20,11 +20,8 @@ class HomePage < SystemTest
|
|
20
20
|
# parameter to the interpreter default to :test
|
21
21
|
$test_environment ||= :test
|
22
22
|
super
|
23
|
-
@remote_unix = RemoteUnix::GeneralUnix.new(:host => $test_data[:remote_machine][$test_environment][:ssh_ip],
|
24
|
-
:user => $test_data[:remote_machine][$test_environment][:ssh_user],
|
25
|
-
:password => $test_data[:remote_machine][$test_environment][:ssh_password])
|
26
23
|
|
27
|
-
@
|
24
|
+
@browse_site = SiteFlows.new
|
28
25
|
end
|
29
26
|
|
30
27
|
def teardown
|
@@ -54,13 +51,13 @@ class HomePage < SystemTest
|
|
54
51
|
Verify the user can enter a value in the create_file_name text field
|
55
52
|
=end
|
56
53
|
def test_home_elements
|
57
|
-
@
|
54
|
+
@browse_site.home
|
58
55
|
assert_equal $test_data[:base_urls][$test_environment][:demo_home].gsub(/\/$/, ''), $browser.url.gsub(/\/$/, '')
|
59
|
-
assert @
|
60
|
-
assert @
|
61
|
-
assert @
|
62
|
-
@
|
63
|
-
assert_equal 'blah', @
|
56
|
+
assert @browse_site.home_page_elements.file_status.exists?
|
57
|
+
assert @browse_site.home_page_elements.create_file_text_field.exists?
|
58
|
+
assert @browse_site.home_page_elements.submit_create_file.exists?
|
59
|
+
@browse_site.home_page_elements.create_file_text_field.set('blah')
|
60
|
+
assert_equal 'blah', @browse_site.home_page_elements.create_file_text_field.value
|
64
61
|
end
|
65
62
|
|
66
63
|
=begin rdoc
|
@@ -75,9 +72,19 @@ class HomePage < SystemTest
|
|
75
72
|
* Login to the remote machine and verify that the file exists
|
76
73
|
=end
|
77
74
|
def test_file_created
|
78
|
-
|
79
|
-
|
80
|
-
|
75
|
+
# if more than one test requires such a remote unix interface it's a best
|
76
|
+
# practice to put this in the setup method and make it an instance var.
|
77
|
+
# But putting this in the single method so that if users not running an ssh server
|
78
|
+
# want to execute other test cases they can specify all test but test_file_create
|
79
|
+
# for the test runner or in a test suite.
|
80
|
+
remote_unix = RemoteUnix::GeneralUnix.new(:host => $test_data[:remote_machine][$test_environment][:ssh_ip],
|
81
|
+
:user => $test_data[:remote_machine][$test_environment][:ssh_user],
|
82
|
+
:password => $test_data[:remote_machine][$test_environment][:ssh_password])
|
83
|
+
|
84
|
+
|
85
|
+
@browse_site.create_file('blah')
|
86
|
+
assert_equal 'file created', @browse_site.home_page_elements.file_status.text
|
87
|
+
assert remote_unix.file_exists?('/tmp/blah')
|
81
88
|
end
|
82
89
|
|
83
90
|
=begin rdoc
|
@@ -93,10 +100,20 @@ class HomePage < SystemTest
|
|
93
100
|
created
|
94
101
|
=end
|
95
102
|
def test_error_message_with_no_file_name
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
103
|
+
|
104
|
+
# if more than one test requires such a remote unix interface it's a best
|
105
|
+
# practice to put this in the setup method and make it an instance var.
|
106
|
+
# But putting this in the single method so that if users not running an ssh server
|
107
|
+
# want to execute other test cases they can specify all test but test_file_create
|
108
|
+
# for the test runner or in a test suite.
|
109
|
+
remote_unix = RemoteUnix::GeneralUnix.new(:host => $test_data[:remote_machine][$test_environment][:ssh_ip],
|
110
|
+
:user => $test_data[:remote_machine][$test_environment][:ssh_user],
|
111
|
+
:password => $test_data[:remote_machine][$test_environment][:ssh_password])
|
112
|
+
|
113
|
+
remote_tmp_files_pre = remote_unix.ls('/tmp')
|
114
|
+
@browse_site.create_file
|
115
|
+
assert_equal 'Please provide a file name', @browse_site.home_page_elements.file_status.text
|
116
|
+
remote_tmp_files_post = remote_unix.ls('/tmp')
|
100
117
|
assert_equal remote_tmp_files_pre, remote_tmp_files_post
|
101
118
|
end
|
102
119
|
|
@@ -20,8 +20,8 @@ class TestElementScrollTo < SystemTest
|
|
20
20
|
# parameter to the interpreter default to :test
|
21
21
|
$test_environment ||= :test
|
22
22
|
super
|
23
|
-
@
|
24
|
-
@
|
23
|
+
@browse_site = SiteFlows.new
|
24
|
+
@browse_site.home
|
25
25
|
end
|
26
26
|
|
27
27
|
def teardown
|
@@ -45,10 +45,10 @@ class TestElementScrollTo < SystemTest
|
|
45
45
|
3. Verify that the element is now in the viewable area of the browser
|
46
46
|
=end
|
47
47
|
def test_scroll_to_element_with_no_id_but_with_name
|
48
|
-
assert !@
|
49
|
-
@
|
50
|
-
assert @
|
51
|
-
TestExtention.screen_shot($current_test_method, '
|
48
|
+
assert !@browse_site.home_page_elements.link_with_name.in_viewable_area?
|
49
|
+
@browse_site.home_page_elements.link_with_name.scroll_to
|
50
|
+
assert @browse_site.home_page_elements.link_with_name.in_viewable_area?
|
51
|
+
TestExtention.screen_shot($current_test_method, 'some_tag_name')
|
52
52
|
end
|
53
53
|
|
54
54
|
=begin rdoc
|
@@ -60,9 +60,9 @@ class TestElementScrollTo < SystemTest
|
|
60
60
|
3. Verify that the element is now in the viewable area of the browser
|
61
61
|
=end
|
62
62
|
def test_scroll_to_element_with_id_but_no_name
|
63
|
-
assert !@
|
64
|
-
@
|
65
|
-
assert @
|
63
|
+
assert !@browse_site.home_page_elements.link_with_id.in_viewable_area?
|
64
|
+
@browse_site.home_page_elements.link_with_id.scroll_to
|
65
|
+
assert @browse_site.home_page_elements.link_with_id.in_viewable_area?
|
66
66
|
TestExtention.screen_shot($current_test_method, 'pre')
|
67
67
|
end
|
68
68
|
|
@@ -0,0 +1,59 @@
|
|
1
|
+
base = File.expand_path(File.dirname(__FILE__))
|
2
|
+
|
3
|
+
# If the user is executing the test case stand alone
|
4
|
+
# without an agent we need to set a reference to
|
5
|
+
# for where to find the qa_observer_client as well as let
|
6
|
+
# the qa_observer_client know where the test case directory is
|
7
|
+
# URGENT: DO NOT MODIFY
|
8
|
+
unless $qa_observer_client
|
9
|
+
TEST_CASE_DIR = "#{base}"
|
10
|
+
$qa_observer_client = File.expand_path("#{base}/../../..")
|
11
|
+
end
|
12
|
+
# END OF DO NOT MODIFY
|
13
|
+
|
14
|
+
require "#{$qa_observer_client}/lib/system_test"
|
15
|
+
require "#{$qa_observer_client}/lib/env_details.rb"
|
16
|
+
|
17
|
+
class TestMenu < SystemTest
|
18
|
+
def setup
|
19
|
+
# if the user hasn't provided the environment as an input
|
20
|
+
# parameter to the interpreter default to :test
|
21
|
+
$test_environment ||= :test
|
22
|
+
super
|
23
|
+
@browse_site = SiteFlows.new
|
24
|
+
@browse_site.home
|
25
|
+
|
26
|
+
end
|
27
|
+
|
28
|
+
def teardown
|
29
|
+
# NOTE: Place all items you wish to do at after each test method
|
30
|
+
# in the unless @skip section before the $browser.close. DO NOT
|
31
|
+
# remove this section as it's critical if the test class is executed
|
32
|
+
# by an agent.
|
33
|
+
unless @skip
|
34
|
+
$browser.close if $browser
|
35
|
+
end
|
36
|
+
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
=begin rdoc
|
41
|
+
Test Purpose: Verify the Watir::Element#mouseover and Watir::Browser#alert_box
|
42
|
+
extensions
|
43
|
+
|
44
|
+
Steps:
|
45
|
+
1. <b>Navigate</b> to the demo site's home page
|
46
|
+
2. <b>Mouse over</b> the <i>Actions</i> menu item
|
47
|
+
3. <b>Click</b> the menu item with text <i>Test Alert</i>
|
48
|
+
4. <b>Verify</b> an alert box is displayed with text <i>QA Robusta Test Alert</i>
|
49
|
+
If we see the alert box text the mouseover functioned properly, as
|
50
|
+
selenium-webdriver will not be able to locate menu item <i>Test Alert</i> unless
|
51
|
+
the menu is expanded via a mouseover.
|
52
|
+
=end
|
53
|
+
def test_menu_item_alert
|
54
|
+
@browse_site.menu_elements.test_alert_menu_item.click
|
55
|
+
assert_equal 'QA Robusta Test Alert', $browser.alert_box.text
|
56
|
+
$browser.alert_box.dismiss
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|