Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
[Sprint/DapperDingo] (feat): newsfeed e2e tests
· ddcfd4f7
Marcelo Rivera
authored
May 21, 2019
and
Mark Harding
committed
May 21, 2019
ddcfd4f7
Merge branch 'sprint/DapperDingo.feat.newsfeed-e2e-tests' into 'master'
· 68a08789
Mark Harding
authored
May 21, 2019
[Sprint/DapperDingo] (feat): newsfeed e2e tests See merge request
minds/front!299
68a08789
Hide whitespace changes
Inline
Side-by-side
cypress/integration/newsfeed.spec.js
View file @
68a08789
context
(
'
Login
'
,
()
=>
{
context
(
'
Newsfeed
'
,
()
=>
{
beforeEach
(()
=>
{
cy
.
login
(
true
);
})
cy
.
location
(
'
pathname
'
,
{
timeout
:
5000
}).
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
})
it
(
'
should post an activity picking hashtags from the dropdown
'
,
()
=>
{
cy
.
get
(
'
minds-newsfeed-poster
'
).
should
(
'
be.visible
'
);
...
...
@@ -125,7 +126,51 @@ context('Login', () => {
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
})
it
(
'
should record a view when the user scrolls and an activity is visible
'
,
async
()
=>
{
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
'
)
.
contains
(
'
Upgrade to Plus
'
);
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:first-child
'
).
should
(
'
have.attr
'
,
'
href
'
,
'
/plus
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/plus
'
);
})
it
(
'
should have a "Buy Tokens" button and it should redirect to /token
'
,
()
=>
{
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:last-child span
'
)
.
contains
(
'
Buy Tokens
'
);
cy
.
get
(
'
.m-page--sidebar--navigation a.m-page--sidebar--navigation--item:last-child
'
).
should
(
'
have.attr
'
,
'
href
'
,
'
/tokens
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/token
'
);
})
it
(
'
"create blog" button in poster should redirect to /blog/edit/new
'
,
()
=>
{
cy
.
get
(
'
minds-newsfeed-poster .m-posterActionBar__CreateBlog
'
)
.
contains
(
'
Create blog
'
)
.
click
();
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/blog/edit/new
'
);
})
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
'
);
const
stub
=
cy
.
stub
();
cy
.
on
(
'
window:confirm
'
,
stub
);
cy
.
get
(
'
minds-newsfeed-poster .m-posterActionBar__CreateBlog
'
)
.
contains
(
'
Create blog
'
).
click
()
.
then
(()
=>
{
expect
(
stub
.
getCall
(
0
)).
to
.
be
.
calledWith
(
'
Are you sure? The content will be moved to the blog editor.
'
)
});
cy
.
location
(
'
pathname
'
).
should
(
'
eq
'
,
'
/blog/edit/new
'
);
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
'
,
()
=>
{
cy
.
server
();
cy
.
route
(
"
POST
"
,
"
**/api/v2/analytics/views/activity/*
"
).
as
(
"
view
"
);
// create the post
...
...
@@ -147,4 +192,121 @@ context('Login', () => {
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu .minds-dropdown-menu .mdl-menu__item:nth-child(4)
'
).
click
();
cy
.
get
(
'
.minds-list > minds-activity:first-child m-post-menu m-modal-confirm .mdl-button--colored
'
).
click
();
})
it
(
'
clicking on the plus button on the sidebar should redirect the user to /groups/create
'
,
()
=>
{
cy
.
get
(
'
m-group--sidebar-markers .m-groupSidebarMarkers__list li:first-child
'
)
.
contains
(
'
add
'
)
.
click
();
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
'
);
})
})
cypress/support/commands.js
View file @
68a08789
...
...
@@ -33,7 +33,6 @@ Cypress.Commands.add('login', (canary) => {
cy
.
get
(
'
minds-form-login .m-login-box .mdl-cell:last-child input
'
).
type
(
Cypress
.
env
().
password
);
cy
.
get
(
'
minds-form-login .m-btn--login
'
).
click
();
});
Cypress
.
Commands
.
add
(
'
uploadFile
'
,
(
selector
,
fileName
,
type
=
''
)
=>
{
...
...