| 225 | | # Opens the given page, and runs various common asserts for it. |
|---|
| 226 | | # |
|---|
| 227 | | # Should be used instead of regular open(). |
|---|
| 228 | | def selenium_open(options) |
|---|
| 229 | | open options |
|---|
| 230 | | |
|---|
| 231 | | assert_text_not_present 'esman' |
|---|
| 232 | | assert_text_not_present 'Esman' |
|---|
| 233 | | assert_text_not_present 'ESMAN' |
|---|
| 234 | | |
|---|
| 235 | | assert_text_present 'NorfelloCMMS Copyright © 2006 Norfello' |
|---|
| 236 | | end |
|---|
| 237 | | |
|---|
| 238 | | # Logs the user in. |
|---|
| 239 | | # |
|---|
| 240 | | # If no parameters are given, moves to the login page and logs in as admin. |
|---|
| 241 | | def selenium_login(move_to_login_page = true, username = 'admin', password = 'god') |
|---|
| 242 | | open :controller => 'main', :action => 'login' if move_to_login_page |
|---|
| 243 | | pause 0.2 |
|---|
| 244 | | |
|---|
| 245 | | type 'user_login', username |
|---|
| 246 | | type 'user_password', password |
|---|
| 247 | | click_and_wait 'login' |
|---|
| 248 | | end |
|---|
| 249 | | |
|---|
| 250 | | # Checks that the given link points to the given controller/action |
|---|
| 251 | | # Arguments: |
|---|
| 252 | | # +link+: The link element in Selenium's syntax. |
|---|
| 253 | | def assert_link_reference(link_element, options) |
|---|
| 254 | | assert_attribute "#{link_element}@href", url_for(options) |
|---|
| 255 | | end |
|---|
| 256 | | |
|---|