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-1777: [Images and Documents - Medical List and Filter Views]", :regression=>true do
header_text = "Images and Documents"
medical_header_text = "Medical"
category = "category"
filterCategory = "filterCategory"
type = "type"
date = "date"
startDate = "startDate"
endDate = "endDate"
add_attachment = "addFile"
notes = "Notes"
before(:all) do
initializeConfigurations(BASE_URL)
removeCollection("attachments.chunks", "attachmentsdb")
removeCollection("attachments.files", "attachmentsdb")
initializeAllObjects
@common.loginEndsOnLandingPage("zztest.patient05", "patient05, zztest")
expect(@main.getFooterText()).to eq("Logged in as patient05, zztest")
@main.clickNavMenu()
!5.times{break if(@nav_menu.getNavMenuHeading()== "App Options"); sleep 1}
expect(@nav_menu.getNavMenuHeading()).to eq("App Options")
end
# after(:all) do
# quitDriver()
# end
context 'AC#JRNL-1711|TC #JRNL-1644: Sub Feature Selection for Images and Documents' do
it "Images and Documents table list inside 'Medical' view" do
waitForPageToFinishLoading
@driver.find_element(:css, "button[id='ImagesandDocuments']").click
waitForPageToFinishLoading
!5.times{break if(getPrimaryHeader()== header_text); sleep 1}
expect(getPrimaryHeader()).to eq(header_text)
@driver.find_element(:css, "button[class='btn btn-default medical']").click
waitForPageToFinishLoading
!5.times{break if(getPrimaryHeader()== medical_header_text); sleep 1}
expect(@common.isAddButtonVisible()).to eq(true)
expect(@common.getAddButtonAltText()).to eq("Add")
end
it "Filter Control", :broken => true do
#Click the hide filter button
@images_docs.showOrHideFilter()
sleep 1
#Verify the status filter options are hidden
expect(@images_docs.isFilterCollapsed).to eq(true)
#Flip the hide filter button again
@images_docs.showOrHideFilter()
sleep 1
expect(@images_docs.isTheFilterButtonVisible()).to eq(true)
end
it "Start Date", :broken => true do
expect(getShortFieldLabel(startDate, true)).to eq("Required: : M M / D D / Y Y Y Y:")
expect(isFieldRequired(:css, Images_Documents::STARTDATE)).to eq(true)
expect(getPlaceHolderByCSS(:css, Images_Documents::STARTDATE)).to eq("MM/DD/YYYY")
end
it "End Date", :broken => true do
expect(getShortFieldLabel(endDate, true)).to eq("Required: : M M / D D / Y Y Y Y:")
expect(isFieldRequired(:css, Images_Documents::ENDDATE)).to eq(true)
expect(getPlaceHolderByCSS(:css, Images_Documents::ENDDATE)).to eq("MM/DD/YYYY")
end
it "Category" do
expect(getLongFieldLabel(filterCategory)).to eq("Category:")
expect(areAllTheseValuesAvailableInDropDown(Images_Documents::FILTERCATEGORY, "Select,Medical,Military,Other")).to eq(true)
isThisFieldReadOnly("select[name='filterCategory']")
end
it "Type" do
expect(getLongFieldLabel(type)).to eq("Type:")
expect(areAllTheseValuesAvailableInDropDown(Images_Documents::TYPE, "Select, EKG, X-Ray Report, Test Results, Legal, Power of Attorney, Living Will, Line of Duty Injury Report, DD214, Medication, Hospital Discharge Summary, Other"))
end
it "Filter and Reset button" do
expect(@images_docs.isTheFilterButtonVisible()).to eq(true)
expect(@images_docs.isTheResetButtonVisible()).to eq(true)
end
end
context 'AC #JRNL-1710 |TC #JRNL-1644: Filter Action and Results Display for Images and Documents' do
it "Prevent Future date" do
time = Time.new()
today = time.strftime("%m/%d/%Y")
tomorrow = getDateNthDaysFromNow(1, "%m/%d/%Y")
dayAfterTomorrow = getDateNthDaysFromNow(2, "%m/%d/%Y")
setDate(dayAfterTomorrow, "input[name='startDate']")
setDate(tomorrow, "input[name='endDate']")
@images_docs.clickFilter
@error.isErrorMessageDisplayed("filterForm","Start Date must occur before End Date")
@error.isErrorMessageDisplayed("filterForm","Start date must be between 01/01/1900 and " + today + ".")
@error.isErrorMessageDisplayed("filterForm","End date must be between 01/01/1900 and " + today + ".")
sleep 2
setDate("11/31/2013", "input[name='startDate']")
setDate("09/31/2014", "input[name='endDate']")
@images_docs.clickFilter
@error.isErrorMessageDisplayed("filterForm","Start Date is an invalid date")
@error.isErrorMessageDisplayed("filterForm","End Date is an invalid date")
sleep 2
end
it "Add Entry" do
#1st entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading
#Completing Required Fields
setEntryValues({
category =>"Medical",
type=>"EKG",
date => getDateNthDaysAgo(0, "%m/%d/%Y"),
notes => "This is my EKG",
});
#Adding Attachment and clicking Save button
addAttachment(add_attachment, "heartbeat.jpg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading
sleep 5
#2nd entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading
setEntryValues({
category =>"Medical",
type=>"X-Ray Report",
date => getDateNthDaysAgo(5, "%m/%d/%Y"),
notes => "This is my X-ray",
});
addAttachment(add_attachment, "imgo.jpeg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading
expect(getTextForRowColumn(2,1)).to eq("Medical")
#3rd entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading
setEntryValues({
category =>"Medical",
type=>"Test Results",
date => getDateNthDaysAgo(10, "%m/%d/%Y"),
notes => "Talk to Veterans Affair",
});
addAttachment(add_attachment, "imgo.jpeg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading
#4th entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading
setEntryValues({
category =>"Medical",
type=>"Legal",
date => getDateNthDaysAgo(10, "%m/%d/%Y"),
notes => "Talk to Veterans Affair",
});
addAttachment(add_attachment, "imgo.jpeg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading
end
it "Filter Action and Results Display" do
@images_docs.clickReset
waitForPageToFinishLoading
#@images_docs.clickFilter
@images_docs.showOrHideFilter()
waitForPageToFinishLoading
#Verifying that correct information is displayed in the table view
expect(getTableHeaders()).to eq(["Category", "Type", "Document Date", "File Type", "Size"])
expect(getTextForRowColumn(1,1)).to eq("Medical")
expect(getTextForRowColumn(2,1)).to eq("Medical")
expect(getTextForRowColumn(3,1)).to eq("Medical")
waitForPageToFinishLoading
sleep 2
@images_docs.showOrHideFilter()
waitForPageToFinishLoading
@images_docs.clickReset
@images_docs.selectType("Test Results")
#@images_docs.clickFilter
@images_docs.showOrHideFilter()
waitForPageToFinishLoading
expect(getTextForRowColumn(1,1)).to eq("Medical")
sleep 2
end
end
context "Story JRNL-1696|AC JRNL-1583: Reset Button" do
it "Visible" do
waitForPageToFinishLoading
@images_docs.showOrHideFilter()
waitForPageToFinishLoading
expect(isResetButtonPresent()).to eq(true)
end
it "Label" do
expect(getResetButtonLabel()).to eq("Reset")
end
it "Result" do
nowDate = Time.new()
thenDate = Time.new(nowDate.year() - 1, nowDate.month(), nowDate.day())
waitForPageToFinishLoading
clickResetBtn()
waitForPageToFinishLoading
@driver.find_element(:css, "button[ng-click='filter()']").click
waitForPageToFinishLoading
expect(getTextForRowColumn(1,1)).to eq("Medical")
expect(getTextForRowColumn(2,1)).to eq("Medical")
expect(getTextForRowColumn(3,1)).to eq("Medical")
# DEFAULTS
expect(getTextFromInput(:css, "input[name='#{startDate}']")).to eq(thenDate.strftime("%m/%d/%Y"))
expect(getTextFromInput(:css, "input[name='#{endDate}']")).to eq(nowDate.strftime("%m/%d/%Y"))
expect(getTextFromInput(:css, "select[name='#{type}']")).to eq("")
expect(getTextFromInput(:css, "select[name='#{filterCategory}']")).to eq("Medical")
end
end
context 'AC #JRNL-1709 |TC #JRNL-1644: Sub Feature Default View (Table List)' do
it " no results found" do
waitForPageToFinishLoading
@images_docs.clickReset
waitForPageToFinishLoading
@images_docs.selectType("Other")
@images_docs.clickFilter
#Verifying that No results found message displays
expect(getNoResultsFoundMessage()).to eq("No results were found with the current filters. Use the Add button above to create a new record.")
#sorted in reverse chronological order by document date
@images_docs.clickReset
waitForPageToFinishLoading
@images_docs.clickFilter
waitForPageToFinishLoading
isSortedByChronologicalOrder("%m/%d/%Y", 3)
#Deleting Entry
#clickNthRow(1)
waitForPageToFinishLoading
@driver.find_element(:xpath, ".//*[@id='main-content-div']/div[2]/div/div[2]/list-table/div/div/ul/li[1]/span[6]").click
waitForPageToFinishLoading
@entry_form.clickDeleteButton()
@modal.clickYesButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq(medical_header_text)
waitForPageToFinishLoading
@driver.find_element(:xpath, ".//*[@id='main-content-div']/div[2]/div/div[2]/list-table/div/div/ul/li[1]/span[6]").click
waitForPageToFinishLoading
@entry_form.clickDeleteButton()
@modal.clickYesButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq(medical_header_text)
# secondary sort is on document type
@images_docs.clickReset
waitForPageToFinishLoading
#@images_docs.clickFilter
@images_docs.showOrHideFilter()
waitForPageToFinishLoading
isSortedAlphabeticallyByThisColumn(2)
end
end
context 'AC #JRNL-1708 |TC #JRNL-1644: Navigation for Images and Documents' do
it "Verifying '<' button" do
waitForPageToFinishLoading
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading
expect(getPrimaryHeader()).to eq("Add Images and Documents")
#Verifying '<' button is present
expect(@entry_form.isBackButtonVisible()).to eq(true)
#Clicking '<' button without any changes to return to the table view
@entry_form.clickBackButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq(medical_header_text)
#Resizing the window to phone size and verifying link is still visible.
resizeWindowTo(320, 480)
expect(isElementVisible(:css, 'button[ng-click="goBack()"]')).to be true
closeBrowser
end
end
# Local Function
def isThisFieldReadOnly(cssPath)
return isThisElementDisabled(:css, cssPath)
end
end
############################################################################ ORIGINAL CODE ################################################################
###########################################################################################################################################################
=begin
require_relative '../../../globalized'
include Globalized
describe "Story# JRNL-1777: [Images and Documents - Medical List and Filter Views]", :regression=>true do
header_text = "Images and Documents"
medical_header_text = "Medical"
category = "category"
filterCategory = "filterCategory"
type = "type"
date = "date"
startDate = "startDate"
endDate = "endDate"
add_attachment = "addFile"
notes = "Notes"
before(:all) do
initializeConfigurations(BASE_URL)
removeCollection("attachments.chunks", "attachmentsdb")
removeCollection("attachments.files", "attachmentsdb")
initializeAllObjects
@common.loginEndsOnLandingPage("zztest.patient01", "patient01, zztest")
expect(@main.getFooterText()).to eq("Logged in as patient01, zztest")
@main.clickNavMenu()
!45.times{break if(@nav_menu.getNavMenuHeading()== "App Options"); sleep 1}
expect(@nav_menu.getNavMenuHeading()).to eq("App Options")
end
after(:all) do
quitDriver()
end
context 'AC#JRNL-1711|TC #JRNL-1644: Sub Feature Selection for Images and Documents' do
it "Images and Documents table list inside 'Medical' view" do
@nav_menu.clickImagesDocuments()
!15.times{break if(getPrimaryHeader()== header_text); sleep 1}
expect(getPrimaryHeader()).to eq(header_text)
@nav_menu.clickMedical()
!15.times{break if(getPrimaryHeader()== medical_header_text); sleep 1}
expect(@common.isAddButtonVisible()).to eq(true)
expect(@common.getAddButtonAltText()).to eq("Add")
end
it "Filter Control", :broken => true do
#Click the hide filter button
@images_docs.showOrHideFilter()
sleep 1
#Verify the status filter options are hidden
expect(@images_docs.isFilterCollapsed).to eq(true)
#Flip the hide filter button again
@images_docs.showOrHideFilter()
sleep 1
expect(@images_docs.isTheFilterButtonVisible()).to eq(true)
end
it "Start Date", :broken => true do
expect(getShortFieldLabel(startDate, true)).to eq("Start Date:")
expect(isFieldRequired(:css, Images_Documents::STARTDATE)).to eq(true)
expect(getPlaceHolderByCSS(:css, Images_Documents::STARTDATE)).to eq("MM/DD/YYYY")
end
it "End Date", :broken => true do
expect(getShortFieldLabel(endDate, true)).to eq("End Date:")
expect(isFieldRequired(:css, Images_Documents::ENDDATE)).to eq(true)
expect(getPlaceHolderByCSS(:css, Images_Documents::ENDDATE)).to eq("MM/DD/YYYY")
end
it "Category" do
expect(getLongFieldLabel(filterCategory)).to eq("Category:")
expect(areAllTheseValuesAvailableInDropDown(Images_Documents::FILTERCATEGORY, "Select,Medical,Military,Other")).to eq(true)
isThisFieldReadOnly("select[name='filterCategory']")
end
it "Type" do
expect(getLongFieldLabel(type)).to eq("Type:")
expect(areAllTheseValuesAvailableInDropDown(Images_Documents::TYPE, "Select, EKG, X-Ray Report, Test Results, Legal, Power of Attorney, Living Will, Line of Duty Injury Report, DD214, Medication, Hospital Discharge Summary, Other"))
end
it "Filter and Reset button" do
expect(@images_docs.isTheFilterButtonVisible()).to eq(true)
expect(@images_docs.isTheResetButtonVisible()).to eq(true)
end
end
context 'AC #JRNL-1710 |TC #JRNL-1644: Filter Action and Results Display for Images and Documents' do
it "Prevent Future date" do
time = Time.new()
today = time.strftime("%m/%d/%Y")
tomorrow = getDateNthDaysFromNow(1, "%m/%d/%Y")
dayAfterTomorrow = getDateNthDaysFromNow(2, "%m/%d/%Y")
setDate(dayAfterTomorrow, "input[name='startDate']")
setDate(tomorrow, "input[name='endDate']")
@images_docs.clickFilter
@error.isErrorMessageDisplayed("filterForm","Start Date must occur before End Date")
@error.isErrorMessageDisplayed("filterForm","Start date must be between 01/01/1900 and " + today + ".")
@error.isErrorMessageDisplayed("filterForm","End date must be between 01/01/1900 and " + today + ".")
sleep 2
setDate("11/31/2013", "input[name='startDate']")
setDate("09/31/2014", "input[name='endDate']")
@images_docs.clickFilter
@error.isErrorMessageDisplayed("filterForm","Start Date is an invalid date")
@error.isErrorMessageDisplayed("filterForm","End Date is an invalid date")
sleep 2
end
it "Add Entry" do
#1st entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading()
#Completing Required Fields
setEntryValues({
category =>"Medical",
type=>"EKG",
date => getDateNthDaysAgo(0, "%m/%d/%Y"),
notes => "This is my EKG",
});
#Adding Attachment and clicking Save button
addAttachment(add_attachment, "heartbeat.jpg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading()
#2nd entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading()
setEntryValues({
category =>"Medical",
type=>"X-Ray Report",
date => getDateNthDaysAgo(5, "%m/%d/%Y"),
notes => "This is my X-ray",
});
addAttachment(add_attachment, "imgo.jpeg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading()
expect(getTextForRowColumn(2,1)).to eq("Medical")
#3rd entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading()
setEntryValues({
category =>"Medical",
type=>"Test Results",
date => getDateNthDaysAgo(10, "%m/%d/%Y"),
notes => "Talk to Veterans Affair",
});
addAttachment(add_attachment, "imgo.jpeg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading()
#4th entry
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading()
setEntryValues({
category =>"Medical",
type=>"Legal",
date => getDateNthDaysAgo(10, "%m/%d/%Y"),
notes => "Talk to Veterans Affair",
});
addAttachment(add_attachment, "imgo.jpeg")
@entry_form.clickSaveButton()
waitForPageToFinishLoading()
end
it "Filter Action and Results Display" do
@images_docs.clickReset
@images_docs.clickFilter
#Verifying that correct information is displayed in the table view
expect(getTableHeaders()).to eq(["Category", "Type", "Document Date", "File Type", "Size"])
expect(getTextForRowColumn(1,1)).to eq("Medical")
expect(getTextForRowColumn(2,1)).to eq("Medical")
expect(getTextForRowColumn(3,1)).to eq("Medical")
sleep 2
@images_docs.clickReset
@images_docs.selectType("Test Results")
@images_docs.clickFilter
expect(getTextForRowColumn(1,1)).to eq("Medical")
sleep 2
end
end
context "Story JRNL-1696|AC JRNL-1583: Reset Button" do
it "Visible" do
expect(isResetButtonPresent()).to eq(true)
end
it "Label" do
expect(getResetButtonLabel()).to eq("Reset")
end
it "Result" do
nowDate = Time.new()
thenDate = Time.new(nowDate.year() - 1, nowDate.month(), nowDate.day())
clickResetBtn()
waitForPageToFinishLoading()
expect(getTextForRowColumn(1,1)).to eq("Medical")
expect(getTextForRowColumn(2,1)).to eq("Medical")
expect(getTextForRowColumn(3,1)).to eq("Medical")
# DEFAULTS
expect(getTextFromInput(:css, "input[name='#{startDate}']")).to eq(thenDate.strftime("%m/%d/%Y"))
expect(getTextFromInput(:css, "input[name='#{endDate}']")).to eq(nowDate.strftime("%m/%d/%Y"))
expect(getTextFromInput(:css, "select[name='#{type}']")).to eq("")
expect(getTextFromInput(:css, "select[name='#{filterCategory}']")).to eq("Medical")
end
end
context 'AC #JRNL-1709 |TC #JRNL-1644: Sub Feature Default View (Table List)' do
it " no results found" do
@images_docs.clickReset
@images_docs.selectType("Other")
@images_docs.clickFilter
#Verifying that No results found message displays
expect(getNoResultsFoundMessage()).to eq("No results were found with the current filters. Use the Add button above to create a new record.")
#sorted in reverse chronological order by document date
@images_docs.clickReset
@images_docs.clickFilter
isSortedByChronologicalOrder("%m/%d/%Y", 3)
#Deleting Entry
clickNthRow(1)
@entry_form.clickDeleteButton()
@modal.clickYesButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq(medical_header_text)
clickNthRow(1)
@entry_form.clickDeleteButton()
@modal.clickYesButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq(medical_header_text)
# secondary sort is on document type
@images_docs.clickReset
@images_docs.clickFilter
isSortedAlphabeticallyByThisColumn(2)
end
end
context 'AC #JRNL-1708 |TC #JRNL-1644: Navigation for Images and Documents' do
it "Verifying '<' button" do
@entry_form.clickAddEntryButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq("Add Images and Documents")
#Verifying '<' button is present
expect(@entry_form.isBackButtonVisible()).to eq(true)
#Clicking '<' button without any changes to return to the table view
@entry_form.clickBackButton()
waitForPageToFinishLoading()
expect(getPrimaryHeader()).to eq(medical_header_text)
#Resizing the window to phone size and verifying link is still visible.
resizeWindowTo(320, 480)
expect(isElementVisible(:css, 'button[ng-click="goBack()"]')).to be true
closeBrowser
end
end
# Local Function
def isThisFieldReadOnly(cssPath)
return isThisElementDisabled(:css, cssPath)
end
end
=end