Skip to content

Instantly share code, notes, and snippets.

@JonKernPA
Created March 18, 2012 16:56
Show Gist options
  • Save JonKernPA/2077500 to your computer and use it in GitHub Desktop.
Save JonKernPA/2077500 to your computer and use it in GitHub Desktop.
Cucumber UI Smoke Tests
Feature: Quickly exercise the primary ADMIN UIs just to make sure nothing blows up
Background: We need to pre-populate the database with the simulator results, and be logged in as admin
Given I login as "admin"
And we have the following Patients:
| Johnson |
| Henry |
| Walters |
| Glanzmann |
| Franklin |
| Revere |
| ZAPPA |
| EARLY |
Scenario: Brief tour around the UI Tabs
And I should be able to click on "Dashboard" and see "Admin Management"
And I should be able to click on "All Patients" and see "Patients"
And I should be able to click on "Practices" and see "Practices"
And I should be able to click on "Accounts" and see "Search"
And I should be able to click on "Simulate" and see "Simulator"
And I should be able to click on "Msg Log" and see "No Results Yet"
And I should be able to click on "Settings" and see "All Settings"
And I should be able to click on "Emails" and see "Notification Logs"
Scenario: Tour around Message Logs
And I should be able to click on "Msg Log" and see "No Results Yet"
And I click on "Search" button
Then I should see "Msg"
When I click on "Msg"
Then I should see "(Click to Copy)"
Scenario: Brief tour around the UI Global Links up top
And I should be able to click on "Help" and see "Axial MD Alerts Help"
And I should be able to click on "Log out" and see "Login to Your Account"
Scenario: Patient page as admin
When I go to "All Patients" page
Then I should be able to click on "Date" and see "Patients"
And I should be able to click on "Patient" and see "Patients"
And I should be able to click on "Unknown Names" and see "Patients With Unknown Name"
And I should be able to click on "Younger than 3" and see "born after"
And I should be able to click on "3 or Older" and see "born before"
Scenario Outline: Search Patients as admin
When I click on "All Patients"
When I search for "<value>"
Then I should be able to see "<patient>"
Examples:
| value | patient |
| Johnson | Johnson |
| 1853286 | Johnson |
| 42345678 | Franklin |
Scenario Outline: Search Account page as admin
When I go to "Accounts" page
When I search by "<type>" for "<value>"
Then I should be able to see "<patient>"
Examples:
| type | value | patient |
| last_name | Patterson | Patterson |
| msid | C27G0M6XZ8 | Jones |
| doctor_num | 99680009 | Shudderz |
| login | djones | Jones |
Scenario: Simulate page as admin
When I want to run the simulator
Then I should have the proper simulator controls available
And I should see "Simulate All"
And I should be able to click on "Manage Tests" and see "Test Messages"
# Actually, the steps for the above test are spread throughout more pertinently-names step files.
# For convenience sake, I added a bunch of sample steps here.
When /^I login as "([^"]*)"( and "([^"]*)")?$/ do |login, stuff, pw|
@login_name = login
password = pw
user = Account.where(:login => login).first
password = user.password if user and pw.blank?
visit login_path
fill_in "login", :with => login
fill_in "password", :with => password
click_button "login_button"
end
And /^I should be able to click on "([^"]*)" and see "([^"]*)"$/ do |link, expected|
click_link link
response.should contain expected
end
Then /^(?:|I )should see "([^"]*)"$/ do |text|
if response.respond_to? :should
response.should contain(text)
else
assert_contain text
end
end
And /^I click on "([^"]*)"$/ do |link|
click_link link
end
When /^I search for "([^"]*)"$/ do |search_term|
fill_in :search_field, :with => search_term
click_button "search"
end
Then /^I should be able to see "([^"]*)"$/ do |expected|
response.should contain expected
end
When /^I search by "([^"]*)" for "([^"]*)"$/ do |search_type, search_term|
fill_in search_type, :with => search_term
click_button "search"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment