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
907802c9
Commit
907802c9
authored
4 years ago
by
Moss
Browse files
Options
Downloads
Patches
Plain Diff
Fixed Selenium tests in EditApptPatientTest.java that were failing
parent
c456bcba
No related branches found
No related tags found
1 merge request
!10
UC100 (UC New)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
iTrust/test/edu/ncsu/csc/itrust/selenium/EditApptPatientTest.java
+70
-42
70 additions, 42 deletions
...est/edu/ncsu/csc/itrust/selenium/EditApptPatientTest.java
with
70 additions
and
42 deletions
iTrust/test/edu/ncsu/csc/itrust/selenium/EditApptPatientTest.java
+
70
−
42
View file @
907802c9
package
edu.ncsu.csc.itrust.selenium
;
package
edu.ncsu.csc.itrust.selenium
;
import
java.util.List
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
import
org.junit.*
;
import
org.junit.*
;
...
@@ -9,70 +8,99 @@ import org.openqa.selenium.htmlunit.HtmlUnitDriver;
...
@@ -9,70 +8,99 @@ import org.openqa.selenium.htmlunit.HtmlUnitDriver;
import
edu.ncsu.csc.itrust.enums.TransactionType
;
import
edu.ncsu.csc.itrust.enums.TransactionType
;
public
class
EditApptPatientTest
extends
iTrustSeleniumTest
{
public
class
EditApptPatientTest
extends
iTrustSeleniumTest
{
private
HtmlUnitDriver
driver
;
private
HtmlUnitDriver
driver
;
private
StringBuffer
verificationErrors
=
new
StringBuffer
();
private
StringBuffer
verificationErrors
=
new
StringBuffer
();
@Before
@Before
public
void
setUp
()
throws
Exception
{
public
void
setUp
()
throws
Exception
{
super
.
setUp
();
super
.
setUp
();
gen
.
clearAllTables
();
gen
.
clearAllTables
();
gen
.
standardData
();
gen
.
standardData
();
driver
=
new
HtmlUnitDriver
();
driver
=
new
HtmlUnitDriver
();
driver
.
manage
().
timeouts
().
implicitlyWait
(
5
,
TimeUnit
.
SECONDS
);
driver
.
manage
().
timeouts
().
implicitlyWait
(
5
,
TimeUnit
.
SECONDS
);
}
}
@Test
@Test
public
void
testSetPassedDate
()
throws
Exception
{
public
void
testSetPassedDate
()
throws
Exception
{
gen
.
uc22
();
gen
.
uc22
();
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
1
L
,
""
);
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
0
L
,
""
);
driver
.
findElements
(
By
.
tagName
(
"td"
)).
get
(
3
5
).
findElement
(
By
.
tagName
(
"a"
)).
click
();
driver
.
findElements
(
By
.
tagName
(
"td"
)).
get
(
5
).
findElement
(
By
.
tagName
(
"a"
)).
click
();
driver
.
findElement
(
By
.
name
(
"s
ched
Date"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"s
tart
Date"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"s
ched
Date"
)).
sendKeys
(
"10/10/2009"
);
driver
.
findElement
(
By
.
name
(
"s
tart
Date"
)).
sendKeys
(
"10/10/2009"
);
driver
.
findElement
(
By
.
id
(
"changeButton
"
)).
click
();
driver
.
findElement
(
By
.
name
(
"request
"
)).
click
();
assertTrue
(
driver
.
getPageSource
().
contains
(
"The scheduled date of this appointment"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"The scheduled date of this appointment"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"has already passed"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"has already passed"
));
assertNotLogged
(
TransactionType
.
APPOINTMENT_EDIT
,
1L
,
100L
,
""
);
assertNotLogged
(
TransactionType
.
APPOINTMENT_EDIT
,
1L
,
100L
,
""
);
}
}
@Test
@Test
public
void
testRemoveAppt
()
throws
Exception
{
public
void
testRemoveAppt
()
throws
Exception
{
gen
.
uc22
();
gen
.
uc22
();
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
1
L
,
""
);
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
0
L
,
""
);
driver
.
findElements
(
By
.
tagName
(
"td"
)).
get
(
23
).
findElement
(
By
.
tagName
(
"a"
)).
click
();
driver
.
findElements
(
By
.
tagName
(
"td"
)).
get
(
7
).
findElement
(
By
.
tagName
(
"a"
)).
click
();
driver
.
findElement
(
By
.
id
(
"removeButton"
)).
click
();
driver
.
findElement
(
By
.
id
(
"removeButton"
)).
click
();
assertTrue
(
driver
.
getPageSource
().
contains
(
"Success: Appointment removed"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"Success: Appointment removed"
));
assertLoggedNoSecondary
(
TransactionType
.
APPOINTMENT_REMOVE
,
1L
,
1
L
,
""
);
assertLoggedNoSecondary
(
TransactionType
.
APPOINTMENT_REMOVE
,
1L
,
0
L
,
""
);
}
}
@Test
public
void
testConflictingDate
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
0L
,
""
);
driver
.
findElements
(
By
.
tagName
(
"td"
)).
get
(
5
).
findElement
(
By
.
tagName
(
"a"
)).
click
();
assertEquals
(
"iTrust - Appointment Requests"
,
driver
.
getTitle
());
assertTrue
(
driver
.
getPageSource
().
contains
(
"Kelly Doctor"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"Consultation"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"11/26/2020"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"09"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"10"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"AM"
));
driver
.
findElement
(
By
.
name
(
"comment"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"comment"
)).
sendKeys
(
"New comment!"
);
driver
.
findElement
(
By
.
name
(
"request"
)).
click
();
assertTrue
(
driver
.
getPageSource
()
.
contains
(
"ERROR: The appointment you requested conflicts with other existing appointments"
));
driver
.
findElements
(
By
.
tagName
(
"input"
)).
get
(
7
).
click
();
assertTrue
(
driver
.
getPageSource
().
contains
(
"Your appointment request has been saved and is pending"
));
assertLogged
(
TransactionType
.
APPOINTMENT_REQUEST_SUBMITTED
,
1L
,
9000000000L
,
""
);
}
@Test
@Test
public
void
testEditAppt
()
throws
Exception
{
public
void
testEditAppt
()
throws
Exception
{
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
=
(
HtmlUnitDriver
)
login
(
"1"
,
"pw"
);
driver
.
setJavascriptEnabled
(
true
);
driver
.
setJavascriptEnabled
(
true
);
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
assertEquals
(
"iTrust - Patient Home"
,
driver
.
getTitle
());
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
driver
.
findElement
(
By
.
linkText
(
"View/Edit My Appointments"
)).
click
();
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
1L
,
""
);
assertLogged
(
TransactionType
.
APPOINTMENT_ALL_VIEW
,
1L
,
0L
,
""
);
List
<
WebElement
>
rows
=
driver
.
findElements
(
By
.
tagName
(
"td"
));
driver
.
findElements
(
By
.
tagName
(
"td"
)).
get
(
5
).
findElement
(
By
.
tagName
(
"a"
)).
click
();
//should be the last one
assertEquals
(
"iTrust - Appointment Requests"
,
driver
.
getTitle
());
WebElement
mine
=
rows
.
get
(
rows
.
size
()
-
1
);
assertTrue
(
driver
.
getPageSource
().
contains
(
"Kelly Doctor"
));
mine
.
findElement
(
By
.
tagName
(
"a"
)).
click
();
assertTrue
(
driver
.
getPageSource
().
contains
(
"Consultation"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"Andy Programmer"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"11/26/2020"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"09"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"10"
));
assertTrue
(
driver
.
getPageSource
().
contains
(
"AM"
));
driver
.
findElement
(
By
.
name
(
"comment"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"comment"
)).
clear
();
driver
.
findElement
(
By
.
name
(
"comment"
)).
sendKeys
(
"New comment!"
);
driver
.
findElement
(
By
.
name
(
"comment"
)).
sendKeys
(
"New comment!"
);
driver
.
findElement
(
By
.
id
(
"changeButton"
)).
click
();
driver
.
findElement
(
By
.
name
(
"startDate"
)).
clear
();
assertTrue
(
driver
.
getPageSource
().
contains
(
"Success: Appointment changed"
));
driver
.
findElement
(
By
.
name
(
"startDate"
)).
sendKeys
(
"12/20/2021"
);
assertLogged
(
TransactionType
.
APPOINTMENT_EDIT
,
1L
,
2L
,
""
);
driver
.
findElement
(
By
.
name
(
"request"
)).
click
();
assertTrue
(
driver
.
getPageSource
().
contains
(
"Your appointment request has been saved and is pending"
));
assertLogged
(
TransactionType
.
APPOINTMENT_REQUEST_SUBMITTED
,
1L
,
9000000000L
,
""
);
}
}
@After
@After
public
void
tearDown
()
throws
Exception
{
public
void
tearDown
()
throws
Exception
{
driver
.
quit
();
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