Summary Table
| Categories |
Total Count |
| PII |
0 |
| URL |
0 |
| DNS |
0 |
| EKL |
0 |
| IP |
0 |
| PORT |
0 |
| VsID |
0 |
| CF |
0 |
| AI |
0 |
| VPD |
0 |
| PL |
0 |
| Other |
0 |
File Content
require_relative '../../globalized'
include Globalized
describe "[Story #JRNL-1772: Occupational History - Add]", :regression => true do
before(:all) do
@ENTRY_FORM_1 = [
"* required field",
"",
"* Event Title:",
"50 character maximum",
"resource",
"*",
"Required: Event Date: M M / D D / Y Y Y Y:",
"Event Date:",
"This calendar control is not optimized for screen readers. Please directly enter dates in the text box provided. Open Calendar Control.",
"Branch of Service:",
"Location of Service:",
"Assignment (unit, location, activity):",
"150 character maximum",
"Event Details: Injury, Exposure and Military Service",
"Please select one or more of the options below to enter details about your event.",
"",
"Injury/Illness:",
"Yes",
"No",
"Exposure:",
"Yes",
"No",
"Military Service:",
"Yes",
"No",
"Save Cancel"
]
@ENTRY_FORM_2 = [
"* required field",
"",
"* Event Title:",
"50 character maximum",
"resource",
"*",
"Required: Event Date: M M / D D / Y Y Y Y:",
"Event Date:",
"This calendar control is not optimized for screen readers. Please directly enter dates in the text box provided. Open Calendar Control.",
"Branch of Service:",
"Location of Service:",
"",
"Yes",
"No",
"* Describe your military service related to this event:",
"1000 character maximum",
"1000 characters left",
"Save Cancel"
]
initializeConfigurations(BASE_URL)
removeCollection("occupationhistory", "personalhistorydb")
initializeAllObjects
@common.loginEndsOnLandingPage("zztest.patient05","patient05, zztest")
expect(@main.getFooterText()).to eq("Logged in as patient05, zztest")
@main.clickNavMenu()
!5.times{ break if (@navMenu.getNavMenuHeading() == "App Options"); sleep 1 }
waitForPageToFinishLoading
@driver.find_element(:css, "button[id='MyProfile']").click
waitForPageToFinishLoading
!5.times{ break if (getSecondaryHeader() == "My Profile"); sleep 1 }
expect(getSecondaryHeader()).to eq("My Profile")
@navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
#expect(getCount()).to eq(0)
end
# after(:all) do
# quitDriver()
# end
describe "AC JRNL-1688|TC-2859: Occupational History List" do
it "Add Button" do
expect(@common.isAddButtonVisible()).to eq(true)
end
end
describe "AC JRNL-1688|TC-2859: When Selecting Add" do
it "Header" do
waitForPageToFinishLoading
@common.clickAddButton()
waitForPageToFinishLoading
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
end
describe "Detailed Fields" do
it "Screen Content", :broken => true do
@form = @occupationalHistory.stripSelectTextFromScreen(
@occupationalHistory.getScreenContent().split("\n"),
['serviceBranch', 'serviceLocation']
)
@ENTRY_FORM_1.each_with_index do | expectedScreenRow, i |
expect(@form[i]).to eq(expectedScreenRow)
end
end
it "Event Title" do
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_TITLE)).to eq("")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EVENT_TITLE)).to eq(true)
end
it "Event Date" do
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EVENT_DATE)).to eq(true)
end
it "Branch of Service" do
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Select")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::SERVICE_BRANCH)).to eq(false)
serviceBranch = ["Select", "Air Force", "Army", "Coast Guard", "Marine", "Navy", "Public Health", "Other"]
@occupationalHistory.getElement(:css, OccupationalHistory::SERVICE_BRANCH).text().split("\n").each_with_index do | foundText, i |
expect(foundText).to eq(serviceBranch[i])
end
end
it "Location of Service" do
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_LOCATION)).to eq("Select")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::SERVICE_LOCATION)).to eq(false)
serviceLocation = ["Select", "CONUS", "Overseas", "Shipboard"]
@occupationalHistory.getElement(:css, OccupationalHistory::SERVICE_LOCATION).text().split("\n").each_with_index do | foundText, i |
expect(foundText).to eq(serviceLocation[i])
end
end
it "Assignment" do
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::ASSIGNMENT)).to eq("")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::ASSIGNMENT)).to eq(false)
end
it "Injury/Illness" do
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::INJURY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::INJURY)).to eq(false)
end
it "Injury/Illness Description" do
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_YES)
expect(@occupationalHistory.is_element_present(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
end
it "Exposure" do
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::EXPOSURE)).to eq(false)
end
it "Exposure Description" do
@occupationalHistory.click(:css, OccupationalHistory::EXPOSURE_FLAG_YES)
expect(@occupationalHistory.is_element_present(:css, OccupationalHistory::EXPOSURE)).to eq(true)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EXPOSURE)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(false)
end
it "Military Service" do
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::MILITARY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::MILITARY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(false)
end
it "Military Service Description" do
@occupationalHistory.click(:css, OccupationalHistory::MILITARY_FLAG_YES)
expect(@occupationalHistory.is_element_present(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(true)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(false)
end
it "Screen Content", :broken => true do
@form = @occupationalHistory.stripSelectTextFromScreen(
@occupationalHistory.getScreenContent().split("\n"),
['serviceBranch', 'serviceLocation']
)
@ENTRY_FORM_2.each_with_index do | expectedScreenRow, i |
expect(@form[i]).to eq(expectedScreenRow)
end
end
it "Error Messages" do
expectedValidationSummaryHeader = "The following errors were found:"
@occupationalHistory.clickSaveButton()
!5.times{ break if (@error.getValidationSummaryHeader("form") == expectedValidationSummaryHeader); sleep 1 }
expect(@error.getValidationSummaryHeader("form")).to eq(expectedValidationSummaryHeader)
expect(@error.isErrorMessageDisplayed("form", "Event Title field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Event Date field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Event Date must be formatted MM/DD/YYYY.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Record details about your injury/illness field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Record details about your exposure field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Describe your military service related to this event field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "You must answer 'yes' to at least one of the Event Detail questions and provide the related event information in order to save your entry.")).to eq(false)
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "Big Event")
@occupationalHistory.setInput(OccupationalHistory::EVENT_DATE, "11/01")
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_NO)
@occupationalHistory.click(:css, OccupationalHistory::EXPOSURE_FLAG_NO)
@occupationalHistory.click(:css, OccupationalHistory::MILITARY_FLAG_NO)
@occupationalHistory.clickSaveButton()
!5.times{ break if (@error.getValidationSummaryHeader("form") == expectedValidationSummaryHeader); sleep 1 }
expect(@error.getValidationSummaryHeader("form")).to eq(expectedValidationSummaryHeader)
expect(@error.isErrorMessageDisplayed("form", "Event Title field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Event Date field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Event Date must be formatted MM/DD/YYYY.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Record details about your injury/illness field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Record details about your exposure field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Describe your military service related to this event field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "You must answer 'yes' to at least one of the Event Detail questions and provide the related event information in order to save your entry.")).to eq(false)
end
#end
describe "Standard Save and Cancel Options" do
it "Cancel" do
expect(@occupationalHistory.isCancelButtonVisible()).to eq(true)
@occupationalHistory.clickCancelButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
end
describe "Save" do
it "Min", :broken => true do
@common.clickAddButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "Wounded in combat")
# @date_picker.click(:css, OccupationalHistory::EVENT_DATE_BUTTON)
# !5.times{ break if (@date_picker.getSetButtonText == "SET"); sleep 1 }
# @date_picker.setDateFromGUI(11, 01, 1990)
waitForPageToFinishLoading
@driver.find_element(:css, "input[id='date']").clear
waitForPageToFinishLoading
@driver.find_element(:css, "input[id='date']").send_keys "11/01/1990"
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("11/01/1990")
@occupationalHistory.setSelectBoxValue(OccupationalHistory::SERVICE_BRANCH, "Marine")
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_YES)
@occupationalHistory.setInput(OccupationalHistory::INJURY, "I was shot in the leg.")
@occupationalHistory.clickSaveButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
end
it "Branch of Service Should Default To Last-Saved Branch", :broken => true do
waitForPageToFinishLoading
@common.clickAddButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
end
it "Max", :broken => true do
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "This is an event title with a max length of 50 characters.")
@occupationalHistory.setInput(OccupationalHistory::EVENT_DATE, "11/02/2014")
@occupationalHistory.setSelectBoxValue(OccupationalHistory::SERVICE_BRANCH, "Navy")
@occupationalHistory.setSelectBoxValue(OccupationalHistory::SERVICE_LOCATION, "Shipboard")
@occupationalHistory.setInput(OccupationalHistory::ASSIGNMENT, "The assignment text field allows an entry of no more than one hundred and fifty alphanumeric characters! That's truly astonishing, isn't it? 150-character input field.")
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_YES)
@occupationalHistory.setInput(OccupationalHistory::INJURY, "I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times?")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::INJURY_CHARACTER_COUNTER)).to eq("791 characters left")
@occupationalHistory.setInput(OccupationalHistory::INJURY, "I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times?")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::INJURY_CHARACTER_COUNTER)).to eq("0 characters left")
@occupationalHistory.click(:css, OccupationalHistory::EXPOSURE_FLAG_YES)
waitForPageToFinishLoading
sleep 10
@occupationalHistory.setInput(OccupationalHistory::EXPOSURE, "I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::EXPOSURE_CHARACTER_COUNTER)).to eq("737 characters left")
@occupationalHistory.setInput(OccupationalHistory::EXPOSURE, "I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::EXPOSURE_CHARACTER_COUNTER)).to eq("0 characters left")
@occupationalHistory.click(:css, OccupationalHistory::MILITARY_FLAG_YES)
sleep 15
@occupationalHistory.setInput(OccupationalHistory::MILITARY_SERVICE, "I've served my country! I served for over 4 years. I've served my country! I served for over 4 years.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::MILITARY_SERVICE_CHARACTER_COUNTER)).to eq("899 characters left")
@occupationalHistory.setInput(OccupationalHistory::MILITARY_SERVICE, "I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::MILITARY_SERVICE_CHARACTER_COUNTER)).to eq("0 characters left")
sleep 3
@occupationalHistory.clickSaveButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
end
it "Branch of Service Should Default To Last-Saved Branch", :broken => true do
waitForPageToFinishLoading
@common.clickAddButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Select")
@occupationalHistory.clickCancelButton()
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
end
it "Verify Min Data", :broken => true do
@occupationalHistoryFilter.setInput(Occupational_History_Filter::START_DATE, "01/01/1990")
@occupationalHistoryFilter.clickFilterBtn()
!5.times{ break if (@occupationalHistoryFilter.getFocusedElementText().include?("Event Title")); sleep 1 }
waitForPageToFinishLoading
#clickNthRow(1)
waitForPageToFinishLoading
@driver.find_element(:xpath, ".//*[@id='main-content-div']/div[2]/div[2]/list-table/div/div/ul/li[2]/span[3]").click
waitForPageToFinishLoading
!5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::EDIT_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::EDIT_HEADER)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_TITLE)).to eq("Wounded in combat")
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("11/01/1990")
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Marine")
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_LOCATION)).to eq("Select")
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::ASSIGNMENT)).to eq("")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::INJURY)).to eq("I was shot in the leg.")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::EXPOSURE)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(false)
end
# it "Verify Max Data", :broken => true do
# @occupationalHistory.clickCancelButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
#
# expect(getCount()).to eq(2)
#
# clickNthRow(1)
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::EDIT_HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::EDIT_HEADER)
#
# expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_TITLE)).to eq("This is an event title with a max length of 50 cha")
# expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("11/02/2014")
# expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Navy")
# expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_LOCATION)).to eq("Shipboard")
# expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::ASSIGNMENT)).to eq("The assignment text field allows an entry of no more than one hundred and fifty alphanumeric characters! That's truly astonishing, isn't it? 150-chara")
# expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(true)
# expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
# expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::INJURY)).to eq(true)
# expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::INJURY)).to eq("I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really ba")
# expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(true)
# expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(false)
# expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::EXPOSURE)).to eq(true)
# expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EXPOSURE)).to eq("I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite")
# expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(true)
# expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(false)
# expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(true)
# expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::MILITARY_SERVICE)).to eq("I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I serve")
# end
end
end
# describe "AC JRNL-1685|TC JRNL-1657: Navigation Without Saving" do
#
# context "Clicking Back Button" do
#
# it "No changes", :broken => true do
# @occupationalHistory.clickBackButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
#
# expect(getCount()).to eq(2)
# end
#
# it "Changes", :broken => true do
# @common.clickAddButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
#
# @occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "XYZ")
#
# @occupationalHistory.clickBackButton()
# !5.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
# expect(@modal.getConfirmationHeading()).to eq("Confirmation")
# expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
# expect(@modal.getConfirmButtonText()).to eq("Continue")
# expect(@modal.getCancelButtonText()).to eq("Return")
#
# @modal.clickReturnButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
#
# @occupationalHistory.clickBackButton()
# !5.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
# expect(@modal.getConfirmationHeading()).to eq("Confirmation")
# expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
# expect(@modal.getConfirmButtonText()).to eq("Continue")
# expect(@modal.getCancelButtonText()).to eq("Return")
#
# @modal.clickContinueButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
#
# expect(getCount()).to eq(2)
# end
#
# end
#
# context "Clicking Menu Item" do
#
# it "No changes", :broken => true do
# @common.clickAddButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
#
# @navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
#
# expect(getCount()).to eq(2)
# end
#
# it "Changes", :broken => true do
# @common.clickAddButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
#
# @occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "XYZ")
#
# @navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
# !5.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
# expect(@modal.getConfirmationHeading()).to eq("Confirmation")
# expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
# expect(@modal.getConfirmButtonText()).to eq("Continue")
# expect(@modal.getCancelButtonText()).to eq("Return")
#
# @modal.clickReturnButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
#
# @navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
# !5.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
# expect(@modal.getConfirmationHeading()).to eq("Confirmation")
# expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
# expect(@modal.getConfirmButtonText()).to eq("Continue")
# expect(@modal.getCancelButtonText()).to eq("Return")
#
# @modal.clickContinueButton()
# !5.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
# expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
#
# expect(getCount()).to eq(2)
# end
# end
end
end
end
############################################################################ ORIGINAL CODE ################################################################
###########################################################################################################################################################
=begin
require_relative '../../globalized'
include Globalized
describe "[Story #JRNL-1772: Occupational History - Add]", :regression => true do
before(:all) do
@ENTRY_FORM_1 = [
"* required field",
"",
"* Event Title:",
"50 character maximum",
"* Event Date:",
"MM/DD/YYYY",
"This date selection control is not optimized for screen readers. Please directly enter the date in the text box provided. Open Date Picker",
"Branch of Service:",
"Location of Service:",
"Assignment (unit, location, activity):",
"150 character maximum",
"Event Details: Injury, Exposure and Military Service",
"Please select one or more of the options below to enter details about your event.",
"",
"Injury/Illness:",
"Yes",
"No",
"Exposure:",
"Yes",
"No",
"Military Service:",
"Yes",
"No",
"Save Cancel"
]
@ENTRY_FORM_2 = [
"* required field",
"",
"* Event Title:",
"50 character maximum",
"* Event Date:",
"MM/DD/YYYY",
"This date selection control is not optimized for screen readers. Please directly enter the date in the text box provided. Open Date Picker",
"Branch of Service:",
"Location of Service:",
"Assignment (unit, location, activity):",
"150 character maximum",
"Event Details: Injury, Exposure and Military Service",
"Please select one or more of the options below to enter details about your event.",
"",
"Injury/Illness:",
"Yes",
"No",
"* Record details about your injury/illness:",
"1000 character maximum",
"1000 characters left",
"Exposure:",
"Yes",
"No",
"* Record details about your exposure:",
"1000 character maximum",
"1000 characters left",
"Military Service:",
"Yes",
"No",
"* Describe your military service related to this event:",
"1000 character maximum",
"1000 characters left",
"Save Cancel"
]
initializeConfigurations(BASE_URL)
removeCollection("occupationhistory", "personalhistorydb")
initializeAllObjects
@common.loginEndsOnLandingPage("zztest.patient01","patient01, zztest")
expect(@main.getFooterText()).to eq("Logged in as patient01, zztest")
@main.clickNavMenu()
!45.times{ break if (@navMenu.getNavMenuHeading() == "App Options"); sleep 1 }
@navMenu.clickMyProfile()
!45.times{ break if (getSecondaryHeader() == "My Profile"); sleep 1 }
expect(getSecondaryHeader()).to eq("My Profile")
@navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(0)
end
after(:all) do
quitDriver()
end
describe "AC JRNL-1688|TC-2859: Occupational History List" do
it "Add Button" do
expect(@common.isAddButtonVisible()).to eq(true)
end
end
describe "AC JRNL-1688|TC-2859: When Selecting Add" do
it "Header" do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
end
describe "Detailed Fields" do
it "Screen Content", :broken => true do
@form = @occupationalHistory.stripSelectTextFromScreen(
@occupationalHistory.getScreenContent().split("\n"),
['serviceBranch', 'serviceLocation']
)
@ENTRY_FORM_1.each_with_index do | expectedScreenRow, i |
expect(@form[i]).to eq(expectedScreenRow)
end
end
it "Event Title" do
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_TITLE)).to eq("")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EVENT_TITLE)).to eq(true)
end
it "Event Date" do
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EVENT_DATE)).to eq(true)
end
it "Branch of Service" do
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Select")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::SERVICE_BRANCH)).to eq(false)
serviceBranch = ["Select", "Air Force", "Army", "Coast Guard", "Marine", "Navy", "Public Health", "Other"]
@occupationalHistory.getElement(:css, OccupationalHistory::SERVICE_BRANCH).text().split("\n").each_with_index do | foundText, i |
expect(foundText).to eq(serviceBranch[i])
end
end
it "Location of Service" do
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_LOCATION)).to eq("Select")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::SERVICE_LOCATION)).to eq(false)
serviceLocation = ["Select", "CONUS", "Overseas", "Shipboard"]
@occupationalHistory.getElement(:css, OccupationalHistory::SERVICE_LOCATION).text().split("\n").each_with_index do | foundText, i |
expect(foundText).to eq(serviceLocation[i])
end
end
it "Assignment" do
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::ASSIGNMENT)).to eq("")
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::ASSIGNMENT)).to eq(false)
end
it "Injury/Illness" do
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::INJURY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::INJURY)).to eq(false)
end
it "Injury/Illness Description" do
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_YES)
expect(@occupationalHistory.is_element_present(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
end
it "Exposure" do
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::EXPOSURE)).to eq(false)
end
it "Exposure Description" do
@occupationalHistory.click(:css, OccupationalHistory::EXPOSURE_FLAG_YES)
expect(@occupationalHistory.is_element_present(:css, OccupationalHistory::EXPOSURE)).to eq(true)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::EXPOSURE)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(false)
end
it "Military Service" do
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::MILITARY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::MILITARY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(false)
end
it "Military Service Description" do
@occupationalHistory.click(:css, OccupationalHistory::MILITARY_FLAG_YES)
expect(@occupationalHistory.is_element_present(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(true)
expect(@occupationalHistory.isFieldRequired(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(false)
end
it "Screen Content", :broken => true do
@form = @occupationalHistory.stripSelectTextFromScreen(
@occupationalHistory.getScreenContent().split("\n"),
['serviceBranch', 'serviceLocation']
)
@ENTRY_FORM_2.each_with_index do | expectedScreenRow, i |
expect(@form[i]).to eq(expectedScreenRow)
end
end
it "Error Messages" do
expectedValidationSummaryHeader = "The following errors were found:"
@occupationalHistory.clickSaveButton()
!45.times{ break if (@error.getValidationSummaryHeader("form") == expectedValidationSummaryHeader); sleep 1 }
expect(@error.getValidationSummaryHeader("form")).to eq(expectedValidationSummaryHeader)
expect(@error.isErrorMessageDisplayed("form", "Event Title field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Event Date field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Event Date must be formatted MM/DD/YYYY.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Record details about your injury/illness field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Record details about your exposure field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Describe your military service related to this event field is required.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "You must answer 'yes' to at least one of the Event Detail questions and provide the related event information in order to save your entry.")).to eq(false)
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "Big Event")
@occupationalHistory.setInput(OccupationalHistory::EVENT_DATE, "11/01")
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_NO)
@occupationalHistory.click(:css, OccupationalHistory::EXPOSURE_FLAG_NO)
@occupationalHistory.click(:css, OccupationalHistory::MILITARY_FLAG_NO)
@occupationalHistory.clickSaveButton()
!45.times{ break if (@error.getValidationSummaryHeader("form") == expectedValidationSummaryHeader); sleep 1 }
expect(@error.getValidationSummaryHeader("form")).to eq(expectedValidationSummaryHeader)
expect(@error.isErrorMessageDisplayed("form", "Event Title field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Event Date field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Event Date must be formatted MM/DD/YYYY.")).to eq(true)
expect(@error.isErrorMessageDisplayed("form", "Record details about your injury/illness field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Record details about your exposure field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "Describe your military service related to this event field is required.")).to eq(false)
expect(@error.isErrorMessageDisplayed("form", "You must answer 'yes' to at least one of the Event Detail questions and provide the related event information in order to save your entry.")).to eq(true)
end
end
describe "Standard Save and Cancel Options" do
it "Cancel" do
expect(@occupationalHistory.isCancelButtonVisible()).to eq(true)
@occupationalHistory.clickCancelButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(0)
end
describe "Save" do
it "Min", :broken => true do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "Wounded in combat")
@date_picker.click(:css, OccupationalHistory::EVENT_DATE_BUTTON)
!45.times{ break if (@date_picker.getSetButtonText == "SET"); sleep 1 }
@date_picker.setDateFromGUI(11, 01, 1990)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("11/01/1990")
@occupationalHistory.setSelectBoxValue(OccupationalHistory::SERVICE_BRANCH, "Marine")
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_YES)
@occupationalHistory.setInput(OccupationalHistory::INJURY, "I was shot in the leg.")
@occupationalHistory.clickSaveButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(0)
end
it "Branch of Service Should Default To Last-Saved Branch", :broken => true do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Marine")
end
it "Max", :broken => true do
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "This is an event title with a max length of 50 characters.")
@occupationalHistory.setInput(OccupationalHistory::EVENT_DATE, "11/02/2014")
@occupationalHistory.setSelectBoxValue(OccupationalHistory::SERVICE_BRANCH, "Navy")
@occupationalHistory.setSelectBoxValue(OccupationalHistory::SERVICE_LOCATION, "Shipboard")
@occupationalHistory.setInput(OccupationalHistory::ASSIGNMENT, "The assignment text field allows an entry of no more than one hundred and fifty alphanumeric characters! That's truly astonishing, isn't it? 150-character input field.")
@occupationalHistory.click(:css, OccupationalHistory::INJURY_FLAG_YES)
@occupationalHistory.setInput(OccupationalHistory::INJURY, "I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times?")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::INJURY_CHARACTER_COUNTER)).to eq("791 characters left")
@occupationalHistory.setInput(OccupationalHistory::INJURY, "I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times?")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::INJURY_CHARACTER_COUNTER)).to eq("0 characters left")
@occupationalHistory.click(:css, OccupationalHistory::EXPOSURE_FLAG_YES)
@occupationalHistory.setInput(OccupationalHistory::EXPOSURE, "I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::EXPOSURE_CHARACTER_COUNTER)).to eq("737 characters left")
@occupationalHistory.setInput(OccupationalHistory::EXPOSURE, "I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::EXPOSURE_CHARACTER_COUNTER)).to eq("0 characters left")
@occupationalHistory.click(:css, OccupationalHistory::MILITARY_FLAG_YES)
@occupationalHistory.setInput(OccupationalHistory::MILITARY_SERVICE, "I've served my country! I served for over 4 years. I've served my country! I served for over 4 years.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::MILITARY_SERVICE_CHARACTER_COUNTER)).to eq("899 characters left")
@occupationalHistory.setInput(OccupationalHistory::MILITARY_SERVICE, "I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years.")
expect(@occupationalHistory.getTextForElement(:css, OccupationalHistory::MILITARY_SERVICE_CHARACTER_COUNTER)).to eq("0 characters left")
@occupationalHistory.clickSaveButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(1)
end
it "Branch of Service Should Default To Last-Saved Branch", :broken => true do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Navy")
@occupationalHistory.clickCancelButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(1)
end
it "Verify Min Data", :broken => true do
@occupationalHistoryFilter.setInput(Occupational_History_Filter::START_DATE, "01/01/1990")
@occupationalHistoryFilter.clickFilterBtn()
!10.times{ break if (@occupationalHistoryFilter.getFocusedElementText().include?("Event Title")); sleep 1 }
expect(getCount()).to eq(2)
clickNthRow(2)
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::EDIT_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::EDIT_HEADER)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_TITLE)).to eq("Wounded in combat")
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("11/01/1990")
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Marine")
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_LOCATION)).to eq("Select")
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::ASSIGNMENT)).to eq("")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::INJURY)).to eq("I was shot in the leg.")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::EXPOSURE)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(false)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(true)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(false)
end
it "Verify Max Data", :broken => true do
@occupationalHistory.clickCancelButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(2)
clickNthRow(1)
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::EDIT_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::EDIT_HEADER)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_TITLE)).to eq("This is an event title with a max length of 50 cha")
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EVENT_DATE)).to eq("11/02/2014")
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_BRANCH)).to eq("Navy")
expect(@occupationalHistory.getSelectBoxText(OccupationalHistory::SERVICE_LOCATION)).to eq("Shipboard")
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::ASSIGNMENT)).to eq("The assignment text field allows an entry of no more than one hundred and fifty alphanumeric characters! That's truly astonishing, isn't it? 150-chara")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::INJURY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::INJURY)).to eq(true)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::INJURY)).to eq("I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really bad injury! Did you know that I was shot 237 times? I've had a really ba")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::EXPOSURE_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::EXPOSURE)).to eq(true)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::EXPOSURE)).to eq("I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite sure what that means but I'll repeat it over 10 times. I've been exposed! I'm not quite")
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_YES)).to eq(true)
expect(@occupationalHistory.isInputChecked(OccupationalHistory::MILITARY_FLAG_NO)).to eq(false)
expect(@occupationalHistory.isElementVisible(:css, OccupationalHistory::MILITARY_SERVICE)).to eq(true)
expect(@occupationalHistory.getTextFromInput(:css, OccupationalHistory::MILITARY_SERVICE)).to eq("I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I served for over 4 years. I've served my country! I serve")
end
end
end
describe "AC JRNL-1685|TC JRNL-1657: Navigation Without Saving" do
context "Clicking Back Button" do
it "No changes", :broken => true do
@occupationalHistory.clickBackButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(getCount()).to eq(2)
end
it "Changes", :broken => true do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "XYZ")
@occupationalHistory.clickBackButton()
!45.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
expect(@modal.getConfirmationHeading()).to eq("Confirmation")
expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
expect(@modal.getConfirmButtonText()).to eq("Continue")
expect(@modal.getCancelButtonText()).to eq("Return")
@modal.clickReturnButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@occupationalHistory.clickBackButton()
!45.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
expect(@modal.getConfirmationHeading()).to eq("Confirmation")
expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
expect(@modal.getConfirmButtonText()).to eq("Continue")
expect(@modal.getCancelButtonText()).to eq("Return")
@modal.clickContinueButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(2)
end
end
context "Clicking Menu Item" do
it "No changes", :broken => true do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(getCount()).to eq(2)
end
it "Changes", :broken => true do
@common.clickAddButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@occupationalHistory.setInput(OccupationalHistory::EVENT_TITLE, "XYZ")
@navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
!45.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
expect(@modal.getConfirmationHeading()).to eq("Confirmation")
expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
expect(@modal.getConfirmButtonText()).to eq("Continue")
expect(@modal.getCancelButtonText()).to eq("Return")
@modal.clickReturnButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::ADD_HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::ADD_HEADER)
@navMenu.click(:css, Nav_menu::NAV["OccupationalHistory"]["navButton"])
!45.times{ break if (@modal.getConfirmationHeading() == "Confirmation"); sleep 1 }
expect(@modal.getConfirmationHeading()).to eq("Confirmation")
expect(@modal.getConfirmationMessage()).to eq("You have not saved your changes. You may continue without saving or return to the entry screen.")
expect(@modal.getConfirmButtonText()).to eq("Continue")
expect(@modal.getCancelButtonText()).to eq("Return")
@modal.clickContinueButton()
!45.times{ break if (@occupationalHistory.getPrimaryHeader() == OccupationalHistory::HEADER); sleep 1 }
expect(@occupationalHistory.getPrimaryHeader()).to eq(OccupationalHistory::HEADER)
expect(getCount()).to eq(2)
end
end
end
end
end
=end