Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Dependency List
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
844
Issues
844
List
Boards
Labels
Service Desk
Milestones
Merge Requests
41
Merge Requests
41
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
a0b70491
Commit
a0b70491
authored
5 hours ago
by
Mark Harding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(feat): add e2e for cypress
parent
d675e05b
master
No related merge requests found
Pipeline
#74256546
running with stages
Changes
8
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
178 additions
and
138 deletions
+178
-138
.gitlab-ci.yml
.gitlab-ci.yml
+26
-3
blogs.spec.js
cypress/integration/blogs.spec.js
+8
-7
discovery.spec.js
cypress/integration/discovery.spec.js
+7
-4
groups.spec.js
cypress/integration/groups.spec.js
+8
-5
login.spec.js
cypress/integration/login.spec.js
+4
-3
newsfeed.spec.js
cypress/integration/newsfeed.spec.js
+10
-114
topbar.spec.js
cypress/integration/topbar.spec.js
+106
-0
commands.js
cypress/support/commands.js
+9
-2
No files found.
.gitlab-ci.yml
View file @
a0b70491
...
...
@@ -4,11 +4,12 @@ services:
-
docker:dind
stages
:
-
test
-
test
:unit
-
build
-
prepare
-
review
-
deploy:staging
-
test:e2e
-
deploy:canary
-
deploy:production
...
...
@@ -20,7 +21,7 @@ cache:
test
:
image
:
circleci/node:8-browsers
stage
:
test
stage
:
test
:unit
script
:
-
npm install
# Should be cached...
-
npm run test -- --no-watch --no-progress --browsers=ChromeHeadlessCI
...
...
@@ -30,6 +31,28 @@ test:
-
node_modules
policy
:
pull-push
e2e
:
image
:
cypress/base:10
stage
:
test:e2e
script
:
-
npm install
-
>
if [ "$CI_BUILD_REF_NAME" == "master" ]; then
export E2E_DOMAIN=https://www.minds.com
else
export E2E_DOMAIN=https://$CI_BUILD_REF_SLUG.$KUBE_INGRESS_BASE_DOMAIN
fi
-
export CYPRESS_baseUrl=$E2E_DOMAIN
-
echo "E2E tests for $CI_BUILD_REF_NAME running against $E2E_DOMAIN with user $CYPRESS_username"
-
$(npm bin)/cypress run --config CYPRESS_baseUrl=$E2E_DOMAIN
artifacts
:
when
:
always
paths
:
-
cypress/screenshots
-
cypress/videos
allow_failure
:
true
#manual inspection in case of timeouts
build:review
:
stage
:
build
script
:
...
...
@@ -180,7 +203,7 @@ staging:fpm:
-
build:production:i18n
environment
:
name
:
staging
url
:
https://www.minds.com
/?canary=1
# requires canary
cookie
url
:
https://www.minds.com
# requires staging
cookie
deploy:canary
:
stage
:
deploy:canary
...
...
This diff is collapsed.
Click to expand it.
cypress/integration/blogs.spec.js
View file @
a0b70491
...
...
@@ -2,8 +2,8 @@ context('Blogs', () => {
beforeEach
(()
=>
{
cy
.
login
(
true
);
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
`/newsfeed/subscriptions`
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
eq
'
,
`/newsfeed/subscriptions`
);
})
it
(
'
should not be able to create a new blog if no title or banner are specified
'
,
()
=>
{
...
...
@@ -46,7 +46,7 @@ context('Blogs', () => {
// click on hashtags dropdown
cy
.
get
(
'
.m-category-info m-hashtags-selector .m-dropdown--label-container
'
).
click
();
// select #ART
cy
.
get
(
'
.m-category-info m-dropdown m-form-tags-input > div
:nth-child(1)
> span
'
).
contains
(
'
#art
'
).
click
();
cy
.
get
(
'
.m-category-info m-dropdown m-form-tags-input > div > span
'
).
contains
(
'
#art
'
).
click
();
// type in another hashtag manually
cy
.
get
(
'
.m-category-info m-hashtags-selector m-form-tags-input input
'
).
type
(
'
hashtag{enter}
'
).
click
();
...
...
@@ -73,11 +73,12 @@ context('Blogs', () => {
cy
.
wait
(
1000
);
cy
.
get
(
'
.m-button--submit
'
).
click
(
);
cy
.
get
(
'
.m-button--submit
'
).
click
(
{
force
:
true
});
// TODO: Investigate why disabled flag is being detected
cy
.
wait
(
100
);
// Blogs will not save, nor return error, if a user doesn't have an avatar
cy
.
location
(
'
pathname
'
).
should
(
'
contains
'
,
`/
${
Cypress
.
env
().
username
}
/blog`
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
contains
'
,
`/
${
Cypress
.
env
().
username
}
/blog`
);
cy
.
get
(
'
.m-blog--title
'
).
contains
(
'
Title
'
);
cy
.
get
(
'
.minds-blog-body p
'
).
contains
(
'
Content
'
);
...
...
@@ -88,7 +89,7 @@ context('Blogs', () => {
//open dropdown
cy
.
get
(
'
m-post-menu button.minds-more
'
).
click
();
cy
.
get
(
'
m-post-menu ul.minds-dropdown-menu li
:nth-child(3)
'
).
contains
(
'
Delete
'
).
click
();
cy
.
get
(
'
m-post-menu ul.minds-dropdown-menu li
'
).
contains
(
'
Delete
'
).
click
();
cy
.
get
(
'
m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
})
...
...
This diff is collapsed.
Click to expand it.
cypress/integration/discovery.spec.js
View file @
a0b70491
context
(
'
Discovery
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
login
(
true
);
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
`/newsfeed/subscriptions`
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
eq
'
,
`/newsfeed/subscriptions`
);
});
it
(
'
should allow a user to post on the discovery page
'
,
()
=>
{
...
...
@@ -57,7 +59,6 @@ context('Discovery', () => {
.
click
()
.
should
(
'
have.css
'
,
'
color
'
,
'
rgb(70, 144, 223)
'
);
// selected color
cy
.
get
(
'
.m-newsfeed__entity .m-owner-block a > span:nth-child(1)
'
);
cy
.
url
().
should
(
'
include
'
,
'
/latest
'
);
});
...
...
@@ -116,10 +117,12 @@ context('Discovery', () => {
});
it
(
'
should allow the user to filter by a single hashtag
'
,
()
=>
{
cy
.
get
(
'
.m-hashtagsSidebarSelector__list > ul > li:nth-child(1) .m-hashtagsSidebarSelectorList__visibility > i
'
).
click
();
cy
.
get
(
'
.m-hashtagsSidebarSelector__list > ul > li:nth-child(1) .m-hashtagsSidebarSelectorList__visibility > i
'
)
.
click
();
// Will fail on non-configured users
});
it
(
'
should allow the user to turn off single hashtag filter and view all posts
'
,
()
=>
{
cy
.
get
(
'
.m-hashtagsSidebarSelector__list > ul > li:nth-child(1) .m-hashtagsSidebarSelectorList__visibility > i
'
).
click
();
cy
.
get
(
'
.m-hashtagsSidebarSelector__list > ul > li:nth-child(1) .m-hashtagsSidebarSelectorList__visibility > i
'
)
.
click
();
})
})
\ No newline at end of file
This diff is collapsed.
Click to expand it.
cypress/integration/groups.spec.js
View file @
a0b70491
context
(
'
Groups
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
login
(
true
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
eq
'
,
`/newsfeed/subscriptions`
);
})
it
(
'
should create and edit a group
'
,
()
=>
{
...
...
@@ -20,7 +23,7 @@ context('Groups', () => {
// click on hashtags dropdown
cy
.
get
(
'
m-hashtags-selector .m-dropdown--label-container
'
).
click
();
// select #ART
cy
.
get
(
'
m-hashtags-selector m-dropdown m-form-tags-input > div
:nth-child(1)
> span
'
).
contains
(
'
#art
'
).
click
();
cy
.
get
(
'
m-hashtags-selector m-dropdown m-form-tags-input > div > span
'
).
contains
(
'
#art
'
).
click
();
// type in another hashtag manually
cy
.
get
(
'
m-hashtags-selector m-form-tags-input input
'
).
type
(
'
hashtag{enter}
'
).
click
();
// click away
...
...
@@ -54,9 +57,9 @@ context('Groups', () => {
})
it
(
'
should be able to toggle conversation and comment on it
'
,
()
=>
{
cy
.
get
(
'
m-group--sidebar-markers li:nth-child(2)
'
).
contains
(
'
test group
'
).
click
();
cy
.
wait
(
1000
);
cy
.
get
(
'
m-group--sidebar-markers li:nth-child(3)
'
).
contains
(
'
test group
'
).
click
();
// toggle the conversation
cy
.
get
(
'
.m-groupGrid__right
'
).
should
(
'
be.visible
'
);
...
...
@@ -88,7 +91,7 @@ context('Groups', () => {
})
it
(
'
should post an activity inside the group and record the view when scrolling
'
,
()
=>
{
cy
.
get
(
'
m-group--sidebar-markers li:nth-child(
2
)
'
).
contains
(
'
test group
'
).
click
();
cy
.
get
(
'
m-group--sidebar-markers li:nth-child(
3
)
'
).
contains
(
'
test group
'
).
click
();
cy
.
wait
(
1000
);
...
...
@@ -122,7 +125,7 @@ context('Groups', () => {
});
it
(
'
should delete a group
'
,
()
=>
{
cy
.
get
(
'
m-group--sidebar-markers li:nth-child(
2
)
'
).
contains
(
'
test group
'
).
click
();
cy
.
get
(
'
m-group--sidebar-markers li:nth-child(
3
)
'
).
contains
(
'
test group
'
).
click
();
cy
.
wait
(
1000
);
...
...
This diff is collapsed.
Click to expand it.
cypress/integration/login.spec.js
View file @
a0b70491
...
...
@@ -4,7 +4,7 @@ context('Login', () => {
})
it
(
'
should login
'
,
()
=>
{
cy
.
get
(
'
.m-
btn--login
'
).
click
();
cy
.
get
(
'
.m-
v2-topbar__Container__LoginWrapper > a
'
).
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/login
'
);
...
...
@@ -17,11 +17,12 @@ context('Login', () => {
cy
.
get
(
'
minds-form-login .m-btn--login
'
).
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
10000
})
.
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
})
it
(
'
should fail to login because of incorrect password
'
,
()
=>
{
cy
.
get
(
'
.m-
btn--login
'
).
click
();
cy
.
get
(
'
.m-
v2-topbar__Container__LoginWrapper > a
'
).
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/login
'
);
...
...
This diff is collapsed.
Click to expand it.
cypress/integration/newsfeed.spec.js
View file @
a0b70491
...
...
@@ -2,8 +2,10 @@ context('Newsfeed', () => {
beforeEach
(()
=>
{
cy
.
login
(
true
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
5000
}).
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
})
it
(
'
should post an activity picking hashtags from the dropdown
'
,
()
=>
{
cy
.
get
(
'
minds-newsfeed-poster
'
).
should
(
'
be.visible
'
);
...
...
@@ -13,7 +15,7 @@ context('Newsfeed', () => {
cy
.
get
(
'
minds-newsfeed-poster m-hashtags-selector .m-dropdown--label-container
'
).
click
();
// select #ART
cy
.
get
(
'
minds-newsfeed-poster m-hashtags-selector m-dropdown m-form-tags-input > div
:nth-child(1)
> span
'
).
contains
(
'
#art
'
).
click
();
cy
.
get
(
'
minds-newsfeed-poster m-hashtags-selector m-dropdown m-form-tags-input > div > span
'
).
contains
(
'
#art
'
).
click
();
// type in another hashtag manually
cy
.
get
(
'
minds-newsfeed-poster m-hashtags-selector m-form-tags-input input
'
).
type
(
'
hashtag{enter}
'
).
click
();
...
...
@@ -127,10 +129,10 @@ context('Newsfeed', () => {
})
it
(
'
should have an "Upgrade to Plus" button and it should redirect to /plus
'
,
()
=>
{
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:
first-child
span
'
)
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:
nth-child(2)
span
'
)
.
contains
(
'
Upgrade to Plus
'
);
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:
first-child
'
).
should
(
'
have.attr
'
,
'
href
'
,
'
/plus
'
)
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:
nth-child(2)
'
).
should
(
'
have.attr
'
,
'
href
'
,
'
/plus
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/plus
'
);
...
...
@@ -155,7 +157,7 @@ context('Newsfeed', () => {
})
it
(
'
clicking on "create blog" button in poster should prompt a confirm dialog and open a new blog with the currently inputted text
'
,
()
=>
{
cy
.
get
(
'
minds-newsfeed-poster textarea
'
).
type
(
'
#thegreatmigration
'
);
cy
.
get
(
'
minds-newsfeed-poster textarea
'
).
type
(
'
thegreatmigration
'
);
// TODO: fix UX issue when hashtag element is overlapping input
const
stub
=
cy
.
stub
();
cy
.
on
(
'
window:confirm
'
,
stub
);
...
...
@@ -167,7 +169,7 @@ context('Newsfeed', () => {
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/blog/edit/new
'
);
cy
.
get
(
'
m-inline-editor .medium-editor-element.medium-editor-insert-plugin p
'
).
contains
(
'
#
thegreatmigration
'
);
cy
.
get
(
'
m-inline-editor .medium-editor-element.medium-editor-insert-plugin p
'
).
contains
(
'
thegreatmigration
'
);
})
it
(
'
should record a view when the user scrolls and an activity is visible
'
,
()
=>
{
...
...
@@ -182,6 +184,8 @@ context('Newsfeed', () => {
cy
.
scrollTo
(
0
,
'
20px
'
);
cy
.
wait
(
600
);
cy
.
wait
(
'
@view
'
,
{
requestTimeout
:
2000
}).
then
((
xhr
)
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
expect
(
xhr
.
response
.
body
).
to
.
deep
.
equal
({
status
:
'
success
'
});
...
...
@@ -201,112 +205,4 @@ context('Newsfeed', () => {
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/groups/create
'
);
})
it
(
"
clicking on the dropdown on the right should allow to go to the user's channel
"
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(1)
'
)
.
contains
(
'
View Channel
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
`/
${
Cypress
.
env
().
username
}
`
);
})
it
(
'
clicking on the dropdown on the right should allow to go to settings
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(2)
'
)
.
contains
(
'
Settings
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/settings/general
'
);
})
it
(
'
clicking on the dropdown on the right should allow to go to the boost console
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(3)
'
)
.
contains
(
'
Boost Console
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/boost/console/newsfeed/history
'
);
})
it
(
'
clicking on the dropdown on the right should allow to go to the boost console
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(4)
'
)
.
contains
(
'
Help Desk
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/help
'
);
})
it
(
'
clicking on the dropdown on the right should allow to view the whitepaper
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(5)
'
)
.
contains
(
'
Whitepaper
'
);
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(5) a
'
)
.
should
(
'
have.attr
'
,
'
href
'
)
.
and
(
'
include
'
,
'
/assets/documents/Whitepaper-v0.3.pdf
'
);
})
it
(
'
clicking on the dropdown on the right should redirect to /canary
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(6)
'
)
.
contains
(
'
Canary
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/canary
'
);
})
it
(
'
clicking on the dropdown on the right should allow to toggle Dark Mode
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
body.m-theme__light
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(7)
'
)
.
contains
(
'
Dark Mode
'
)
.
click
();
cy
.
get
(
'
body.m-theme__dark
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li:nth-child(7)
'
)
.
contains
(
'
Light Mode
'
)
.
click
();
cy
.
get
(
'
body.m-theme__light
'
).
should
(
'
be.visible
'
);
})
it
(
'
clicking on the bulb on the topbar should redirect to /newsfeed/subscriptions
'
,
()
=>
{
cy
.
get
(
'
.m-v2-topbarNavItem__Logo img
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
.m-v2-topbarNavItem__Logo
'
).
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
})
it
(
'
clicking on the bell should open the notifications dropdown, and allow to view all notifications by redirecting to /notifications
'
,
()
=>
{
cy
.
get
(
'
.m-v2-topbar__UserMenu m-notifications--flyout
'
).
should
(
'
not.be.visible
'
);
cy
.
get
(
'
.m-v2-topbar__UserMenu a.m-notifications--topbar-toggle--icon
'
)
.
should
(
'
be.visible
'
)
.
click
();
cy
.
get
(
'
.m-v2-topbar__UserMenu m-notifications--flyout
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
.m-notifications--flyout--bottom-container a
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/notifications
'
);
})
})
This diff is collapsed.
Click to expand it.
cypress/integration/topbar.spec.js
0 → 100644
View file @
a0b70491
context
(
'
Topbar
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
login
(
true
);
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
})
.
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
})
it
(
"
clicking on the dropdown on the right should allow to go to the user's channel
"
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
View Channel
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
`/
${
Cypress
.
env
().
username
}
`
);
})
it
(
'
clicking on the dropdown on the right should allow to go to settings
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
Settings
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/settings/general
'
);
})
it
(
'
clicking on the dropdown on the right should allow to go to the boost console
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
Boost Console
'
)
.
click
();
// TOFIX: no boost redirects to create
// cy.location('pathname').should('eq', '/boost/console/newsfeed/history');
})
it
(
'
clicking on the dropdown on the right should allow to go to the boost console
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
Help Desk
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/help
'
);
})
it
(
'
clicking on the dropdown on the right should redirect to /canary
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
Canary
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/canary
'
);
})
it
(
'
clicking on the dropdown on the right should allow to toggle Dark Mode
'
,
()
=>
{
// open the menu
cy
.
get
(
'
m-user-menu .m-user-menu__Anchor
'
).
click
();
cy
.
get
(
'
body.m-theme__light
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
Dark Mode
'
)
.
click
();
cy
.
get
(
'
body.m-theme__dark
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
m-user-menu .m-user-menu__Dropdown li
'
)
.
contains
(
'
Light Mode
'
)
.
click
();
cy
.
get
(
'
body.m-theme__light
'
).
should
(
'
be.visible
'
);
})
it
(
'
clicking on the bulb on the topbar should redirect to /newsfeed/subscriptions
'
,
()
=>
{
cy
.
get
(
'
.m-v2-topbarNavItem__Logo img
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
.m-v2-topbarNavItem__Logo
'
).
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
})
it
(
'
clicking on the bell should open the notifications dropdown, and allow to view all notifications by redirecting to /notifications
'
,
()
=>
{
cy
.
get
(
'
.m-v2-topbar__UserMenu m-notifications--flyout
'
).
should
(
'
not.be.visible
'
);
cy
.
get
(
'
.m-v2-topbar__UserMenu a.m-notifications--topbar-toggle--icon
'
)
.
should
(
'
be.visible
'
)
.
click
();
cy
.
get
(
'
.m-v2-topbar__UserMenu m-notifications--flyout
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
.m-notifications--flyout--bottom-container a
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/notifications
'
);
})
})
This diff is collapsed.
Click to expand it.
cypress/support/commands.js
View file @
a0b70491
...
...
@@ -24,7 +24,14 @@
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
// Staging requires cookie to be set
Cypress
.
Cookies
.
defaults
({
whitelist
:
'
staging
'
});
Cypress
.
Commands
.
add
(
'
login
'
,
(
canary
)
=>
{
cy
.
setCookie
(
'
staging
'
,
"
1
"
);
// Run in stagin mode. Note: does not impact review sites
cy
.
visit
(
'
/login
'
);
cy
.
get
(
'
.m-btn--login
'
).
click
();
...
...
@@ -39,7 +46,7 @@ Cypress.Commands.add('uploadFile', (selector, fileName, type = '') => {
cy
.
get
(
selector
).
then
((
subject
)
=>
{
cy
.
fixture
(
fileName
,
'
base64
'
).
then
((
content
)
=>
{
const
el
=
subject
[
0
];
const
blob
=
cy
.
visit
(
'
/newsfeed/global/top
'
);
b64toBlob
(
content
,
type
);
const
blob
=
b64toBlob
(
content
,
type
);
cy
.
window
().
then
((
win
)
=>
{
const
testFile
=
new
win
.
File
([
blob
],
fileName
,
{
type
});
const
dataTransfer
=
new
DataTransfer
();
...
...
@@ -53,7 +60,7 @@ Cypress.Commands.add('uploadFile', (selector, fileName, type = '') => {
});
Cypress
.
Commands
.
add
(
'
post
'
,
(
message
)
=>
{
cy
.
get
(
'
m
wl-text-input
-autocomplete-container textarea
'
).
type
(
message
);
cy
.
get
(
'
m
-text-input-
-autocomplete-container textarea
'
).
type
(
message
);
cy
.
get
(
'
.m-posterActionBar__PostButton
'
).
click
();
});
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment