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
# encoding: utf-8
require_relative '../../../globalized'
include Globalized
describe '[Story #JRNL-1196: My Medical - Surgeries Select From List]', :regression => true do
before(:all) do
initializeConfigurations(BASE_URL)
removeCollection("surgeries", 'medicalhistorydb')
initializeAllObjects
#@char100 = "abcdefghij1234567890ABCDEFGHIJ1234567890abcdefghij!$%&().,?<>[]:;abcdefghij1234567890ABCDEFGHIJ12345"
@char100 = "abcdefghij1234567890ABCDEFGHIJ1234567890abcdefghijabcdefghij1234567890ABCDEFGHIJ1234567890abcdefghij"
@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')
@nav_menu.clickMyMedical()
!45.times{ break if (getSecondaryHeader() == 'My Medical'); sleep 1 }
expect(getSecondaryHeader()).to eq('My Medical')
@mymedical.clickSurgeries
waitForPageToFinishLoading()
@common.clickAddButton()
waitForPageToFinishLoading()
end
after(:all) do
quitDriver()
end
describe 'AC JRNL-1170|TC JRNL-1148: Control Display' do
it "100 Character Max" do
setTypeaheadField(@char100 + @char100)
expect(@surgeries.getNameOfSurgery()).to eq(@char100)
end
it "Label" do
expect(getElement(:css,"span[name='surgeryLabel']").text).to eq("Name of Surgery:")
end
it "Guidance text" do
expect(@surgeries.getNameOfSurgeryElement().attribute("placeholder")).to eq("Enter a Surgery Name")
end
it "Screen reader" do
expect(@surgeries.getNameOfSurgeryElement().attribute("title")).to \
eq("Type to enter a surgery name or select a name from the list provided. "+
"List suggestions are provided after 3 characters are typed.")
end
end
describe 'AC JRNL-1169|TC JRNL-1148: Type, Search and Sort Action' do
it "After 3 chars list displays", :broken => true do
setTypeaheadField( "c")
!2.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
expect(isElementVisible(:css, getSelectListCSS())).to eq(false)
setTypeaheadField("ch")
!2.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
expect(isElementVisible(:css, getSelectListCSS())).to eq(false)
setTypeaheadField( "cho")
!3.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
expect(isElementVisible(:css, getSelectListCSS())).to eq(true)
expect(getSelectListCount()).to be > 0
end
it "List sort", :broken => true do
setTypeaheadField("cho")
!2.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
expect(isElementVisible(:css, getSelectListCSS())).to eq(true)
expect(getSelectListCount()).to be > 0
startInternalMatch = 0
#Find the point where beginning match changes to internal match
selectionList = getSelectListText()
for i in 0...getSelectListCount()
if selectionList[i][0..2].upcase != "CHO"
startInternalMatch = i
break
end
end
expect(startInternalMatch).to be > 0
expect(startInternalMatch).to be <= getSelectListCount()-1
#Verify no Beginning matches are in the bottom of list
for i in startInternalMatch...getSelectListCount()
expect(selectionList[i][0..2].upcase).to_not eq("CHO")
end
end
it "Refine match with more chars", :broken => true do
setTypeaheadField( "cho")
!2.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
expect(isElementVisible(:css, getSelectListCSS())).to eq(true)
threeCharMatchCount = getSelectListCount()
setTypeaheadField( "chol")
!5.times{ break if (getSelectListCount() < threeCharMatchCount); sleep 1 }
expect(getSelectListCount()).to be > 0
expect(getSelectListCount()).to be < threeCharMatchCount
end
it "Focus on input field" do
expect(getActiveElement().attribute("name")).to eq("surgery")
end
end
describe 'AC JRNL-1168|TC JRNL-1148: Selecting a List Value' do
it "Focus on first item and can navigate through list", :broken => true do
setTypeaheadField( "cat")
!2.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
selectionList = getSelectList()
selectListCount = getSelectListCount()
for i in 0...selectListCount
for j in 0...selectListCount
if i == j
expect(selectionList[j].attribute("class")).to eq("ng-scope active")
else
expect(selectionList[j].attribute("class")).to eq("ng-scope")
end
end
typeaheadField.send_keys(:arrow_down)
sleep 0.5
end
end
it "Select term", :broken => true do
#Wraparound to last selection
typeaheadField().send_keys(:arrow_up)
sleep 0.5
currentlyHighlighted = getSelectListText[getSelectListCount()-1].strip
typeaheadField.send_keys(:return)
sleep 0.5
expect(@surgeries.getNameOfSurgery().strip).to eq(currentlyHighlighted)
end
it "Move to next field of focus", :broken => true do
expect(getActiveElement().attribute("name")).to eq("surgery")
typeaheadField.send_keys(:tab)
sleep 0.5
#Check focus is on next field
expect(getActiveElement().attribute("name")).to eq("date")
end
it "SNOMED info stored", :broken => true do
@surgeries.setDateOfSurgeryProcedure(getDateNthDaysFromNow(0, '%m/%d/%Y'))
name = @surgeries.getNameOfSurgery().strip
@surgeries.clickSaveButton()
waitForPageToFinishLoading()
sleep 4.0
coding = getSNOMEDInfo("surgeries", "medicalhistorydb", "", name)
expect(coding[0]["system"]).to eq("http://snomed.info/sct")
expect(coding[0]["code"]).to eq("67629009")
expect(coding[0]["display"]).to eq("Heart Catheterization")
expect(coding[0]["version"]).to eq("20140931-US")
end
end
context 'AC JRNL-1167|TC JRNL-1148: Entering a Verbatim Term' do
it "No match", :broken => true do
@common.clickAddButton()
waitForPageToFinishLoading()
setTypeaheadField("asparx")
!2.times{ break if (isElementVisible(:css, getSelectListCSS())); sleep 1 }
expect(isElementVisible(:css, getSelectListCSS())).to eq(false)
end
it "Shift focus", :broken => true do
setTypeaheadField(@char100)
expect(getActiveElement().attribute("name")).to eq("surgery")
typeaheadField.send_keys(:tab)
sleep 0.5
#Check focus is on next field
expect(getActiveElement().attribute("name")).to eq("date")
end
it "Value Retained" do
expect(@surgeries.getNameOfSurgery()).to eq(@char100)
end
it "Save - Verbatim term - SNOMED info not stored" do
@surgeries.setDateOfSurgeryProcedure(getDateNthDaysFromNow(0, '%m/%d/%Y'))
@surgeries.clickSaveButton()
waitForPageToFinishLoading()
sleep 4.0
coding = getSNOMEDInfo('surgeries', "medicalhistorydb", "", @char100)
expect(coding).to eq([])
end
end
end