...
 
Commits (11)
......@@ -306,6 +306,7 @@ deploy:production:
cleanup:review: # We stop the review site after the e2e tests have run
<<: *cleanup_review
stage: cleanup
when: manual
except:
refs:
- master
......
#!/usr/bin/env bash
# Boilerplate generated with create-bash-script (c) 2019 Nikita Skobov
# Available https://github.com/nikita-skobov/create-bash-script
function usage()
{
local just_help=$1
local missing_required=$2
local invalid_argument=$3
local invalid_option=$4
local help="Usage: e2e.sh [OPTIONS]
Intended to serve as an interaction wrapper around Cypress.
Example: ./e2e.sh -u nemofin -p password123 -v true -url http://www.minds.com/
Options (* indicates it is required):"
local help_options="
*\-p ,\--password \<Parameter>\ The password of the user.
\-url ,\--url \<Parameter>\ The URL of the host e.g. https://www.minds.com/ - defaults to use localhost.
\-u ,\--username \<Parameter>\ The username - defaults to cypress_e2e_test.
\-v ,\---video \<Parameter>\ true if you want video providing.
"
if [ "$missing_required" != "" ]
then
echo "Missing required argument: $missing_required"
fi
if [ "$invalid_option" != "" ] && [ "$invalid_value" = "" ]
then
echo "Invalid option: $invalid_option"
elif [ "$invalid_value" != "" ]
then
echo "Invalid value: $invalid_value for option: --$invalid_option"
fi
echo -e "
"
echo "$help"
echo "$help_options" | column -t -s'\'
return
}
function init_args()
{
REQ_ARGS=( "password" )
# get command line arguments
POSITIONAL=()
# set default arguments
url="http://localhost"
username="minds_cypress_tests"
_video=false
while [[ $# -gt 0 ]]
do
key="$1"
case $key in
-url|--url)
url="$2"
shift 2
;;
-u|--username)
username="$2"
shift 2
;;
-p|--password)
password="$2"
shift 2
;;
-v|---video)
_video="$2"
shift 2
;;
*)
POSITIONAL+=("$1") # saves unknown option in array
shift
;;
esac
done
for i in "${REQ_ARGS[@]}"; do
# $i is the string of the variable name
# ${!i} is a parameter expression to get the value
# of the variable whose name is i.
req_var=${!i}
if [ "$req_var" = "" ]
then
usage "" "--$i"
exit
fi
done
}
init_args $@
# cd to project root.
while [[ $PWD != '/' && ${PWD##*/} != 'front' ]]; do cd ..; done
#run cypress with args.
./node_modules/cypress/bin/cypress open --config baseUrl=$url,video=$_video --env username=$username,password=$password
......@@ -13,6 +13,7 @@ context('Blogs', () => {
beforeEach(()=> {
cy.preserveCookies();
cy.server();
});
it('should not be able to create a new blog if no title or banner are specified', () => {
......@@ -89,7 +90,6 @@ context('Blogs', () => {
cy.get('.m-mature-info a').click();
cy.get('.m-mature-info a span').contains('Mature content');
cy.server();
cy.route("POST", "**/api/v1/blog/new").as("postBlog");
cy.route("GET", "**/api/v1/blog/**").as("getBlog");
......@@ -123,104 +123,108 @@ context('Blogs', () => {
});
it('should be able to create a new scheduled blog', () => {
// upload avatar first
cy.visit(`/${Cypress.env().username}`);
cy.get('.m-channel--name .minds-button-edit button:first-child').click();
cy.get('minds-newsfeed-poster').then((poster) => {
if (poster.find('.m-poster-date-selector__input').length > 0) {
cy.wait(100);
cy.get('.m-channel--name .minds-button-edit button:first-child').click();
cy.uploadFile('.minds-avatar input[type=file]', '../fixtures/avatar.jpeg', 'image/jpg');
cy.wait(100);
cy.get('.m-channel--name .minds-button-edit button:last-child').click();
cy.uploadFile('.minds-avatar input[type=file]', '../fixtures/avatar.jpeg', 'image/jpg');
// create blog
cy.visit('/blog/edit/new');
cy.get('.m-channel--name .minds-button-edit button:last-child').click();
cy.uploadFile('minds-banner #file', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
// create blog
cy.visit('/blog/edit/new');
cy.get('minds-textarea .m-editor').type('Title');
cy.uploadFile('minds-banner #file', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
cy.get('m-inline-editor .medium-editor-element').type('Content\n');
cy.get('minds-textarea .m-editor').type('Title');
// click on plus button
cy.get('.medium-editor-element > .medium-insert-buttons > button.medium-insert-buttons-show').click();
// click on camera
cy.get('ul.medium-insert-buttons-addons > li > button.medium-insert-action:first-child').contains('photo_camera').click();
// upload the image
cy.uploadFile('.medium-media-file-input', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
cy.get('m-inline-editor .medium-editor-element').type('Content\n');
// open license dropdown & select first license
cy.get('.m-license-info select').select('All rights reserved');
// click on plus button
cy.get('.medium-editor-element > .medium-insert-buttons > button.medium-insert-buttons-show').click();
// click on camera
cy.get('ul.medium-insert-buttons-addons > li > button.medium-insert-action:first-child').contains('photo_camera').click();
// upload the image
cy.uploadFile('.medium-media-file-input', '../fixtures/international-space-station-1776401_1920.jpg', 'image/jpg');
// 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 > 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();
// open license dropdown & select first license
cy.get('.m-license-info select').select('All rights reserved');
// click away
cy.get('.m-category-info m-hashtags-selector .minds-bg-overlay').click();
// 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 > 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();
// select visibility
cy.get('.m-visibility-info select').select('Loggedin');
// click away
cy.get('.m-category-info m-hashtags-selector .minds-bg-overlay').click();
// open metadata form
cy.get('.m-blog-edit--toggle-wrapper .m-blog-edit--toggle').contains('Metadata').click();
// set url slug
cy.get('.m-blog-edit--field input[name=slug]').type('123');
// set meta title
cy.get('.m-blog-edit--field input[name=custom_meta_title]').type('Test');
// set meta description
cy.get('.m-blog-edit--field textarea[name=custom_meta_description]').type('This is a test blog');
// set meta author
cy.get('.m-blog-edit--field input[name=custom_meta_author]').type('Minds Test');
// select visibility
cy.get('.m-visibility-info select').select('Loggedin');
// set as nsfw
cy.get('.m-mature-info a').click();
cy.get('.m-mature-info a span').contains('Mature content');
// open metadata form
cy.get('.m-blog-edit--toggle-wrapper .m-blog-edit--toggle').contains('Metadata').click();
// set url slug
cy.get('.m-blog-edit--field input[name=slug]').type('123');
// set meta title
cy.get('.m-blog-edit--field input[name=custom_meta_title]').type('Test');
// set meta description
cy.get('.m-blog-edit--field textarea[name=custom_meta_description]').type('This is a test blog');
// set meta author
cy.get('.m-blog-edit--field input[name=custom_meta_author]').type('Minds Test');
// set scheduled date
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();
// set as nsfw
cy.get('.m-mature-info a').click();
cy.get('.m-mature-info a span').contains('Mature content');
// 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;
});
// set scheduled date
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();
cy.wait(1000);
// 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.get('.m-button--submit').click({ force: true }); // TODO: Investigate why disabled flag is being detected
cy.wait(1000);
cy.location('pathname', { timeout: 30000 })
.should('contains', `/${Cypress.env().username}/blog`);
cy.get('.m-button--submit').click({ force: true }); // TODO: Investigate why disabled flag is being detected
cy.get('.m-blog--title').contains('Title');
cy.get('.minds-blog-body p').contains('Content');
cy.location('pathname', { timeout: 30000 })
.should('contains', `/${Cypress.env().username}/blog`);
cy.get('.m-license-info span').contains('all-rights-reserved');
cy.get('.m-blog--title').contains('Title');
cy.get('.minds-blog-body p').contains('Content');
cy.wait(1000);
cy.get('.m-license-info span').contains('all-rights-reserved');
// compare setted date with time_created
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);
});
cy.wait(1000);
// cleanup
// compare setted date with time_created
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);
});
//open dropdown
cy.get('m-post-menu button.minds-more').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();
// cleanup
//open dropdown
cy.get('m-post-menu button.minds-more').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();
}
});
});
})
/**
* @author Ben Hayward
* @desc E2E testing for Minds Boost Console pages.
*/
import generateRandomId from '../../support/utilities';
context('Boost Console', () => {
const postContent = "Test boost, please reject..." + Math.random().toString(36);
const postContent = "Test boost, please reject..." + generateRandomId();
before(() => {
cy.getCookie('minds_sess')
......@@ -8,27 +14,24 @@ context('Boost Console', () => {
return cy.login(true);
}
});
newBoost(postContent, 100);
});
beforeEach(() => {
cy.server();
cy.route("POST", '**/api/v2/boost/**').as('boostPost');
cy.preserveCookies();
cy.visit('/newsfeed/subscribed');
newBoost(postContent, 100);
cy.visit('/boost/console/newsfeed/history');
});
it('should show a new boost in the console', () => {
cy.visit('/boost/console/newsfeed/history');
cy.get('m-boost-console-card:nth-child(1) div.m-boost-card--manager-item.m-boost-card--state')
.should('not.contain', 'revoked');
cy.get('m-boost-console-card:nth-child(1) .m-boost-card--manager-item--buttons > button')
.click();
cy.get('m-boost-console-card:nth-child(1) .m-mature-message span')
.contains(postContent);
});
it('should allow a revoke a boost', () => {
navToConsole();
cy.get('m-boost-console-card:nth-child(1) div.m-boost-card--manager-item.m-boost-card--state')
.should('not.contain', 'revoked');
......@@ -39,15 +42,42 @@ context('Boost Console', () => {
.contains('revoked');
});
function navToConsole() {
cy.visit('/boost/console/newsfeed/history');
cy.location('pathname')
.should('eq', `/boost/console/newsfeed/history`);
}
it('should load show the user content for newsfeed boosts', () => {
cy.route("GET", "**/feeds/container/*/activities**").as("activities");
cy.contains('Create a Boost')
.click()
.location('pathname')
.should('eq', `/boost/console/newsfeed/create`)
.wait('@activities').then((xhr) => {
expect(xhr.status).to.equal(200);
});
})
it('should load show the user content for sidebar boosts', () => {
cy.route("GET", "**/api/v2/feeds/container/*/all**").as("all");
cy.visit('/boost/console/content/create')
.location('pathname')
.should('eq', `/boost/console/content/create`)
.wait('@all').then((xhr) => {
expect(xhr.status).to.equal(200);
});
})
it('should load show the user content for offers', () => {
cy.route("GET", "**/api/v2/feeds/container/*/activities**").as("all");
cy.visit('/boost/console/offers/create')
.location('pathname')
.should('eq', `/boost/console/offers/create`)
.wait('@all').then((xhr) => {
expect(xhr.status).to.equal(200);
});
})
function newBoost(text, views) {
cy.server();
cy.route("POST", '**/api/v2/boost/**').as('boostPost');
cy.visit('/newsfeed/subscribed');
cy.post(text);
cy.get('#boost-actions')
......@@ -61,7 +91,6 @@ context('Boost Console', () => {
.click();
cy.wait('@boostPost').then((xhr) => {
cy.log(xhr);
expect(xhr.status).to.equal(200);
expect(xhr.response.body.status).to.deep.equal("success");
});
......
context('Boost Creation', () => {
const duplicateError = "There's already an ongoing boost for this entity";
const postContent = "Test boost, please reject..." + Math.random().toString(36).substring(8);
const nonParticipationError = 'Boost target should participate in the Rewards program.'
before(() => {
cy.server();
})
beforeEach(() => {
cy.server()
.route("GET", '**/api/v2/boost/prepare/**').as('prepare')
.route("POST", '**/api/v2/boost/activity/**').as('activity')
.route("GET", '**/api/v2/blockchain/wallet/balance*').as('balance')
.route("GET", '**/api/v2/search/suggest/**').as('suggest');
cy.getCookie('minds_sess')
.then((sessionCookie) => {
if (sessionCookie === null) {
return cy.login(true);
}
});
cy.visit('/newsfeed/subscriptions');
cy.location('pathname')
.should('eq', `/newsfeed/subscriptions`);
cy.route("GET", '**/api/v2/boost/prepare/**').as('prepare');
cy.route("POST", '**/api/v2/boost/activity/**').as('activity');
cy.route("GET", '**/api/v2/blockchain/wallet/balance*').as('balance');
cy.route("GET", '**/api/v2/search/suggest/**').as('suggest');
cy.visit('/newsfeed/subscriptions')
.location('pathname')
.should('eq', `/newsfeed/subscriptions`);
});
......
context('Boost Impressions', () => {
context.skip('Boost Impressions', () => {
before(() => {
cy.getCookie('minds_sess')
......@@ -7,37 +7,43 @@ context('Boost Impressions', () => {
return cy.login(true);
}
});
cy.visit('/newsfeed/subscriptions');
cy.location('pathname')
.should('eq', `/newsfeed/subscriptions`);
});
beforeEach(()=> {
cy.server();
cy.route("POST", "**api/v2/analytics/views/boost/*").as("analytics");
cy.route("GET", "**/api/v2/feeds/subscribed/activities**").as("activities");
cy.preserveCookies();
cy.visit('/newsfeed/subscriptions')
.location('pathname')
.should('eq', `/newsfeed/subscriptions`)
.wait('@activities').then((xhr) => {
expect(xhr.status).to.equal(200);
});
});
afterEach(()=> {
cy.reload();
})
// Cannot test until env behaves consistently.
// See: https://gitlab.com/minds/front/issues/1912
it('should register views on scroll', () => {
//stub endpoint
cy.server();
cy.route("POST", "**/api/v2/analytics/views/activity/*").as("analytics");
//load, scroll, wait to trigger analytics
cy.scrollTo(0, 500);
//smooth scroll
cy.scrollTo('0', '1%', { duration: 100 });
//assert
cy.wait('@analytics').then((xhr) => {
expect(xhr.status).to.equal(200);
expect(xhr.response.body).to.deep.equal({ status: 'success' });
});
});
it('should register views on boost rotate', () => {
//stub endpoint
cy.server();
cy.route("POST", "**/api/v2/analytics/views/boost/*").as("analytics");
//rotate forward and wait to trigger analytics
cy.get('m-newsfeed--boost-rotator > div > ul > li:nth-child(3) > i')
cy.get('m-newsfeed--boost-rotator')
.find('chevron_right')
.click();
//assert
......@@ -47,7 +53,8 @@ context('Boost Impressions', () => {
});
//rotate forward and wait to trigger analytics
cy.get('m-newsfeed--boost-rotator > div > ul > li:nth-child(2) > i')
cy.get('m-newsfeed--boost-rotator')
.find('chevron_left')
.click();
//assert
......
context('Channel', () => {
// skipped until feat release
context.skip('Channel', () => {
before(() => {
cy.getCookie('minds_sess')
.then((sessionCookie) => {
......
......@@ -52,90 +52,95 @@ context('Newsfeed', () => {
})
it('should be able to post an activity picking a scheduled date and the edit it', () => {
cy.get('minds-newsfeed-poster').should('be.visible');
cy.get('minds-newsfeed-poster textarea').type('This is a post');
// set scheduled date
cy.get('.m-poster-date-selector__input').click();
cy.get('button.c-datepicker__next').click();
cy.get('tr.c-datepicker__days-row:nth-child(2) td.c-datepicker__day-body:first-child').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.get('.m-posterActionBar__PostButton').click();
cy.wait(100);
// compare setted date with time_created
cy.get('.minds-list > minds-activity:first-child div.mdl-card__supporting-text > div.body > a.permalink > span')
.invoke('text').then((text) => {
const time_created = new Date(text).getTime();
scheduledDate = new Date(scheduledDate).getTime();
expect(scheduledDate).to.equal(time_created);
});
// prepare to listen
cy.server();
cy.route("POST", '**/api/v1/newsfeed/**').as("saveEdited");
// edit the activity
cy.get('.minds-list > minds-activity:first-child m-post-menu > button.minds-more').click();
cy.get('.minds-list > minds-activity:first-child li.mdl-menu__item:first-child').click();
cy.get('.minds-list > minds-activity:first-child .m-poster-date-selector__input').click();
cy.get('button.c-datepicker__next').click();
cy.get('tr.c-datepicker__days-row:nth-child(3) td.c-datepicker__day-body:first-child').click();
cy.get('a.c-btn.c-btn--flat.js-ok').click();
// get setted date to compare
cy.get('.minds-list > minds-activity:first-child div.m-poster-date-selector__input div.m-tooltip--bubble')
.invoke('text').then((text) => {
scheduledDate = text;
});
// compare setted date with time_created
cy.get('.minds-list > minds-activity:first-child div.mdl-card__supporting-text > div.body > a.permalink > span')
.invoke('text').then((text) => {
const time_created = new Date(text).getTime();
scheduledDate = new Date(scheduledDate).getTime();
expect(scheduledDate).to.equal(time_created);
});
// Save
cy.get('.minds-list > minds-activity:first-child button.mdl-button.mdl-button--colored').click();
cy.wait('@saveEdited', { requestTimeout: 5000 }).then((xhr) => {
expect(xhr.status).to.equal(200, '**/api/v1/newsfeed/** request status');
});
// cleanup
cy.get('.minds-list > minds-activity:first-child m-post-menu .minds-more').click();
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();
cy.get('minds-newsfeed-poster').then((poster) => {
if (poster.find('.m-poster-date-selector__input').length > 0) {
cy.get('minds-newsfeed-poster textarea').type('This is a post');
// set scheduled date
cy.get('.m-poster-date-selector__input').click();
cy.get('button.c-datepicker__next').click();
cy.get('tr.c-datepicker__days-row:nth-child(2) td.c-datepicker__day-body:first-child').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.get('.m-posterActionBar__PostButton').click();
cy.wait(100);
// compare setted date with time_created
cy.get('.minds-list > minds-activity:first-child div.mdl-card__supporting-text > div.body > a.permalink > span')
.invoke('text').then((text) => {
const time_created = new Date(text).getTime();
scheduledDate = new Date(scheduledDate).getTime();
expect(scheduledDate).to.equal(time_created);
});
// prepare to listen
cy.server();
cy.route("POST", '**/api/v1/newsfeed/**').as("saveEdited");
// edit the activity
cy.get('.minds-list > minds-activity:first-child m-post-menu > button.minds-more').click();
cy.get('.minds-list > minds-activity:first-child li.mdl-menu__item:first-child').click();
cy.get('.minds-list > minds-activity:first-child .m-poster-date-selector__input').click();
cy.get('button.c-datepicker__next').click();
cy.get('tr.c-datepicker__days-row:nth-child(3) td.c-datepicker__day-body:first-child').click();
cy.get('a.c-btn.c-btn--flat.js-ok').click();
// get setted date to compare
cy.get('.minds-list > minds-activity:first-child div.m-poster-date-selector__input div.m-tooltip--bubble')
.invoke('text').then((text) => {
scheduledDate = text;
});
// compare setted date with time_created
cy.get('.minds-list > minds-activity:first-child div.mdl-card__supporting-text > div.body > a.permalink > span')
.invoke('text').then((text) => {
const time_created = new Date(text).getTime();
scheduledDate = new Date(scheduledDate).getTime();
expect(scheduledDate).to.equal(time_created);
});
// Save
cy.get('.minds-list > minds-activity:first-child button.mdl-button.mdl-button--colored').click();
cy.wait('@saveEdited', { requestTimeout: 5000 }).then((xhr) => {
expect(xhr.status).to.equal(200, '**/api/v1/newsfeed/** request status');
});
// cleanup
cy.get('.minds-list > minds-activity:first-child m-post-menu .minds-more').click();
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('should list scheduled activies', () => {
cy.server();
cy.route("GET", '**/api/v2/feeds/scheduled/**/count?').as("scheduledCount");
cy.route("GET", '**/api/v2/feeds/scheduled/**/activities?**').as("scheduledActivities");
cy.get('minds-newsfeed-poster').then((poster) => {
if (poster.find('.m-poster-date-selector__input').length > 0) {
cy.server();
cy.route("GET", '**/api/v2/feeds/scheduled/**/count?').as("scheduledCount");
cy.route("GET", '**/api/v2/feeds/scheduled/**/activities?**').as("scheduledActivities");
cy.visit(`/${Cypress.env().username}`);
cy.visit(`/${Cypress.env().username}`);
cy.wait('@scheduledCount', { requestTimeout: 2000 }).then((xhr) => {
expect(xhr.status).to.equal(200, 'feeds/scheduled/**/count request status');
});
cy.wait('@scheduledCount', { requestTimeout: 2000 }).then((xhr) => {
expect(xhr.status).to.equal(200, 'feeds/scheduled/**/count request status');
});
cy.get('div.m-mindsListTools__scheduled').click();
cy.get('div.m-mindsListTools__scheduled').click();
cy.wait('@scheduledActivities', { requestTimeout: 2000 }).then((xhr) => {
expect(xhr.status).to.equal(200, 'feeds/scheduled/**/activities request status');
cy.wait('@scheduledActivities', { requestTimeout: 2000 }).then((xhr) => {
expect(xhr.status).to.equal(200, 'feeds/scheduled/**/activities request status');
});
}
});
})
it('should post an activity with an image attachment', () => {
......
......@@ -4,7 +4,10 @@
*/
import generateRandomId from '../support/utilities';
context('Notification', () => {
// Skipped until notifications are fixed on sandboxes
// See https://gitlab.com/minds/engine/issues/732
context.skip('Notification', () => {
//secondary user for testing.
let username = '';
......
......@@ -18,6 +18,7 @@ import { FeaturesService } from './services/features.service';
import { ThemeService } from './common/services/theme.service';
import { BannedService } from './modules/report/banned/banned.service';
import { DiagnosticsService } from './services/diagnostics.service';
import { RouterHistoryService } from './common/services/router-history.service';
@Component({
moduleId: module.id,
......@@ -52,7 +53,8 @@ export class Minds {
public featuresService: FeaturesService,
public themeService: ThemeService,
private bannedService: BannedService,
private diagnostics: DiagnosticsService
private diagnostics: DiagnosticsService,
private routerHistoryService: RouterHistoryService
) {
this.name = 'Minds';
}
......
import { NgModule } from '@angular/core';
import { CommonModule as NgCommonModule } from '@angular/common';
import { RouterModule } from '@angular/router';
import { RouterModule, Router } from '@angular/router';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MINDS_PIPES } from './pipes/pipes';
......@@ -105,6 +105,7 @@ import { ReferralsLinksComponent } from '../modules/wallet/tokens/referrals/link
import { PosterDateSelectorComponent } from './components/poster-date-selector/selector.component';
import { ChannelModeSelectorComponent } from './components/channel-mode-selector/channel-mode-selector.component';
import { ShareModalComponent } from '../modules/modals/share/share';
import { RouterHistoryService } from './services/router-history.service';
@NgModule({
imports: [NgCommonModule, RouterModule, FormsModule, ReactiveFormsModule],
......@@ -342,6 +343,11 @@ import { ShareModalComponent } from '../modules/modals/share/share';
new FeaturedContentService(boostedContentService),
deps: [FeedsService],
},
{
provide: RouterHistoryService,
useFactory: router => new RouterHistoryService(router),
deps: [Router],
},
],
entryComponents: [
NotificationsToasterComponent,
......
import { Router, RoutesRecognized, ActivatedRoute } from '@angular/router';
import { Subscription } from 'rxjs';
import { filter, pairwise } from 'rxjs/operators';
import { Injectable } from '@angular/core';
@Injectable()
export class RouterHistoryService {
eventsSubscription: Subscription;
history: Array<string> = [];
constructor(private router: Router) {
this.eventsSubscription = this.router.events
.pipe(
filter((e: any) => e instanceof RoutesRecognized),
pairwise()
)
.subscribe((e: any) => {
this.history.push(e[0].urlAfterRedirects);
});
}
getPreviousUrl(): string {
return this.history[this.history.length - 1];
}
}
......@@ -12,6 +12,7 @@
<minds-form-register
[referrer]="referrer"
(done)="registered()"
parentId="/login"
></minds-form-register>
</div>
</div>
......@@ -25,6 +25,7 @@
<minds-form-register
(done)="registered()"
[referrer]="referrer"
parentId="/register"
></minds-form-register>
</div>
</div>
......
......@@ -12,6 +12,7 @@ import { Client } from '../../../services/api';
import { Session } from '../../../services/session';
import { ReCaptchaComponent } from '../../../modules/captcha/recaptcha/recaptcha.component';
import { ExperimentsService } from '../../experiments/experiments.service';
import { RouterHistoryService } from '../../../common/services/router-history.service';
@Component({
moduleId: module.id,
......@@ -27,6 +28,7 @@ export class RegisterForm {
captcha: string;
takenUsername: boolean = false;
usernameValidationTimeout: any;
@Input() parentId: string = '';
showFbForm: boolean = false;
......@@ -43,7 +45,8 @@ export class RegisterForm {
public client: Client,
fb: FormBuilder,
public zone: NgZone,
private experiments: ExperimentsService
private experiments: ExperimentsService,
private routerHistoryService: RouterHistoryService
) {
this.form = fb.group({
username: ['', Validators.required],
......@@ -53,6 +56,7 @@ export class RegisterForm {
tos: [false],
exclusive_promotions: [false],
captcha: [''],
previousUrl: this.routerHistoryService.getPreviousUrl(),
});
}
......@@ -85,6 +89,7 @@ export class RegisterForm {
}
this.form.value.referrer = this.referrer;
this.form.value.parentId = this.parentId;
this.inProgress = true;
this.client
......
......@@ -24,7 +24,10 @@
</div>
<div class="m-homepage--signup" [hidden]="session.isLoggedIn()">
<minds-form-register (done)="registered()"></minds-form-register>
<minds-form-register
(done)="registered()"
parentId="/"
></minds-form-register>
<div class="m-homepage--app-buttons">
<div class="m-homepage--app-buttons__iosBanner">
......
......@@ -121,7 +121,7 @@ export class MindsVideoDirectHttpPlayer
try {
player.play();
} catch (e) {
console.error(e);
console.log(e);
}
}
......@@ -131,7 +131,7 @@ export class MindsVideoDirectHttpPlayer
try {
player.pause();
} catch (e) {
console.error(e);
console.log(e);
}
}
......@@ -146,13 +146,14 @@ export class MindsVideoDirectHttpPlayer
}
resumeFromTime(time: number = 0) {
// TODO detect if it's still transcoding
const player = this.getPlayer();
try {
player.currentTime = time;
this.play();
} catch (e) {
console.error(e);
console.log(e);
}
}
......
......@@ -195,7 +195,7 @@ export class MindsVideoTorrentPlayer
this.loadTorrent();
}
} catch (e) {
console.error(e);
console.log(e);
}
}
......@@ -205,7 +205,7 @@ export class MindsVideoTorrentPlayer
try {
player.pause();
} catch (e) {
console.error(e);
console.log(e);
}
}
......@@ -220,6 +220,7 @@ export class MindsVideoTorrentPlayer
}
resumeFromTime(time: number = 0) {
// TODO detect if it's still transcoding
const player = this.getPlayer();
try {
......@@ -234,7 +235,7 @@ export class MindsVideoTorrentPlayer
}
}
} catch (e) {
console.error(e);
console.log(e);
}
}
......
......@@ -183,7 +183,7 @@ export class MindsVideoComponent implements OnDestroy {
}
onError({ player, e }: { player?; e? } = {}) {
console.error('Received error when trying to reproduce video', e, player);
console.log('Received error when trying to reproduce video', e, player);
setTimeout(() => this.fallback(), 0);
}
......
......@@ -18,7 +18,7 @@ m-overlay-modal {
.m-overlay-modal--backdrop {
z-index: 9999995;
@include m-theme() {
background-color: rgba(themed($m-black-always), 0.85);
background-color: rgba(themed($m-black-always), 0.8);
}
}
......@@ -144,9 +144,6 @@ m-overlay-modal {
left: unquote('calc(50% - 50px)');
}
m-video--progress-bar {
.seeker-ball {
top: 4px;
}
.progress-bar {
margin-right: 8px;
}
......
......@@ -8,7 +8,7 @@
[hidden]="display == 'onboarding' || display == 'categories'"
>
<img
src="{{minds.cdn_assets_url}}assets/logos/logo.svg"
src="{{ minds.cdn_assets_url }}assets/logos/logo.svg"
(click)="close()"
/>
</div>
......@@ -69,6 +69,7 @@
(done)="done('register')"
(canceled)="close()"
*ngIf="display == 'register'"
parentId="/modal"
></minds-form-register>
<!-- FB Signin final phase -->
<minds-form-fb-register
......
......@@ -27,9 +27,9 @@ export class NewsfeedService {
channel = null,
clientMeta = {}
) {
if (!this.session.isLoggedIn()) {
return;
}
// if (!this.session.isLoggedIn()) {
// return;
// }
// if it's a boost we record the boost view AND the activity view
if (entity.boosted_guid) {
......