Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tdt4242-base
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
Container 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
Håvard Farestveit
tdt4242-base
Merge requests
!6
added functional system test for our new facilities
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
added functional system test for our new facilities
functional_testing
into
master
Overview
0
Commits
1
Pipelines
1
Changes
1
Merged
Olav Håberg Dimmen
requested to merge
functional_testing
into
master
4 years ago
Overview
0
Commits
1
Pipelines
1
Changes
1
Expand
0
0
Merge request reports
Compare
master
master (base)
and
latest version
latest version
7136ca51
1 commit,
4 years ago
1 file
+
47
−
7
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
frontend/cypress/integration/functionality.js
+
47
−
7
Options
@@ -10,18 +10,58 @@ describe('Functionality', () => {
Cypress
.
Cookies
.
preserveOnce
(
"
access
"
,
"
refresh
"
,
"
sessionid
"
)
})
// Checks the frontend loading of facilities depending on whether the facilities table is populated
it
(
'
creating a facility
'
,
()
=>
{
cy
.
visit
(
'
admin/facilities/facility/add/
'
)
cy
.
get
(
'
#facility_form
'
).
within
((
$form
)
=>
{
cy
.
fixture
(
"
auth.json
"
).
then
((
users
)
=>
{
cy
.
get
(
'
input[name="name"]
'
).
type
(
users
.
testfacility
.
name
+
Date
.
now
())
// Simulates a mock facility's lifecycle
// Does creation, front-end validation, and deletion
it
(
'
facility lifecycle
'
,
()
=>
{
// Using data from the following JSON file
cy
.
fixture
(
"
auth.json
"
).
then
((
users
)
=>
{
// Creates a facility using preset data
cy
.
visit
(
'
admin/facilities/facility/add/
'
)
cy
.
get
(
'
#facility_form
'
).
within
((
$form
)
=>
{
cy
.
get
(
'
input[name="name"]
'
).
type
(
users
.
testfacility
.
name
)
cy
.
get
(
'
input[name="date"]
'
).
type
(
users
.
testfacility
.
date
)
cy
.
get
(
'
textarea[name="description"]
'
).
type
(
users
.
testfacility
.
description
)
cy
.
get
(
'
input[name="latitude"]
'
).
type
(
users
.
testfacility
.
latitude
)
cy
.
get
(
'
input[name="longitude"]
'
).
type
(
users
.
testfacility
.
longitude
)
//cy.get('input[name="image1"]').type(users.testfacility.url)
cy
.
get
(
'
input[name="image1"]
'
).
type
(
users
.
testfacility
.
url
)
cy
.
get
(
'
input[value=Save]
'
).
click
()
})
// Get the new facility's id from the table
cy
.
visit
(
'
/admin/facilities/facility/
'
).
then
(()
=>
{
cy
.
get
(
'
#changelist-form
'
).
within
((
$listform
)
=>
{
cy
.
get
(
'
a
'
).
contains
(
users
.
testfacility
.
name
).
then
((
item
)
=>
{
// Get the id so we can visit the facility in the proper webpage
const
id
=
item
[
0
].
href
.
split
(
'
/change/
'
)[
0
].
split
(
'
/facility/
'
)[
1
]
cy
.
visit
(
'
/facility.html?id=
'
+
id
)
})
})
})
// Viewing the facility as a customer
cy
.
location
().
should
((
loc
)
=>
{
expect
(
loc
.
pathname
.
includes
(
'
facility.html?id=
'
))
})
// Check that name corresponds to inserted name
cy
.
get
(
'
h3
'
).
should
(
'
exist
'
)
cy
.
get
(
'
h3
'
).
invoke
(
'
text
'
).
should
(
'
eq
'
,
users
.
testfacility
.
name
)
// Going back to the django admin page, and cleaning up by deleting the facility
cy
.
visit
(
'
/admin/facilities/facility/
'
).
then
(()
=>
{
cy
.
get
(
'
#changelist-form
'
).
within
((
$listform
)
=>
{
// Go to the change page for the new facility
cy
.
get
(
'
a
'
).
contains
(
users
.
testfacility
.
name
).
click
()
// Go to the deletion url by swapping /change/ with /delete/
cy
.
url
().
should
(
'
include
'
,
'
/change/
'
)
cy
.
url
().
then
((
url
)
=>
{
cy
.
visit
(
url
.
split
(
'
change
'
)[
0
]
+
'
delete/
'
)
})
})
})
// Confirming the deletion
cy
.
get
(
'
input[type="submit"]
'
).
should
(
'
exist
'
).
click
()
})
})
})
\ No newline at end of file
Loading