Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
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-2024-07
frontend
Commits
bf052448
Commit
bf052448
authored
10 months ago
by
heikkkk
Browse files
Options
Downloads
Patches
Plain Diff
test: add e2e tests for navigating menu bar
parent
9f2c00d0
No related branches found
Branches containing commit
No related tags found
1 merge request
!58
Test/e2e menu bar
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cypress/e2e/BasePage/BasePageView.cy.ts
+67
-0
67 additions, 0 deletions
cypress/e2e/BasePage/BasePageView.cy.ts
src/components/BaseComponents/Menu.vue
+21
-11
21 additions, 11 deletions
src/components/BaseComponents/Menu.vue
src/views/BasePageView.vue
+1
-1
1 addition, 1 deletion
src/views/BasePageView.vue
with
89 additions
and
12 deletions
cypress/e2e/BasePage/BasePageView.cy.ts
0 → 100644
+
67
−
0
View file @
bf052448
describe
(
'
BasePage test
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
visit
(
'
/login
'
);
cy
.
get
(
'
#emailInput input
'
).
type
(
'
user@example.com
'
);
cy
.
get
(
'
#passwordInput input
'
).
type
(
'
John1
'
);
cy
.
get
(
'
form
'
).
submit
();
cy
.
wait
(
1000
);
cy
.
visit
(
'
/
'
)
});
it
(
'
uses menu to visit leaderboard
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="leaderboard"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/leaderboard
'
);
});
it
(
'
uses menu to visit news
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="news"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/news
'
);
});
it
(
'
uses menu to visit store
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="store"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/shop
'
);
});
it
(
'
uses menu to visit roadmap
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="savingGoals"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/roadmap
'
);
});
it
(
'
uses menu to visit user profile
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="user"]
'
).
click
();
cy
.
get
(
'
[data-cy="profile"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/profile
'
);
});
it
(
'
uses menu to visit budget
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="user"]
'
).
click
();
cy
.
get
(
'
[data-cy="budget"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/budget
'
);
});
it
(
'
uses menu to visit friends
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="user"]
'
).
click
();
cy
.
get
(
'
[data-cy="friends"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/friends
'
);
});
it
(
'
uses menu to visit settings
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="user"]
'
).
click
();
cy
.
get
(
'
[data-cy="settings"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/settings
'
);
});
it
(
'
uses menu to visit feedback
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="user"]
'
).
click
();
cy
.
get
(
'
[data-cy="feedback"]
'
).
click
();
cy
.
url
().
should
(
'
include
'
,
'
/feedback
'
);
});
it
(
'
uses menu to log out
'
,
()
=>
{
cy
.
get
(
'
[data-cy="menu"]
'
).
get
(
'
[data-cy="user"]
'
).
click
();
cy
.
get
(
'
[data-testid="logout"]
'
).
click
();
cy
.
wait
(
1000
);
cy
.
url
().
should
(
'
include
'
,
'
/login
'
);
});
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/components/BaseComponents/Menu.vue
+
21
−
11
View file @
bf052448
...
@@ -13,37 +13,47 @@
...
@@ -13,37 +13,47 @@
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<div
class=
"collapse navbar-collapse"
id=
"navbarSupportedContent"
>
<ul
class=
"navbar-nav ms-auto mb-2 mb-lg-0 ui-menu"
>
<ul
class=
"navbar-nav ms-auto mb-2 mb-lg-0 ui-menu"
>
<li
class=
"nav-item"
>
<li
class=
"nav-item"
>
<router-link
class=
"nav-link text-white"
:to=
"toSavingGoals()"
><img
<router-link
data-cy=
"savingGoals"
class=
"nav-link text-white"
:to=
"toSavingGoals()"
><img
src=
"@/assets/icons/saving.svg"
>
Saving goals
</router-link>
src=
"@/assets/icons/saving.svg"
>
Saving goals
</router-link>
</li>
</li>
<li
class=
"nav-item"
>
<li
class=
"nav-item"
>
<router-link
class=
"nav-link text-white"
:to=
"toLeaderboard()"
><img
<router-link
data-cy=
"leaderboard"
class=
"nav-link text-white"
:to=
"toLeaderboard()"
><img
src=
"@/assets/icons/leaderboard.svg"
>
Leaderboard
</router-link>
src=
"@/assets/icons/leaderboard.svg"
>
Leaderboard
</router-link>
</li>
</li>
<li
class=
"nav-item"
>
<li
class=
"nav-item"
>
<router-link
class=
"nav-link text-white"
:to=
"toNews()"
><img
<router-link
data-cy=
"news"
class=
"nav-link text-white"
:to=
"toNews()"
><img
src=
"@/assets/icons/newsletter.svg"
>
News
</router-link>
src=
"@/assets/icons/newsletter.svg"
>
News
</router-link>
</li>
</li>
<li
class=
"nav-item"
>
<li
class=
"nav-item"
>
<router-link
class=
"nav-link text-white"
:to=
"toStore()"
><img
<router-link
data-cy=
"store"
class=
"nav-link text-white"
:to=
"toStore()"
><img
src=
"@/assets/icons/storefront.svg"
>
Store
</router-link>
src=
"@/assets/icons/storefront.svg"
>
Store
</router-link>
</li>
</li>
<li
v-if=
"userStore.isLoggedIn"
class=
"nav-item dropdown"
>
<li
v-if=
"userStore.isLoggedIn"
class=
"nav-item dropdown"
>
<a
class=
"nav-link dropdown-toggle username-text text-white "
href=
"#"
role=
"button"
<a
data-cy=
"user"
class=
"nav-link dropdown-toggle username-text text-white "
href=
"#"
role=
"button"
data-bs-toggle=
"dropdown"
aria-expanded=
"false"
>
data-bs-toggle=
"dropdown"
aria-expanded=
"false"
>
<img
src=
"@/assets/icons/person.svg"
>
{{
useUserInfoStore
().
firstname
}}
<img
src=
"@/assets/icons/person.svg"
>
{{
useUserInfoStore
().
firstname
}}
</a>
</a>
<ul
class=
"dropdown-menu dropdown-username-content"
>
<ul
class=
"dropdown-menu dropdown-username-content"
>
<li><router-link
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toUserProfile()"
><img
<li><router-link
data-cy=
"profile"
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toUserProfile()"
><img
src=
"@/assets/icons/person.svg"
>
User Profile
</router-link></li>
src=
"@/assets/icons/person.svg"
>
User Profile
</router-link></li>
<li><router-link
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toBudget()"
><img>
Budget
</router-link></li>
<li><router-link
data-cy=
"budget"
<li><router-link
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toFriends()"
><img
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toBudget()"
><img>
Budget
</router-link></li>
<li><router-link
data-cy=
"friends"
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toFriends()"
><img
src=
"@/assets/icons/friends.svg"
>
Friends
</router-link></li>
src=
"@/assets/icons/friends.svg"
>
Friends
</router-link></li>
<li><router-link
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toSetting()"
><img
<li><router-link
data-cy=
"settings"
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toSetting()"
><img
src=
"@/assets/icons/settings.svg"
>
Settings
</router-link></li>
src=
"@/assets/icons/settings.svg"
>
Settings
</router-link></li>
<li><router-link
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toFeedback()"
><img
<li><router-link
data-cy=
"feedback"
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toFeedback()"
><img
src=
"@/assets/icons/feedback.svg"
>
Feedback
</router-link></li>
src=
"@/assets/icons/feedback.svg"
>
Feedback
</router-link></li>
<li><router-link
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toSetting()"
><img
<li><router-link
data-cy=
"admin"
class=
"dropdown-item text-white dropdown-username-link"
:to=
"toSetting()"
><img
src=
"@/assets/icons/admin.svg"
>
Admin
</router-link></li>
src=
"@/assets/icons/admin.svg"
>
Admin
</router-link></li>
<li><a
data-testid=
"logout"
class=
"dropdown-item text-white dropdown-username-link"
ref=
"#"
@
click=
"toLogout()"
><img
<li><a
data-testid=
"logout"
class=
"dropdown-item text-white dropdown-username-link"
ref=
"#"
@
click=
"toLogout()"
><img
src=
"@/assets/icons/logout.svg"
>
Log out
</a></li>
src=
"@/assets/icons/logout.svg"
>
Log out
</a></li>
...
...
This diff is collapsed.
Click to expand it.
src/views/BasePageView.vue
+
1
−
1
View file @
bf052448
...
@@ -7,7 +7,7 @@ import FooterAlternative from "@/components/BaseComponents/FooterAlternative.vue
...
@@ -7,7 +7,7 @@ import FooterAlternative from "@/components/BaseComponents/FooterAlternative.vue
<
template
>
<
template
>
<Menu></Menu>
<Menu
data-cy=
"menu"
></Menu>
<div
style=
"display: flex; flex-direction: row;"
>
<div
style=
"display: flex; flex-direction: row;"
>
<img
v-for=
"item in 7"
src=
"@/assets/coca.webp"
style=
"width: 100%; height: 100px; margin: 5px; border-radius: 1rem;"
alt=
"picture"
>
<img
v-for=
"item in 7"
src=
"@/assets/coca.webp"
style=
"width: 100%; height: 100px; margin: 5px; border-radius: 1rem;"
alt=
"picture"
>
</div>
</div>
...
...
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