Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cs427fa20team22
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
htmoss2
cs427fa20team22
Commits
b467550a
Commit
b467550a
authored
4 years ago
by
adityab3
Browse files
Options
Downloads
Patches
Plain Diff
[tests] Split error flow test into four individual tests
parent
ed8bd304
No related branches found
Branches containing commit
No related tags found
1 merge request
!18
UC14 [S2]: Detect Flu Epidemic
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/test/edu/ncsu/csc/itrust/selenium/ViewDiagnosisStatisticsTest.java
+40
-29
40 additions, 29 deletions
...ncsu/csc/itrust/selenium/ViewDiagnosisStatisticsTest.java
with
40 additions
and
29 deletions
iTrust/test/edu/ncsu/csc/itrust/selenium/ViewDiagnosisStatisticsTest.java
+
40
−
29
View file @
b467550a
...
...
@@ -559,50 +559,61 @@ public class ViewDiagnosisStatisticsTest extends iTrustSeleniumTest {
assertLogged
(
TransactionType
.
DIAGNOSIS_EPIDEMICS_VIEW
,
9000000007L
,
0L
,
""
);
assertTrue
(
driver
.
getPageSource
().
contains
(
"There is no epidemic occurring in the region."
));
}
p
ublic
void
testViewDiagnosisEpidemics_ErrorFlows
(
)
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9000000007"
,
"pw"
);
p
rivate
void
setupErrorFlow
(
String
icd
,
String
zip
,
String
date
,
String
threshold
)
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9000000007"
,
"pw"
);
// Click Diagnosis Trends
driver
.
findElement
(
By
.
cssSelector
(
"h2.panel-title"
)).
click
();
driver
.
findElement
(
By
.
xpath
(
"//div[@class='panel-body']/ul/li[11]"
)).
click
();
driver
.
findElement
(
By
.
linkText
(
"Diagnosis Trends"
)).
click
();
//
E
pidemics
//
Go to e
pidemics
assertTrue
(
driver
.
getCurrentUrl
().
equals
(
ADDRESS
+
"auth/hcp-pha/viewDiagnosisStatistics.jsp"
));
new
Select
(
driver
.
findElement
(
By
.
name
(
"viewSelect"
))).
selectByValue
(
"epidemics"
);
driver
.
findElement
(
By
.
id
(
"select_View"
)).
click
();
// No ICD code
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
sendKeys
(
"27607"
);
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"02/15/2010"
);
driver
.
findElement
(
By
.
name
(
"threshold"
)).
sendKeys
(
"110"
);
// Fill provided fields
if
(
icd
!=
null
)
{
new
Select
(
driver
.
findElement
(
By
.
name
(
"icdCode"
))).
selectByVisibleText
(
icd
);
}
if
(
zip
!=
null
)
{
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
sendKeys
(
zip
);
}
if
(
date
!=
null
)
{
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
date
);
}
if
(
threshold
!=
null
)
{
driver
.
findElement
(
By
.
name
(
"threshold"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"threshold"
)).
sendKeys
(
"110"
);
}
// Submit
driver
.
findElement
(
By
.
id
(
"select_diagnosis"
)).
click
();
}
public
void
testViewDiagnosisEpidemicsNoICD
()
throws
Exception
{
setupErrorFlow
(
null
,
"27607"
,
"02/15/2010"
,
"110"
);
assertTrue
(
driver
.
getPageSource
().
contains
(
"Invalid ICD code."
));
// Invalid zip
new
Select
(
driver
.
findElement
(
By
.
name
(
"icdCode"
))).
selectByVisibleText
(
"84.50 - Malaria"
);
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
sendKeys
(
"asdf"
);
driver
.
findElement
(
By
.
id
(
"select_diagnosis"
)).
click
();
}
public
void
testViewDiagnosisEpidemicsBadZip
()
throws
Exception
{
setupErrorFlow
(
"84.50 - Malaria"
,
"asdf"
,
"02/15/2010"
,
"110"
);
assertTrue
(
driver
.
getPageSource
().
contains
(
"Zip Code must be 5 digits!"
));
}
// Invalid date
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"asdf"
);
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"zipCode"
)).
sendKeys
(
"27607"
);
driver
.
findElement
(
By
.
id
(
"select_diagnosis"
)).
click
();
public
void
testViewDiagnosisEpidemicsInvalidDate
()
throws
Exception
{
setupErrorFlow
(
"84.50 - Malaria"
,
"12345"
,
"asdf"
,
"110"
);
assertTrue
(
driver
.
getPageSource
().
contains
(
"Enter dates in MM/dd/yyyy"
));
}
// Invalid threshold
driver
.
findElement
(
By
.
name
(
"threshold"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"threshold"
)).
sendKeys
(
"asdf"
);
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"02/15/2010"
);
driver
.
findElement
(
By
.
id
(
"select_diagnosis"
)).
click
();
public
void
testViewDiagnosisEpidemicsBadThreshold
()
throws
Exception
{
setupErrorFlow
(
"84.50 - Malaria"
,
"12345"
,
"02/15/2010"
,
"asdf"
);
assertTrue
(
driver
.
getPageSource
().
contains
(
"Threshold must be an integer."
));
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment