Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
830
Issues
830
List
Boards
Labels
Service Desk
Milestones
Merge Requests
43
Merge Requests
43
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
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
c45fc8c6
Commit
c45fc8c6
authored
51 minutes ago
by
Guy Thouret
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(e2e) Lint blog e2e spec test -
#1889
parent
14cc9a6e
chore/616-propogate-props
1 merge request
!556
WIP: E2E Tests For Propagate Properties
Pipeline
#82633388
running with stages
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
5 deletions
+40
-5
blogs.spec.js
cypress/integration/blogs.spec.js
+40
-5
No files found.
cypress/integration/blogs.spec.js
View file @
c45fc8c6
...
...
@@ -3,15 +3,14 @@
context
(
'
Blogs
'
,
()
=>
{
before
(()
=>
{
cy
.
clearCookies
();
cy
.
getCookie
(
'
minds_sess
'
)
.
then
((
sessionCookie
)
=>
{
cy
.
getCookie
(
'
minds_sess
'
).
then
(
sessionCookie
=>
{
if
(
sessionCookie
===
null
)
{
return
cy
.
login
(
true
);
}
});
});
beforeEach
(()
=>
{
beforeEach
(()
=>
{
cy
.
preserveCookies
();
});
...
...
@@ -26,7 +25,7 @@ context('Blogs', () => {
cy
.
get
(
'
.m-channel--name .minds-button-edit button:last-child
'
).
click
();
};
const
createBlogPost
=
(
title
,
body
,
nsfw
=
false
)
=>
{
const
createBlogPost
=
(
title
,
body
,
nsfw
=
false
,
schedule
=
false
)
=>
{
cy
.
visit
(
'
/blog/edit/new
'
);
cy
.
uploadFile
(
...
...
@@ -90,6 +89,24 @@ context('Blogs', () => {
cy
.
get
(
'
.m-mature-info a span
'
).
contains
(
'
Mature content
'
);
}
if
(
schedule
)
{
cy
.
get
(
'
.m-poster-date-selector__input
'
).
click
();
cy
.
get
(
'
td.c-datepicker__day-body.c-datepicker__day--selected + td
'
).
click
();
cy
.
get
(
'
a.c-btn.c-btn--flat.js-ok
'
).
click
();
// get setted date to compare
let
scheduledDate
;
cy
.
get
(
'
div.m-poster-date-selector__input div.m-tooltip--bubble
'
)
.
invoke
(
'
text
'
)
.
then
(
text
=>
{
scheduledDate
=
text
;
});
cy
.
wait
(
1000
);
}
cy
.
server
();
cy
.
route
(
'
POST
'
,
'
**/api/v1/blog/new
'
).
as
(
'
postBlog
'
);
cy
.
route
(
'
GET
'
,
'
**/api/v1/blog/**
'
).
as
(
'
getBlog
'
);
...
...
@@ -107,7 +124,7 @@ context('Blogs', () => {
expect
(
xhr
.
response
.
body
).
to
.
have
.
property
(
'
blog
'
);
});
cy
.
location
(
'
pathname
'
).
should
(
cy
.
location
(
'
pathname
'
,
{
timeout
:
30000
}
).
should
(
'
contains
'
,
`/
${
Cypress
.
env
().
username
}
/blog`
);
...
...
@@ -116,6 +133,18 @@ context('Blogs', () => {
cy
.
get
(
'
.minds-blog-body p
'
).
contains
(
body
);
cy
.
get
(
'
.m-license-info span
'
).
contains
(
'
all-rights-reserved
'
);
if
(
schedule
)
{
cy
.
wait
(
1000
);
cy
.
get
(
'
div.m-blog-container div.mdl-grid div.minds-body span
'
)
.
invoke
(
'
text
'
)
.
then
(
text
=>
{
const
time_created
=
new
Date
(
text
).
getTime
();
scheduledDate
=
new
Date
(
scheduledDate
).
getTime
();
expect
(
scheduledDate
).
to
.
equal
(
time_created
);
});
}
};
const
deleteBlogPost
=
()
=>
{
...
...
@@ -165,6 +194,12 @@ context('Blogs', () => {
cy
.
get
(
'
.minds-blog-body p
'
).
contains
(
body
);
};
it
(
'
should be able to create a new scheduled blog
'
,
()
=>
{
uploadAvatar
();
createBlogPost
(
'
Title
'
,
'
Content
'
,
true
,
true
);
deleteBlogPost
();
});
it
(
'
should not be able to create a new blog if no title or banner are specified
'
,
()
=>
{
cy
.
visit
(
'
/blog/edit/new
'
);
cy
.
get
(
'
.m-button--submit
'
).
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