Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tdt4242-ex2
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
0
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
Jørgen Hollum
tdt4242-ex2
Commits
e5b094be
Commit
e5b094be
authored
2 years ago
by
hollum
Browse files
Options
Downloads
Patches
Plain Diff
integration tests on goal
parent
b6e53fd9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#164092
passed with stage
in 29 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
frontend/cypress/integration/goals.spec.js
+49
-0
49 additions, 0 deletions
frontend/cypress/integration/goals.spec.js
frontend/cypress/support/index.js
+1
-4
1 addition, 4 deletions
frontend/cypress/support/index.js
frontend/www/scripts/goal.js
+1
-0
1 addition, 0 deletions
frontend/www/scripts/goal.js
with
51 additions
and
4 deletions
frontend/cypress/integration/goals.spec.js
0 → 100644
+
49
−
0
View file @
e5b094be
const
getDate
=
()
=>
{
let
d
=
new
Date
();
const
offset
=
d
.
getTimezoneOffset
();
d
=
new
Date
(
d
.
getTime
()
-
(
offset
*
60
*
1000
));
return
d
.
toISOString
().
split
(
'
T
'
)[
0
];
}
//
describe
(
'
Create goal
'
,
()
=>
{
it
(
'
Go to goals
'
,
function
()
{
this
.
login
(
this
.
athleteUser
)
cy
.
get
(
'
#nav-goals
'
).
click
()
cy
.
get
(
'
#btn-create-goal
'
).
click
()
cy
.
url
().
should
(
'
include
'
,
'
goal.html
'
)
cy
.
get
(
'
#inputName
'
,
{
timeout
:
10000
}).
type
(
"
GOAL_NAME
"
)
cy
.
get
(
'
#inputDescription
'
).
type
(
"
GOAL_DESCRIPTION
"
)
cy
.
get
(
'
#inputDateTime
'
)
.
click
()
.
then
(
input
=>
{
input
[
0
].
dispatchEvent
(
new
Event
(
'
input
'
,
{
bubbles
:
true
}))
input
.
val
(
'
2017-04-30T13:00
'
)
})
.
click
()
cy
.
intercept
({
method
:
'
POST
'
,
url
:
'
/api/goal/
'
}).
as
(
'
createRequest
'
)
cy
.
get
(
'
#btn-ok-goal
'
).
click
()
cy
.
wait
(
'
@createRequest
'
)
cy
.
url
().
should
(
'
include
'
,
'
goals.html
'
)
})
it
(
'
Edit goal
'
,
function
()
{
this
.
login
(
this
.
athleteUser
)
cy
.
get
(
'
#nav-goals
'
).
click
()
cy
.
get
(
'
.card-link
'
)
.
eq
(
0
).
click
()
cy
.
intercept
({
method
:
'
GET
'
,
url
:
'
/api/goal/2/
'
}).
as
(
'
createRequest
'
)
cy
.
wait
(
'
@createRequest
'
)
cy
.
intercept
({
method
:
'
DELETE
'
,
url
:
'
/api/goal/2/
'
}).
as
(
'
createRequest
'
)
cy
.
get
(
'
#btn-delete-goal
'
).
click
()
cy
.
wait
(
'
@createRequest
'
)
cy
.
url
().
should
(
'
include
'
,
'
goals.html
'
)
})
})
This diff is collapsed.
Click to expand it.
frontend/cypress/support/index.js
+
1
−
4
View file @
e5b094be
...
...
@@ -16,7 +16,6 @@
// Import commands.js using ES2015 syntax:
import
'
./commands
'
/*
var
coachUser
=
{
username
:
null
,
...
...
@@ -106,7 +105,7 @@ before(() => {
...
athleteUser
,
...
generateUser
()
}
registerUser(coachUser)
//
registerUser(coachUser)
registerUser
(
athleteUser
)
cy
.
visit
(
`
${
baseUrl
}
/index.html`
)
})
...
...
@@ -116,5 +115,3 @@ beforeEach(() => {
cy
.
wrap
(
athleteUser
).
as
(
'
athleteUser
'
)
cy
.
wrap
(
login
).
as
(
'
login
'
)
})
*/
This diff is collapsed.
Click to expand it.
frontend/www/scripts/goal.js
+
1
−
0
View file @
e5b094be
...
...
@@ -33,6 +33,7 @@ async function createGoal() {
async
function
deleteExercise
(
id
)
{
let
response
=
await
sendRequest
(
"
DELETE
"
,
`
${
HOST
}
/api/goal/
${
id
}
/`
);
console
.
log
(
`
${
HOST
}
/api/goal/
${
id
}
/`
)
if
(
!
response
.
ok
)
{
let
data
=
await
response
.
json
();
let
alert
=
createAlert
(
`Could not delete goal
${
id
}
`
,
data
);
...
...
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