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
2bfbd0cd
Commit
2bfbd0cd
authored
4 years ago
by
Moss
Browse files
Options
Downloads
Patches
Plain Diff
[testing] added more selenium tests in ViewTransactionLogsTest.java
parent
daf40134
No related branches found
Branches containing commit
No related tags found
1 merge request
!21
UC39
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/test/edu/ncsu/csc/itrust/selenium/ViewTransactionLogsTest.java
+162
-0
162 additions, 0 deletions
...edu/ncsu/csc/itrust/selenium/ViewTransactionLogsTest.java
with
162 additions
and
0 deletions
iTrust/test/edu/ncsu/csc/itrust/selenium/ViewTransactionLogsTest.java
+
162
−
0
View file @
2bfbd0cd
...
...
@@ -3,6 +3,7 @@ package edu.ncsu.csc.itrust.selenium;
import
java.util.concurrent.TimeUnit
;
import
org.junit.*
;
import
org.openqa.selenium.*
;
import
org.openqa.selenium.support.ui.Select
;
import
org.openqa.selenium.htmlunit.HtmlUnitDriver
;
public
class
ViewTransactionLogsTest
extends
iTrustSeleniumTest
{
...
...
@@ -36,6 +37,167 @@ public class ViewTransactionLogsTest extends iTrustSeleniumTest {
assertEquals
(
"iTrust - View Transaction Logs"
,
driver
.
getTitle
());
}
@Test
public
void
testAdminRegular
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9000000001"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Admin Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View Transaction Logs"
)).
click
();
assertEquals
(
"iTrust - View Transaction Logs"
,
driver
.
getTitle
());
//fill form
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"05/10/2009"
);
driver
.
findElement
(
By
.
name
(
"endDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"endDate"
)).
sendKeys
(
"10/10/2021"
);
Select
select
;
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"mainRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"secondRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"transactionType"
)));
select
.
selectByValue
(
"All"
);
//click button
driver
.
findElement
(
By
.
id
(
"viewReport"
)).
click
();
//check to see if page shows info past 2009
assertTrue
(
driver
.
getPageSource
().
contains
(
"EMERGENCY_REPORT_VIEW"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"Patient added to monitoring list"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"2011-06-24 06:54:59.0"
));
//check to see pages does not show info before 2009
assertFalse
(
driver
.
getPageSource
().
contains
(
"Identified risk factors of chronic diseases"
));
assertFalse
(
driver
.
getPageSource
().
contains
(
"2008-06-15 13:15:00.0"
));
}
@Test
public
void
testTesterRegular
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9999999999"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Tester Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View Transaction Logs"
)).
click
();
assertEquals
(
"iTrust - View Transaction Logs"
,
driver
.
getTitle
());
//fill form
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"05/10/2009"
);
driver
.
findElement
(
By
.
name
(
"endDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"endDate"
)).
sendKeys
(
"10/10/2021"
);
Select
select
;
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"mainRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"secondRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"transactionType"
)));
select
.
selectByValue
(
"All"
);
//click button
driver
.
findElement
(
By
.
id
(
"viewReport"
)).
click
();
//check to see if page shows info past 2009
assertTrue
(
driver
.
getPageSource
().
contains
(
"EMERGENCY_REPORT_VIEW"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"Patient added to monitoring list"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"2011-06-24 06:54:59.0"
));
//check to see pages does not show info before 2009
assertFalse
(
driver
.
getPageSource
().
contains
(
"Identified risk factors of chronic diseases"
));
assertFalse
(
driver
.
getPageSource
().
contains
(
"2008-06-15 13:15:00.0"
));
}
@Test
public
void
testAdminSelectMainRole
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9000000001"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Admin Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View Transaction Logs"
)).
click
();
assertEquals
(
"iTrust - View Transaction Logs"
,
driver
.
getTitle
());
//fill form
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"05/10/2000"
);
driver
.
findElement
(
By
.
name
(
"endDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"endDate"
)).
sendKeys
(
"10/10/2021"
);
Select
select
;
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"mainRole"
)));
select
.
selectByValue
(
"hcp"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"secondRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"transactionType"
)));
select
.
selectByValue
(
"All"
);
//click button
driver
.
findElement
(
By
.
id
(
"viewReport"
)).
click
();
//check to see if first five rows are only hcp
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
0
).
findElement
(
By
.
id
(
"mainTD"
)).
getText
().
contains
(
"hcp"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
1
).
findElement
(
By
.
id
(
"mainTD"
)).
getText
().
contains
(
"hcp"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
2
).
findElement
(
By
.
id
(
"mainTD"
)).
getText
().
contains
(
"hcp"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
3
).
findElement
(
By
.
id
(
"mainTD"
)).
getText
().
contains
(
"hcp"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
4
).
findElement
(
By
.
id
(
"mainTD"
)).
getText
().
contains
(
"hcp"
));
}
@Test
public
void
testAdminSelectSecondaryRole
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9000000001"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Admin Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View Transaction Logs"
)).
click
();
assertEquals
(
"iTrust - View Transaction Logs"
,
driver
.
getTitle
());
//fill form
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"05/10/2000"
);
driver
.
findElement
(
By
.
name
(
"endDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"endDate"
)).
sendKeys
(
"10/10/2021"
);
Select
select
;
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"mainRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"secondRole"
)));
select
.
selectByValue
(
"patient"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"transactionType"
)));
select
.
selectByValue
(
"All"
);
//click button
driver
.
findElement
(
By
.
id
(
"viewReport"
)).
click
();
//check to see if first five rows are only patient
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
0
).
findElement
(
By
.
id
(
"secondTD"
)).
getText
().
contains
(
"patient"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
1
).
findElement
(
By
.
id
(
"secondTD"
)).
getText
().
contains
(
"patient"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
2
).
findElement
(
By
.
id
(
"secondTD"
)).
getText
().
contains
(
"patient"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
3
).
findElement
(
By
.
id
(
"secondTD"
)).
getText
().
contains
(
"patient"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
4
).
findElement
(
By
.
id
(
"secondTD"
)).
getText
().
contains
(
"patient"
));
}
@Test
public
void
testAdminSelectType
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"9000000001"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Admin Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View Transaction Logs"
)).
click
();
assertEquals
(
"iTrust - View Transaction Logs"
,
driver
.
getTitle
());
//fill form
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"05/10/2000"
);
driver
.
findElement
(
By
.
name
(
"endDate"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"endDate"
)).
sendKeys
(
"10/10/2021"
);
Select
select
;
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"mainRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"secondRole"
)));
select
.
selectByValue
(
"All"
);
select
=
new
Select
(
driver
.
findElement
(
By
.
name
(
"transactionType"
)));
select
.
selectByValue
(
"EMERGENCY_REPORT_VIEW"
);
//click button
driver
.
findElement
(
By
.
id
(
"viewReport"
)).
click
();
//check to see if first two rows are only EMERGENCY_REPORT_VIEW
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
0
).
findElement
(
By
.
id
(
"typeTD"
)).
getText
().
contains
(
"EMERGENCY_REPORT_VIEW"
));
assertTrue
(
driver
.
findElements
(
By
.
id
(
"resultRow"
)).
get
(
1
).
findElement
(
By
.
id
(
"typeTD"
)).
getText
().
contains
(
"EMERGENCY_REPORT_VIEW"
));
}
@After
public
void
tearDown
()
throws
Exception
{
driver
.
quit
();
...
...
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