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)
Removed feature flag changes.
· 790ed6da
Ben
authored
Oct 31, 2019
790ed6da
E2E testing
· 74aeb47e
Ben
authored
Oct 31, 2019
74aeb47e
Hide whitespace changes
Inline
Side-by-side
cypress/integration/newsfeed.spec.js
View file @
74aeb47e
import
generateRandomId
from
'
../support/utilities
'
;
context
(
'
Newsfeed
'
,
()
=>
{
before
(()
=>
{
cy
.
getCookie
(
'
minds_sess
'
).
then
(
sessionCookie
=>
{
...
...
@@ -14,7 +16,6 @@ context('Newsfeed', () => {
cy
.
route
(
'
POST
'
,
'
**/api/v1/media
'
).
as
(
'
mediaPOST
'
);
cy
.
route
(
'
POST
'
,
'
**/api/v1/newsfeed/**
'
).
as
(
'
newsfeedEDIT
'
);
cy
.
route
(
'
POST
'
,
'
**/api/v1/media/**
'
).
as
(
'
mediaEDIT
'
);
cy
.
visit
(
'
/newsfeed/subscriptions
'
)
.
location
(
'
pathname
'
)
.
should
(
'
eq
'
,
'
/newsfeed/subscriptions
'
);
...
...
@@ -37,6 +38,19 @@ context('Newsfeed', () => {
cy
.
get
(
'
minds-newsfeed-poster textarea
'
).
type
(
content
);
};
const
attachRichEmbed
=
(
embedUrl
)
=>
{
cy
.
get
(
'
minds-newsfeed-poster
'
).
should
(
'
be.visible
'
);
cy
.
get
(
'
minds-newsfeed-poster textarea
'
)
.
type
(
embedUrl
);
cy
.
route
(
'
GET
'
,
`**/api/v1/newsfeed/preview?url=
${
embedUrl
}
**`
)
.
as
(
'
previewGET
'
)
.
wait
(
'
@previewGET
'
)
.
then
(
xhr
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
});
}
const
attachImageToActivity
=
()
=>
{
cy
.
uploadFile
(
'
#attachment-input-poster
'
,
...
...
@@ -511,4 +525,140 @@ context('Newsfeed', () => {
deleteActivityFromNewsfeed
();
});
it
(
'
should show a rich embed post from youtube in a modal
'
,
()
=>
{
const
content
=
generateRandomId
()
+
"
"
,
url
=
'
https://www.youtube.com/watch?v=jNQXAC9IVRw
'
;
// set up post.
newActivityContent
(
content
);
attachRichEmbed
(
url
);
// post and await.
cy
.
get
(
'
.m-posterActionBar__PostButton
'
)
.
click
()
.
wait
(
'
@newsfeedPOST
'
).
then
(
xhr
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
//get activity, click it.
cy
.
get
(
`[minds-data-activity-guid='
${
xhr
.
response
.
body
.
guid
}
']`
)
.
click
();
//check modal is open.
cy
.
get
(
'
[data-cy=data-minds-media-modal]
'
)
.
contains
(
content
);
// close modal and tidy.
cy
.
get
(
'
.m-overlay-modal--backdrop
'
)
.
click
({
force
:
true
});
deleteActivityFromNewsfeed
();
});
});
it
(
'
should not open vimeo in a modal
'
,
()
=>
{
const
content
=
generateRandomId
()
+
"
"
,
url
=
'
https://vimeo.com/8733915
'
;
// set up post.
newActivityContent
(
content
);
attachRichEmbed
(
url
);
// post and await.
cy
.
get
(
'
.m-posterActionBar__PostButton
'
)
.
click
()
.
wait
(
'
@newsfeedPOST
'
).
then
(
xhr
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
//get activity, make assertions tht would not be true for modals.
cy
.
get
(
`[minds-data-activity-guid='
${
xhr
.
response
.
body
.
guid
}
']`
)
.
should
(
'
be.visible
'
)
.
get
(
'
iframe
'
)
.
should
(
'
be.visible
'
)
.
get
(
'
.minds-more
'
)
.
should
(
'
be.visible
'
);
// tidy.
deleteActivityFromNewsfeed
();
});
});
it
(
'
should not open soundcloud in a modal
'
,
()
=>
{
const
content
=
generateRandomId
()
+
"
"
,
url
=
'
https://soundcloud.com/richarddjames/piano-un10-it-happened
'
;
// set up post.
newActivityContent
(
content
);
attachRichEmbed
(
url
);
// post and await.
cy
.
get
(
'
.m-posterActionBar__PostButton
'
)
.
click
()
.
wait
(
'
@newsfeedPOST
'
).
then
(
xhr
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
//get activity, make assertions tht would not be true for modals.
cy
.
get
(
`[minds-data-activity-guid='
${
xhr
.
response
.
body
.
guid
}
']`
)
.
should
(
'
be.visible
'
)
.
get
(
'
.m-rich-embed-action-overlay
'
)
.
should
(
'
be.visible
'
)
.
get
(
'
.minds-more
'
)
.
should
(
'
be.visible
'
);
deleteActivityFromNewsfeed
();
});
});
it
(
'
should not open spotify in a modal
'
,
()
=>
{
const
content
=
generateRandomId
()
+
"
"
,
url
=
'
https://open.spotify.com/track/2MZSXhq4XDJWu6coGoXX1V?si=nvja0EfwR3q6GMQmYg6gPQ
'
;
// set up post.
newActivityContent
(
content
);
attachRichEmbed
(
url
);
// post and await.
cy
.
get
(
'
.m-posterActionBar__PostButton
'
)
.
click
()
.
wait
(
'
@newsfeedPOST
'
).
then
(
xhr
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
//get activity, make assertions tht would not be true for modals.
cy
.
get
(
`[minds-data-activity-guid='
${
xhr
.
response
.
body
.
guid
}
']`
)
.
should
(
'
be.visible
'
)
.
get
(
'
.m-rich-embed-action-overlay
'
)
.
should
(
'
be.visible
'
)
.
get
(
'
.minds-more
'
)
.
should
(
'
be.visible
'
);
deleteActivityFromNewsfeed
();
});
});
it
(
'
should not open spotify in a modal
'
,
()
=>
{
const
content
=
generateRandomId
()
+
"
"
,
url
=
'
http://giphygifs.s3.amazonaws.com/media/IzVquL965ib4s/giphy.gif
'
;
// set up post.
newActivityContent
(
content
);
attachRichEmbed
(
url
);
// post and await.
cy
.
get
(
'
.m-posterActionBar__PostButton
'
)
.
click
()
.
wait
(
'
@newsfeedPOST
'
).
then
(
xhr
=>
{
expect
(
xhr
.
status
).
to
.
equal
(
200
);
//get activity, make assertions tht would not be true for modals.
cy
.
get
(
`[minds-data-activity-guid='
${
xhr
.
response
.
body
.
guid
}
']`
)
.
should
(
'
be.visible
'
)
.
get
(
'
.m-rich-embed-action-overlay
'
)
.
should
(
'
be.visible
'
)
.
get
(
'
.minds-more
'
)
.
should
(
'
be.visible
'
);
deleteActivityFromNewsfeed
();
});
});
});
src/app/modules/media/modal/modal.component.html
View file @
74aeb47e
<div
class=
"m-mediaModal__wrapper"
>
<div
class=
"m-mediaModal__wrapper"
data-cy=
"data-minds-media-modal"
>
<div
class=
"m-mediaModal__theater"
(click)=
"clickedModal($event)"
>
<div
class=
"m-mediaModal m-mediaModal__clearFix"
...
...
src/app/services/features.service.ts
View file @
74aeb47e
...
...
@@ -22,10 +22,9 @@ export class FeaturesService {
if
(
typeof
this
.
_features
[
feature
]
===
'
undefined
'
)
{
if
(
isDevMode
()
&&
!
this
.
_hasWarned
(
feature
))
{
console
.
warn
// `[FeaturedService] Feature '${feature}' is not declared. Assuming false.`
();
console
.
warn
(
`[FeaturedService] Feature '
${
feature
}
' is not declared. Assuming false.`
);
this
.
_warnedCache
[
feature
]
=
Date
.
now
();
}
...
...