Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
idatt2106_2024_02_frontend
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
IDATT2106 - Gruppe 2
idatt2106_2024_02_frontend
Commits
b2fee6fe
Commit
b2fee6fe
authored
11 months ago
by
Valdemar Åstorp Beere
Browse files
Options
Downloads
Patches
Plain Diff
test(homepage):
Add more e2e tests to homeView.cy.ts
parent
a8db2693
No related branches found
No related tags found
3 merge requests
!66
Final merge
,
!32
refactor(component):
,
!4
Pipeline fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cypress/e2e/homeView.cy.ts
+95
-0
95 additions, 0 deletions
cypress/e2e/homeView.cy.ts
with
95 additions
and
0 deletions
cypress/e2e/
savingsPath
.cy.ts
→
cypress/e2e/
homeView
.cy.ts
+
95
−
0
View file @
b2fee6fe
...
@@ -41,4 +41,55 @@ describe('Goals and Challenges Page Load', () => {
...
@@ -41,4 +41,55 @@ describe('Goals and Challenges Page Load', () => {
cy
.
get
(
'
[data-cy=goal-title]
'
).
should
(
'
exist
'
).
and
(
'
contain
'
,
'
gaming
'
);
cy
.
get
(
'
[data-cy=goal-title]
'
).
should
(
'
exist
'
).
and
(
'
contain
'
,
'
gaming
'
);
cy
.
get
(
'
[data-cy=challenge-title]
'
).
should
(
'
exist
'
).
and
(
'
contain
'
,
'
Coffee Challenge
'
);
cy
.
get
(
'
[data-cy=challenge-title]
'
).
should
(
'
exist
'
).
and
(
'
contain
'
,
'
Coffee Challenge
'
);
});
});
it
(
'
Should increment a challenges progress when the increment button is clicked
'
,
()
=>
{
cy
.
wait
(
'
@fetchChallenges
'
);
// Separate aliases for clarity
cy
.
intercept
(
'
PUT
'
,
'
/users/me/challenges/1
'
,
{
statusCode
:
200
,
body
:
{
id
:
1
,
title
:
'
Coffee Challenge
'
,
type
:
'
coffee
'
,
perPurchase
:
20
,
saved
:
80
,
// this is the updated amount
target
:
100
,
completion
:
80
,
},
}).
as
(
'
incrementChallenge1
'
);
cy
.
intercept
(
'
PUT
'
,
'
/users/me/goals/1
'
,
{
statusCode
:
200
,
body
:
{
id
:
1
,
title
:
'
gaming
'
,
saved
:
170
,
target
:
1000
,
completion
:
15
},
}).
as
(
'
incrementChallenge
'
);
// Mock the POST request for renewing the token if it's not implemented in the backend
cy
.
intercept
(
'
POST
'
,
'
/auth/renewToken
'
,
{
statusCode
:
200
,
body
:
{
accessToken
:
'
newlyRenewedAccessToken
'
}
}).
as
(
'
renewToken
'
);
cy
.
get
(
'
[data-cy=increment-challenge1]
'
).
click
();
cy
.
wait
(
'
@incrementChallenge1
'
);
// Wait for the specific challenge update intercept
// Check if the progress bar reflects the right percentage
cy
.
get
(
'
[data-cy=challenge-progress]
'
)
.
invoke
(
'
attr
'
,
'
style
'
)
.
should
(
'
contain
'
,
'
width: 80%
'
);
// Directly check the style attribute for the width
});
it
(
'
Should navigate to the spare challenges page when adding a new challenge
'
,
()
=>
{
// Mock the routing to the spare challenges page
cy
.
intercept
(
'
GET
'
,
'
/spareutfordringer
'
,
{
statusCode
:
200
,
body
:
{
content
:
'
Spare Challenges Page
'
}
}).
as
(
'
spareChallenges
'
);
// Trigger the route change
cy
.
get
(
'
[data-cy=challenge-icon-1]
'
).
click
();
// Assert that navigation has occurred
cy
.
url
().
should
(
'
include
'
,
'
/spareutfordringer/1
'
);
});
});
});
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