mirror of
https://github.com/wassname/talk.git
synced 2026-08-13 12:40:11 +08:00
replaced eslint:recommended with prettier
This commit is contained in:
+5
-5
@@ -1,13 +1,13 @@
|
||||
const mongoose = require('../../services/mongoose');
|
||||
const {shutdown} = require('../../bin/util');
|
||||
const { shutdown } = require('../../bin/util');
|
||||
|
||||
module.exports = {
|
||||
before: async (done) => {
|
||||
before: async done => {
|
||||
console.log('Dropping test database');
|
||||
await mongoose.connection.dropDatabase();
|
||||
done();
|
||||
},
|
||||
after: (done) => {
|
||||
after: done => {
|
||||
shutdown();
|
||||
done();
|
||||
},
|
||||
@@ -24,8 +24,8 @@ module.exports = {
|
||||
password: 'testtest',
|
||||
},
|
||||
comment: {
|
||||
body: 'This is a test comment'
|
||||
body: 'This is a test comment',
|
||||
},
|
||||
organizationName: 'Coral',
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
+116
-123
@@ -1,51 +1,41 @@
|
||||
module.exports = {
|
||||
commands: [{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin`;
|
||||
commands: [
|
||||
{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin`;
|
||||
},
|
||||
ready() {
|
||||
return this.waitForElementVisible('body');
|
||||
},
|
||||
openDrawer() {
|
||||
this.waitForElementVisible('@drawerButton').click('@drawerButton');
|
||||
this.expect.section('@drawer').to.be.visible;
|
||||
return this.section.drawer;
|
||||
},
|
||||
goToModerate() {
|
||||
this.click('@moderateNav').expect.section('@moderate').to.be.visible;
|
||||
return this.section.moderate;
|
||||
},
|
||||
goToStories() {
|
||||
this.click('@storiesNav').expect.section('@stories').to.be.visible;
|
||||
return this.section.stories;
|
||||
},
|
||||
goToCommunity() {
|
||||
this.click('@communityNav').expect.section('@community').to.be.visible;
|
||||
return this.section.community;
|
||||
},
|
||||
logout() {
|
||||
this.waitForElementVisible('@settingsButton')
|
||||
.click('@settingsButton')
|
||||
.waitForElementVisible('@signOutButton')
|
||||
.click('@signOutButton');
|
||||
},
|
||||
navigateAndLogin(user) {
|
||||
this.navigate().expect.section('@login').to.be.visible;
|
||||
return this.section.login.login(user);
|
||||
},
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
},
|
||||
openDrawer() {
|
||||
this
|
||||
.waitForElementVisible('@drawerButton')
|
||||
.click('@drawerButton');
|
||||
this.expect.section('@drawer').to.be.visible;
|
||||
return this.section.drawer;
|
||||
},
|
||||
goToModerate() {
|
||||
this
|
||||
.click('@moderateNav')
|
||||
.expect.section('@moderate').to.be.visible;
|
||||
return this.section.moderate;
|
||||
},
|
||||
goToStories() {
|
||||
this
|
||||
.click('@storiesNav')
|
||||
.expect.section('@stories').to.be.visible;
|
||||
return this.section.stories;
|
||||
},
|
||||
goToCommunity() {
|
||||
this
|
||||
.click('@communityNav')
|
||||
.expect.section('@community').to.be.visible;
|
||||
return this.section.community;
|
||||
},
|
||||
logout() {
|
||||
this
|
||||
.waitForElementVisible('@settingsButton')
|
||||
.click('@settingsButton')
|
||||
.waitForElementVisible('@signOutButton')
|
||||
.click('@signOutButton');
|
||||
},
|
||||
navigateAndLogin(user) {
|
||||
this
|
||||
.navigate()
|
||||
.expect.section('@login').to.be.visible;
|
||||
return this.section.login.login(user);
|
||||
},
|
||||
}],
|
||||
],
|
||||
elements: {
|
||||
drawerButton: '.mdl-layout__drawer-button',
|
||||
drawerOverlay: 'div.mdl-layout__obfuscator.is-visible',
|
||||
@@ -65,7 +55,7 @@ module.exports = {
|
||||
step1: '.talk-admin-suspend-user-dialog-step-1',
|
||||
confirmButton: '.talk-admin-suspend-user-dialog-confirm',
|
||||
sendButton: '.talk-admin-suspend-user-dialog-send',
|
||||
}
|
||||
},
|
||||
},
|
||||
usernameDialog: {
|
||||
selector: '.talk-admin-reject-username-dialog',
|
||||
@@ -74,41 +64,41 @@ module.exports = {
|
||||
step1: '.talk-admin-reject-username-dialog-step-1',
|
||||
buttons: '.talk-admin-reject-username-dialog-buttons',
|
||||
suspend: '.talk-admin-reject-username-dialog-button-k',
|
||||
suspensionMessage: '.talk-admin-reject-username-dialog-suspension-message',
|
||||
}
|
||||
suspensionMessage:
|
||||
'.talk-admin-reject-username-dialog-suspension-message',
|
||||
},
|
||||
},
|
||||
moderate: {
|
||||
selector: '.talk-admin-moderation-container',
|
||||
elements: {
|
||||
comment: '.talk-admin-moderate-comment',
|
||||
commentUsername: '.talk-admin-moderate-comment-username',
|
||||
}
|
||||
},
|
||||
},
|
||||
stories: {
|
||||
selector: '.talk-admin-stories',
|
||||
},
|
||||
community: {
|
||||
selector: '.talk-admin-community',
|
||||
commands: [{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin/community`;
|
||||
commands: [
|
||||
{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin/community`;
|
||||
},
|
||||
ready() {
|
||||
return this.waitForElementVisible('body');
|
||||
},
|
||||
goToPeople() {
|
||||
this.click('@peopleNav').expect.section('@people').to.be.visible;
|
||||
return this.section.people;
|
||||
},
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
},
|
||||
goToPeople() {
|
||||
this
|
||||
.click('@peopleNav')
|
||||
.expect.section('@people').to.be.visible;
|
||||
return this.section.people;
|
||||
},
|
||||
}],
|
||||
],
|
||||
elements: {
|
||||
peopleNav: '.talk-admin-nav-people',
|
||||
flaggedAccountsNav: '.talk-admin-nav-flagged-accounts',
|
||||
flaggedAccountsContainer: '.talk-adnin-community-flagged-accounts',
|
||||
flaggedUser:'.talk-admin-community-flagged-user',
|
||||
flaggedUser: '.talk-admin-community-flagged-user',
|
||||
flaggedUserApproveButton: '.talk-admin-flagged-user-approve-button',
|
||||
flaggedUserRejectButton: '.talk-admin-flagged-user-reject-button',
|
||||
},
|
||||
@@ -119,85 +109,88 @@ module.exports = {
|
||||
firstRow: '.talk-admin-community-people-row:first-child',
|
||||
dropdownStatus: '.talk-admin-community-people-dd-status',
|
||||
dropdownRole: '.talk-admin-community-people-dd-role',
|
||||
dropdownStatusActive: '.talk-admin-community-people-dd-status .is-upgraded',
|
||||
dropdownStatusActive:
|
||||
'.talk-admin-community-people-dd-status .is-upgraded',
|
||||
optionSuspendUser: '.action-menu-item#suspendUser',
|
||||
optionBanUser: '.action-menu-item#banUser',
|
||||
optionRemoveBan: '.action-menu-item#removeBan',
|
||||
optionRemoveSuspension: '.action-menu-item#removeSuspension',
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
userDetailDrawer: {
|
||||
selector: '.talk-admin-user-detail-drawer',
|
||||
elements: {
|
||||
'closeButton': '.talk-admin-user-detail-drawer-close-button',
|
||||
'tabBar': '.talk-admin-user-detail-tab-bar',
|
||||
'allTab': '.talk-admin-user-detail-all-tab',
|
||||
'rejectedTab': '.talk-admin-user-detail-rejected-tab',
|
||||
'historyTab': '.talk-admin-user-detail-history-tab',
|
||||
'historyPane': '.talk-admin-user-detail-history-tab-pane',
|
||||
'accountHistory': '.talk-admin-account-history',
|
||||
'accountHistoryRowStatus':'.talk-admin-account-history-row-status',
|
||||
'actionsMenu': '.talk-admin-user-detail-actions-button',
|
||||
'actionItemSuspendUser': '.action-menu-item#suspendUser',
|
||||
'actionMenuButton': '.talk-admin-user-detail-actions-menu #actions-dropdown-0',
|
||||
}
|
||||
closeButton: '.talk-admin-user-detail-drawer-close-button',
|
||||
tabBar: '.talk-admin-user-detail-tab-bar',
|
||||
allTab: '.talk-admin-user-detail-all-tab',
|
||||
rejectedTab: '.talk-admin-user-detail-rejected-tab',
|
||||
historyTab: '.talk-admin-user-detail-history-tab',
|
||||
historyPane: '.talk-admin-user-detail-history-tab-pane',
|
||||
accountHistory: '.talk-admin-account-history',
|
||||
accountHistoryRowStatus: '.talk-admin-account-history-row-status',
|
||||
actionsMenu: '.talk-admin-user-detail-actions-button',
|
||||
actionItemSuspendUser: '.action-menu-item#suspendUser',
|
||||
actionMenuButton:
|
||||
'.talk-admin-user-detail-actions-menu #actions-dropdown-0',
|
||||
},
|
||||
},
|
||||
drawer: {
|
||||
selector: '.talk-admin-drawer-nav',
|
||||
commands: [{
|
||||
goToStories() {
|
||||
this
|
||||
.click('@storiesButton');
|
||||
this.parent.expect.section('@stories').to.be.visible;
|
||||
this.close();
|
||||
return this.parent.section.stories;
|
||||
},
|
||||
goToCommunity() {
|
||||
this
|
||||
.click('@communityButton');
|
||||
this.parent.expect.section('@community').to.be.visible;
|
||||
this.close();
|
||||
return this.parent.section.stories;
|
||||
},
|
||||
close() {
|
||||
this.parent
|
||||
.click('@drawerOverlay')
|
||||
.waitForElementNotPresent('@drawerOverlay');
|
||||
commands: [
|
||||
{
|
||||
goToStories() {
|
||||
this.click('@storiesButton');
|
||||
this.parent.expect.section('@stories').to.be.visible;
|
||||
this.close();
|
||||
return this.parent.section.stories;
|
||||
},
|
||||
goToCommunity() {
|
||||
this.click('@communityButton');
|
||||
this.parent.expect.section('@community').to.be.visible;
|
||||
this.close();
|
||||
return this.parent.section.stories;
|
||||
},
|
||||
close() {
|
||||
this.parent
|
||||
.click('@drawerOverlay')
|
||||
.waitForElementNotPresent('@drawerOverlay');
|
||||
|
||||
// Wait a bit to let animations terminate cleanly.
|
||||
this.api.pause(200);
|
||||
// Wait a bit to let animations terminate cleanly.
|
||||
this.api.pause(200);
|
||||
|
||||
return this.parent;
|
||||
return this.parent;
|
||||
},
|
||||
},
|
||||
}],
|
||||
],
|
||||
elements: {
|
||||
'storiesButton': '.talk-admin-drawer-nav .talk-admin-nav-stories',
|
||||
'communityButton': '.talk-admin-drawer-nav .talk-admin-nav-community',
|
||||
storiesButton: '.talk-admin-drawer-nav .talk-admin-nav-stories',
|
||||
communityButton: '.talk-admin-drawer-nav .talk-admin-nav-community',
|
||||
},
|
||||
},
|
||||
login: {
|
||||
commands: [{
|
||||
login(user) {
|
||||
this
|
||||
.waitForElementVisible('@signInForm')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
const adminPage = this.api.page.admin();
|
||||
adminPage.expect.section('@moderate').to.be.visible;
|
||||
return adminPage.section.moderate;
|
||||
commands: [
|
||||
{
|
||||
login(user) {
|
||||
this.waitForElementVisible('@signInForm')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
const adminPage = this.api.page.admin();
|
||||
adminPage.expect.section('@moderate').to.be.visible;
|
||||
return adminPage.section.moderate;
|
||||
},
|
||||
},
|
||||
}],
|
||||
],
|
||||
selector: '.talk-admin-login',
|
||||
elements: {
|
||||
'signInForm': '.talk-admin-login-sign-in',
|
||||
'emailInput': '.talk-admin-login-sign-in #email',
|
||||
'passwordInput': '.talk-admin-login-sign-in #password',
|
||||
'signInButton': '.talk-admin-login-sign-in-button',
|
||||
}
|
||||
signInForm: '.talk-admin-login-sign-in',
|
||||
emailInput: '.talk-admin-login-sign-in #email',
|
||||
passwordInput: '.talk-admin-login-sign-in #password',
|
||||
signInButton: '.talk-admin-login-sign-in-button',
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -2,45 +2,47 @@ const iframeId = 'coralStreamEmbed_iframe';
|
||||
const SortedWindowHandler = require('../utils/SortedWindowHandler');
|
||||
|
||||
module.exports = {
|
||||
commands: [{
|
||||
ready: function() {
|
||||
this.switchToIframe();
|
||||
this.expect.section('@comments').to.be.visible;
|
||||
return this.section.comments;
|
||||
},
|
||||
goToConfigSection: function() {
|
||||
this.waitForElementVisible('@configTabButton');
|
||||
this.click('@configTabButton');
|
||||
this.expect.section('@config').to.be.visible;
|
||||
return this.section.config;
|
||||
},
|
||||
goToProfileSection: function() {
|
||||
this.waitForElementVisible('@profileTabButton');
|
||||
this.click('@profileTabButton');
|
||||
this.expect.section('@profile').to.be.visible;
|
||||
return this.section.profile;
|
||||
},
|
||||
goToCommentsSection: function() {
|
||||
this.waitForElementVisible('@commentsTabButton');
|
||||
this.click('@commentsTabButton');
|
||||
this.expect.section('@comments').to.be.visible;
|
||||
return this.section.comments;
|
||||
},
|
||||
navigateToAsset: function(asset) {
|
||||
this.api.url(`${this.api.launchUrl}/assets/title/${asset}`);
|
||||
return this;
|
||||
},
|
||||
switchToIframe: function() {
|
||||
this.waitForElementVisible('@iframe');
|
||||
commands: [
|
||||
{
|
||||
ready: function() {
|
||||
this.switchToIframe();
|
||||
this.expect.section('@comments').to.be.visible;
|
||||
return this.section.comments;
|
||||
},
|
||||
goToConfigSection: function() {
|
||||
this.waitForElementVisible('@configTabButton');
|
||||
this.click('@configTabButton');
|
||||
this.expect.section('@config').to.be.visible;
|
||||
return this.section.config;
|
||||
},
|
||||
goToProfileSection: function() {
|
||||
this.waitForElementVisible('@profileTabButton');
|
||||
this.click('@profileTabButton');
|
||||
this.expect.section('@profile').to.be.visible;
|
||||
return this.section.profile;
|
||||
},
|
||||
goToCommentsSection: function() {
|
||||
this.waitForElementVisible('@commentsTabButton');
|
||||
this.click('@commentsTabButton');
|
||||
this.expect.section('@comments').to.be.visible;
|
||||
return this.section.comments;
|
||||
},
|
||||
navigateToAsset: function(asset) {
|
||||
this.api.url(`${this.api.launchUrl}/assets/title/${asset}`);
|
||||
return this;
|
||||
},
|
||||
switchToIframe: function() {
|
||||
this.waitForElementVisible('@iframe');
|
||||
|
||||
// Pause a bit to let iframe initialize in the hope that it'll
|
||||
// fix https://www.browserstack.com/automate/builds/96419cf46e3d6376a36ae6d3f90934112df1ed91/sessions/224f1a1566c1c8c7859e2e76ece51862200f0173#automate_button
|
||||
this.api.pause(1000);
|
||||
// Pause a bit to let iframe initialize in the hope that it'll
|
||||
// fix https://www.browserstack.com/automate/builds/96419cf46e3d6376a36ae6d3f90934112df1ed91/sessions/224f1a1566c1c8c7859e2e76ece51862200f0173#automate_button
|
||||
this.api.pause(1000);
|
||||
|
||||
this.api.frame(iframeId);
|
||||
return this;
|
||||
this.api.frame(iframeId);
|
||||
return this;
|
||||
},
|
||||
},
|
||||
}],
|
||||
],
|
||||
url: function() {
|
||||
return this.api.launchUrl;
|
||||
},
|
||||
@@ -54,45 +56,43 @@ module.exports = {
|
||||
},
|
||||
sections: {
|
||||
comments: {
|
||||
commands: [{
|
||||
openLoginPopup(callback) {
|
||||
const windowHandler = new SortedWindowHandler(this.api);
|
||||
commands: [
|
||||
{
|
||||
openLoginPopup(callback) {
|
||||
const windowHandler = new SortedWindowHandler(this.api);
|
||||
|
||||
this
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
this.waitForElementVisible('@signInButton').click('@signInButton');
|
||||
|
||||
// Wait for window to be created
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button
|
||||
this.api.pause(200);
|
||||
// Wait for window to be created
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/17b1a79682bef2498cb0be86eac317a08c976b0a#automate_button
|
||||
this.api.pause(200);
|
||||
|
||||
// Focusing on the Login PopUp
|
||||
windowHandler.windowHandles((handles) => {
|
||||
this.api.switchWindow(handles[1]);
|
||||
// Focusing on the Login PopUp
|
||||
windowHandler.windowHandles(handles => {
|
||||
this.api.switchWindow(handles[1]);
|
||||
|
||||
const popup = this.api.page.popup().ready();
|
||||
callback(popup);
|
||||
const popup = this.api.page.popup().ready();
|
||||
callback(popup);
|
||||
|
||||
// Focus on the Embed Window.
|
||||
windowHandler.pop();
|
||||
// Focus on the Embed Window.
|
||||
windowHandler.pop();
|
||||
|
||||
// For some reasons firefox does not automatically load auth after login.
|
||||
// https://www.browserstack.com/automate/builds/37650cb4e66c6edce0ba0800a1c1b7e7f74bf991/sessions/7a4e9da69b0f9ecdf8b7fa9150639e47b1532cb0#automate_button
|
||||
if (this.api.capabilities.browserName === 'firefox') {
|
||||
this.parent.navigate().ready();
|
||||
} else {
|
||||
this.parent.switchToIframe();
|
||||
}
|
||||
});
|
||||
// For some reasons firefox does not automatically load auth after login.
|
||||
// https://www.browserstack.com/automate/builds/37650cb4e66c6edce0ba0800a1c1b7e7f74bf991/sessions/7a4e9da69b0f9ecdf8b7fa9150639e47b1532cb0#automate_button
|
||||
if (this.api.capabilities.browserName === 'firefox') {
|
||||
this.parent.navigate().ready();
|
||||
} else {
|
||||
this.parent.switchToIframe();
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
return this;
|
||||
},
|
||||
logout() {
|
||||
this.waitForElementVisible('@logoutButton').click('@logoutButton');
|
||||
},
|
||||
},
|
||||
logout() {
|
||||
this
|
||||
.waitForElementVisible('@logoutButton')
|
||||
.click('@logoutButton');
|
||||
},
|
||||
}],
|
||||
],
|
||||
selector: '.talk-embed-stream-comments-tab-pane',
|
||||
elements: {
|
||||
logoutButton: '.talk-stream-userbox-logout',
|
||||
@@ -100,10 +100,14 @@ module.exports = {
|
||||
commentBoxTextarea: '#commentText',
|
||||
commentBoxPostButton: '.talk-plugin-commentbox-button',
|
||||
firstComment: '.talk-stream-comment.talk-stream-comment-level-0',
|
||||
firstCommentContent: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-content',
|
||||
flagButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-flags-button',
|
||||
replyButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-replies-reply-button',
|
||||
respectButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button',
|
||||
firstCommentContent:
|
||||
'.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-content',
|
||||
flagButton:
|
||||
'.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-flags-button',
|
||||
replyButton:
|
||||
'.talk-stream-comment.talk-stream-comment-level-0 .talk-plugin-replies-reply-button',
|
||||
respectButton:
|
||||
'.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button',
|
||||
restrictedMessageBox: '.talk-restricted-message-box',
|
||||
changeUsernameInput: '.talk-change-username-username-input',
|
||||
changeUsernameSubmitButton: '.talk-change-username-submit-button',
|
||||
@@ -112,13 +116,14 @@ module.exports = {
|
||||
flag: {
|
||||
selector: '.talk-plugin-flags-popup',
|
||||
elements: {
|
||||
offensiveUsernameRadio: '.talk-plugin-flags-popup-radio#USERNAME_OFFENSIVE',
|
||||
offensiveUsernameRadio:
|
||||
'.talk-plugin-flags-popup-radio#USERNAME_OFFENSIVE',
|
||||
flagUsernameRadio: '.talk-plugin-flags-popup-radio#USERS',
|
||||
flagCommentRadio: '.talk-plugin-flags-popup-radio#COMMENTS',
|
||||
continueButton: '.talk-plugin-flags-popup-button',
|
||||
popUpText: '.talk-plugin-flags-popup-text',
|
||||
spamCommentRadio: '.talk-plugin-flags-popup-radio#COMMENT_SPAM',
|
||||
}
|
||||
},
|
||||
},
|
||||
mod: {
|
||||
selector: '.talk-plugin-moderation-actions',
|
||||
@@ -135,9 +140,12 @@ module.exports = {
|
||||
elements: {
|
||||
notLoggedIn: '.talk-embed-stream-not-logged-in',
|
||||
myCommentHistory: '.talk-my-profile-comment-history',
|
||||
myCommentHistoryReactions: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions',
|
||||
myCommentHistoryReactionCount: '.talk-my-profile-comment-history .comment-summary .comment-summary-reactions .comment-summary-reaction-count',
|
||||
myCommentHistoryComment: '.talk-my-profile-comment-history .my-comment-body',
|
||||
myCommentHistoryReactions:
|
||||
'.talk-my-profile-comment-history .comment-summary .comment-summary-reactions',
|
||||
myCommentHistoryReactionCount:
|
||||
'.talk-my-profile-comment-history .comment-summary .comment-summary-reactions .comment-summary-reaction-count',
|
||||
myCommentHistoryComment:
|
||||
'.talk-my-profile-comment-history .my-comment-body',
|
||||
},
|
||||
},
|
||||
config: {
|
||||
@@ -146,20 +154,22 @@ module.exports = {
|
||||
openStream: '.talk-config-close-comments-open-button',
|
||||
closeStream: '.talk-config-close-comments-close-button',
|
||||
},
|
||||
commands: [{
|
||||
openStream: function() {
|
||||
this.waitForElementVisible('@openStream');
|
||||
this.click('@openStream');
|
||||
this.waitForElementVisible('@closeStream');
|
||||
return this.section.config;
|
||||
commands: [
|
||||
{
|
||||
openStream: function() {
|
||||
this.waitForElementVisible('@openStream');
|
||||
this.click('@openStream');
|
||||
this.waitForElementVisible('@closeStream');
|
||||
return this.section.config;
|
||||
},
|
||||
closeStream: function() {
|
||||
this.waitForElementVisible('@closeStream');
|
||||
this.click('@closeStream');
|
||||
this.waitForElementVisible('@openStream');
|
||||
return this.section.config;
|
||||
},
|
||||
},
|
||||
closeStream: function() {
|
||||
this.waitForElementVisible('@closeStream');
|
||||
this.click('@closeStream');
|
||||
this.waitForElementVisible('@openStream');
|
||||
return this.section.config;
|
||||
},
|
||||
}]
|
||||
],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
module.exports = {
|
||||
commands: [{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin/install`;
|
||||
commands: [
|
||||
{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin/install`;
|
||||
},
|
||||
ready() {
|
||||
return this.waitForElementVisible('body');
|
||||
},
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
}
|
||||
}],
|
||||
],
|
||||
sections: {
|
||||
step1: {
|
||||
selector: '.talk-install-step-1',
|
||||
|
||||
@@ -1,32 +1,31 @@
|
||||
module.exports = {
|
||||
commands: [{
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
commands: [
|
||||
{
|
||||
ready() {
|
||||
return this.waitForElementVisible('body');
|
||||
},
|
||||
login(user) {
|
||||
return this.setValue('@emailInput', user.email)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.waitForElementVisible('@signIn')
|
||||
.waitForElementVisible('@loginButton')
|
||||
.click('@loginButton');
|
||||
},
|
||||
register(user) {
|
||||
return this.waitForElementVisible('@registerButton')
|
||||
.click('@registerButton')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@usernameInput', user.username)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.setValue('@confirmPasswordInput', user.password)
|
||||
.waitForElementVisible('@signUpButton')
|
||||
.click('@signUpButton')
|
||||
.waitForElementVisible('@signIn')
|
||||
.waitForElementVisible('@loginButton')
|
||||
.click('@loginButton');
|
||||
},
|
||||
},
|
||||
login(user) {
|
||||
return this
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.waitForElementVisible('@signIn')
|
||||
.waitForElementVisible('@loginButton')
|
||||
.click('@loginButton');
|
||||
},
|
||||
register(user) {
|
||||
return this
|
||||
.waitForElementVisible('@registerButton')
|
||||
.click('@registerButton')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@usernameInput', user.username)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.setValue('@confirmPasswordInput', user.password)
|
||||
.waitForElementVisible('@signUpButton')
|
||||
.click('@signUpButton')
|
||||
.waitForElementVisible('@signIn')
|
||||
.waitForElementVisible('@loginButton')
|
||||
.click('@loginButton');
|
||||
},
|
||||
}],
|
||||
],
|
||||
elements: {
|
||||
registerButton: '#coralRegister',
|
||||
signInButton: '#coralSignInButton',
|
||||
@@ -36,6 +35,6 @@ module.exports = {
|
||||
confirmPasswordInput: '#confirmPassword',
|
||||
signUpButton: '#coralSignUpButton',
|
||||
signIn: '.coral-sign-in',
|
||||
loginButton: '#coralLogInButton'
|
||||
loginButton: '#coralLogInButton',
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "@coralproject/eslint-config-talk",
|
||||
"extends": "../../.eslintrc.json",
|
||||
"rules": {
|
||||
"indent": "off"
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
'@tags': ['install'],
|
||||
|
||||
before: (client) => {
|
||||
before: client => {
|
||||
client.setWindowPosition(0, 0);
|
||||
client.resizeWindow(1600, 1200);
|
||||
},
|
||||
@@ -13,34 +13,28 @@ module.exports = {
|
||||
done();
|
||||
},
|
||||
|
||||
after: (client) => {
|
||||
after: client => {
|
||||
client.end();
|
||||
},
|
||||
|
||||
'User goes to install': (client) => {
|
||||
'User goes to install': client => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.navigate()
|
||||
.expect.section('@step1').to.be.visible;
|
||||
|
||||
install.navigate().expect.section('@step1').to.be.visible;
|
||||
},
|
||||
'User clicks get started button': (client) => {
|
||||
'User clicks get started button': client => {
|
||||
const step1 = client.page.install().section.step1;
|
||||
|
||||
step1
|
||||
.waitForElementVisible('@getStartedButton')
|
||||
.click('@getStartedButton');
|
||||
step1.waitForElementVisible('@getStartedButton').click('@getStartedButton');
|
||||
},
|
||||
'User should see step 2 - Add Organization Name': (client) => {
|
||||
'User should see step 2 - Add Organization Name': client => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step2').to.be.visible;
|
||||
install.expect.section('@step2').to.be.visible;
|
||||
},
|
||||
'User fills step 2': (client) => {
|
||||
'User fills step 2': client => {
|
||||
const step2 = client.page.install().section.step2;
|
||||
const {testData} = client.globals;
|
||||
const { testData } = client.globals;
|
||||
|
||||
step2
|
||||
.waitForElementVisible('@organizationNameInput')
|
||||
@@ -48,15 +42,14 @@ module.exports = {
|
||||
.waitForElementVisible('@saveButton')
|
||||
.click('@saveButton');
|
||||
},
|
||||
'User should see step 3 - Create your account': (client) => {
|
||||
'User should see step 3 - Create your account': client => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step3').to.be.visible;
|
||||
install.expect.section('@step3').to.be.visible;
|
||||
},
|
||||
'User fills step 3': (client) => {
|
||||
'User fills step 3': client => {
|
||||
const step3 = client.page.install().section.step3;
|
||||
const {testData: {admin}} = client.globals;
|
||||
const { testData: { admin } } = client.globals;
|
||||
|
||||
step3
|
||||
.setValue('@emailInput', admin.email)
|
||||
@@ -66,13 +59,12 @@ module.exports = {
|
||||
.waitForElementVisible('@saveButton')
|
||||
.click('@saveButton');
|
||||
},
|
||||
'User should see step 4 - Domain Whitelist': (client) => {
|
||||
'User should see step 4 - Domain Whitelist': client => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step4').to.be.visible;
|
||||
install.expect.section('@step4').to.be.visible;
|
||||
},
|
||||
'User fills step 4': (client) => {
|
||||
'User fills step 4': client => {
|
||||
const step4 = client.page.install().section.step4;
|
||||
|
||||
step4
|
||||
@@ -81,14 +73,11 @@ module.exports = {
|
||||
|
||||
client.keys(client.Keys.ENTER);
|
||||
|
||||
step4
|
||||
.waitForElementVisible('@saveButton')
|
||||
.click('@saveButton');
|
||||
step4.waitForElementVisible('@saveButton').click('@saveButton');
|
||||
},
|
||||
'User should see step 5 - Final Step': (client) => {
|
||||
'User should see step 5 - Final Step': client => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step5').to.be.visible;
|
||||
install.expect.section('@step5').to.be.visible;
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
'@tags': ['admin', 'login'],
|
||||
|
||||
before: (client) => {
|
||||
before: client => {
|
||||
client.setWindowPosition(0, 0);
|
||||
client.resizeWindow(1024, 800);
|
||||
},
|
||||
@@ -13,31 +13,26 @@ module.exports = {
|
||||
done();
|
||||
},
|
||||
|
||||
after: (client) => {
|
||||
after: client => {
|
||||
client.end();
|
||||
},
|
||||
|
||||
'Admin logs in': (client) => {
|
||||
'Admin logs in': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {testData: {admin}} = client.globals;
|
||||
const { testData: { admin } } = client.globals;
|
||||
|
||||
adminPage.navigateAndLogin(admin);
|
||||
},
|
||||
|
||||
'Admin goes to Stories': (client) => {
|
||||
'Admin goes to Stories': client => {
|
||||
const adminPage = client.page.admin();
|
||||
|
||||
adminPage
|
||||
.openDrawer()
|
||||
.goToStories();
|
||||
adminPage.openDrawer().goToStories();
|
||||
},
|
||||
|
||||
'Admin goes to Community': (client) => {
|
||||
'Admin goes to Community': client => {
|
||||
const adminPage = client.page.admin();
|
||||
|
||||
adminPage
|
||||
.openDrawer()
|
||||
.goToCommunity();
|
||||
|
||||
adminPage.openDrawer().goToCommunity();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module.exports = {
|
||||
'@tags': ['embedStream', 'login'],
|
||||
|
||||
before: (client) => {
|
||||
before: client => {
|
||||
client.setWindowPosition(0, 0);
|
||||
client.resizeWindow(1600, 1200);
|
||||
},
|
||||
@@ -13,12 +13,11 @@ module.exports = {
|
||||
done();
|
||||
},
|
||||
|
||||
after: (client) => {
|
||||
after: client => {
|
||||
client.end();
|
||||
},
|
||||
|
||||
'creates a new asset': (client) => {
|
||||
|
||||
'creates a new asset': client => {
|
||||
const asset = 'newAssetTest';
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
@@ -28,24 +27,20 @@ module.exports = {
|
||||
.ready();
|
||||
},
|
||||
|
||||
'creates an user and user logs in': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
'creates an user and user logs in': client => {
|
||||
const { testData: { user } } = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
// Go back to default asset.
|
||||
const comments =
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
const comments = embedStream.navigate().ready();
|
||||
|
||||
comments
|
||||
.openLoginPopup((popup) => {
|
||||
popup.register(user);
|
||||
});
|
||||
comments.openLoginPopup(popup => {
|
||||
popup.register(user);
|
||||
});
|
||||
},
|
||||
'user posts a comment': (client) => {
|
||||
'user posts a comment': client => {
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
const {testData: {comment}} = client.globals;
|
||||
const { testData: { comment } } = client.globals;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@commentBoxTextarea')
|
||||
@@ -53,39 +48,37 @@ module.exports = {
|
||||
.waitForElementVisible('@commentBoxPostButton')
|
||||
.click('@commentBoxPostButton')
|
||||
.waitForElementVisible('@firstCommentContent')
|
||||
.getText('@firstCommentContent', (result) => {
|
||||
.getText('@firstCommentContent', result => {
|
||||
comments.assert.equal(result.value, comment.body);
|
||||
});
|
||||
},
|
||||
|
||||
'signed in user sees comment history': (client) => {
|
||||
'signed in user sees comment history': client => {
|
||||
const profile = client.page.embedStream().goToProfileSection();
|
||||
const {testData: {comment}} = client.globals;
|
||||
const { testData: { comment } } = client.globals;
|
||||
|
||||
profile
|
||||
.waitForElementVisible('@myCommentHistory')
|
||||
.waitForElementVisible('@myCommentHistoryComment')
|
||||
.getText('@myCommentHistoryComment', (result) => {
|
||||
.getText('@myCommentHistoryComment', result => {
|
||||
profile.assert.equal(result.value, comment.body);
|
||||
});
|
||||
},
|
||||
'user sees replies and reactions to comments': (client) => {
|
||||
'user sees replies and reactions to comments': client => {
|
||||
const profile = client.page.embedStream().section.profile;
|
||||
|
||||
profile
|
||||
.waitForElementVisible('@myCommentHistory')
|
||||
.waitForElementVisible('@myCommentHistoryReactions')
|
||||
.waitForElementVisible('@myCommentHistoryReactionCount')
|
||||
.getText('@myCommentHistoryReactionCount', (result) => {
|
||||
.getText('@myCommentHistoryReactionCount', result => {
|
||||
profile.assert.equal(result.value, '0');
|
||||
});
|
||||
},
|
||||
'user goes to the stream and replies and reacts to comment': (client) => {
|
||||
'user goes to the stream and replies and reacts to comment': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.goToCommentsSection();
|
||||
comments
|
||||
.waitForElementVisible('@respectButton')
|
||||
.click('@respectButton');
|
||||
comments.waitForElementVisible('@respectButton').click('@respectButton');
|
||||
|
||||
const profile = embedStream.goToProfileSection();
|
||||
|
||||
@@ -93,35 +86,32 @@ module.exports = {
|
||||
.waitForElementVisible('@myCommentHistory')
|
||||
.waitForElementVisible('@myCommentHistoryReactions')
|
||||
.waitForElementVisible('@myCommentHistoryReactionCount')
|
||||
.getText('@myCommentHistoryReactionCount', (result) => {
|
||||
.getText('@myCommentHistoryReactionCount', result => {
|
||||
profile.assert.equal(result.value, '1');
|
||||
});
|
||||
},
|
||||
'user logs out': (client) => {
|
||||
'user logs out': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.goToCommentsSection();
|
||||
|
||||
comments
|
||||
.logout();
|
||||
comments.logout();
|
||||
},
|
||||
'not logged in user clicks my profile tab': (client) => {
|
||||
'not logged in user clicks my profile tab': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const profile = embedStream.goToProfileSection();
|
||||
|
||||
profile
|
||||
.assert.visible('@notLoggedIn');
|
||||
profile.assert.visible('@notLoggedIn');
|
||||
},
|
||||
'admin logs in': (client) => {
|
||||
const {testData: {admin}} = client.globals;
|
||||
'admin logs in': client => {
|
||||
const { testData: { admin } } = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready()
|
||||
.openLoginPopup((popup) => popup.login(admin));
|
||||
.openLoginPopup(popup => popup.login(admin));
|
||||
},
|
||||
'admin closes stream, users won\'t be able to perform some actions: reply ': (client) => {
|
||||
|
||||
"admin closes stream, users won't be able to perform some actions: reply ": client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
@@ -129,24 +119,19 @@ module.exports = {
|
||||
.waitForElementVisible('@firstComment')
|
||||
.waitForElementVisible('@replyButton');
|
||||
|
||||
embedStream
|
||||
.goToConfigSection()
|
||||
.closeStream();
|
||||
embedStream.goToConfigSection().closeStream();
|
||||
|
||||
embedStream
|
||||
.goToCommentsSection()
|
||||
.waitForElementVisible('@firstComment')
|
||||
.waitForElementNotPresent('@replyButton');
|
||||
|
||||
embedStream
|
||||
.goToConfigSection()
|
||||
.openStream();
|
||||
embedStream.goToConfigSection().openStream();
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
'admin logs out': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.goToCommentsSection();
|
||||
|
||||
comments
|
||||
.logout();
|
||||
comments.logout();
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module.exports = {
|
||||
|
||||
before: (client) => {
|
||||
before: client => {
|
||||
client.setWindowPosition(0, 0);
|
||||
client.resizeWindow(1600, 1200);
|
||||
},
|
||||
@@ -12,17 +11,17 @@ module.exports = {
|
||||
done();
|
||||
},
|
||||
|
||||
after: (client) => {
|
||||
after: client => {
|
||||
client.end();
|
||||
},
|
||||
|
||||
'admin logs in': (client) => {
|
||||
'admin logs in': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {testData: {admin}} = client.globals;
|
||||
const { testData: { admin } } = client.globals;
|
||||
|
||||
adminPage.navigateAndLogin(admin);
|
||||
},
|
||||
'admin flags users username as offensive': (client) => {
|
||||
'admin flags users username as offensive': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const comments = embedStream.navigate().ready();
|
||||
@@ -43,7 +42,7 @@ module.exports = {
|
||||
.waitForElementVisible('@popUpText')
|
||||
.click('@continueButton');
|
||||
},
|
||||
'admin goes to Reported Usernames': (client) => {
|
||||
'admin goes to Reported Usernames': client => {
|
||||
const adminPage = client.page.admin();
|
||||
|
||||
const community = adminPage
|
||||
@@ -55,48 +54,47 @@ module.exports = {
|
||||
.waitForElementVisible('@flaggedAccountsContainer')
|
||||
.waitForElementVisible('@flaggedUser');
|
||||
},
|
||||
'admin rejects the user flag': (client) => {
|
||||
'admin rejects the user flag': client => {
|
||||
const community = client.page.admin().section.community;
|
||||
|
||||
community
|
||||
.waitForElementVisible('@flaggedUserRejectButton')
|
||||
.click('@flaggedUserRejectButton');
|
||||
},
|
||||
'admin suspends the user': (client) => {
|
||||
'admin suspends the user': client => {
|
||||
const community = client.page.admin().section.community;
|
||||
const usernameDialog = client.page.admin().section.usernameDialog;
|
||||
|
||||
usernameDialog
|
||||
.waitForElementVisible('@buttons')
|
||||
.waitForElementVisible('@step0')
|
||||
.waitForElementVisible('@suspend')
|
||||
.waitForElementVisible('@step0')
|
||||
.waitForElementVisible('@suspend')
|
||||
.click('@suspend')
|
||||
.waitForElementVisible('@step1')
|
||||
.waitForElementVisible('@step1')
|
||||
.waitForElementVisible('@suspend')
|
||||
.click('@suspend');
|
||||
|
||||
community
|
||||
.waitForElementNotPresent('@flaggedUser');
|
||||
|
||||
community.waitForElementNotPresent('@flaggedUser');
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
'admin logs out': client => {
|
||||
client.page.admin().logout();
|
||||
},
|
||||
'user logs in': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
'user logs in': client => {
|
||||
const { testData: { user } } = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready()
|
||||
.openLoginPopup((popup) => popup.login(user));
|
||||
.openLoginPopup(popup => popup.login(user));
|
||||
},
|
||||
'user account is suspended, should see restricted message box': (client) => {
|
||||
'user account is suspended, should see restricted message box': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments.waitForElementVisible('@restrictedMessageBox');
|
||||
},
|
||||
'user should not be able to comment': (client) => {
|
||||
'user should not be able to comment': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
@@ -104,10 +102,10 @@ module.exports = {
|
||||
.waitForElementNotPresent('@commentBoxTextarea')
|
||||
.waitForElementNotPresent('@commentBoxPostButton');
|
||||
},
|
||||
'user picks another username': (client) => {
|
||||
'user picks another username': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
const {testData: {user}} = client.globals;
|
||||
const { testData: { user } } = client.globals;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@changeUsernameInput')
|
||||
@@ -116,7 +114,7 @@ module.exports = {
|
||||
.click('@changeUsernameSubmitButton')
|
||||
.waitForElementNotPresent('@changeUsernameInput');
|
||||
},
|
||||
'user should be able to comment': (client) => {
|
||||
'user should be able to comment': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module.exports = {
|
||||
|
||||
before: (client) => {
|
||||
before: client => {
|
||||
client.setWindowPosition(0, 0);
|
||||
client.resizeWindow(1600, 1200);
|
||||
},
|
||||
@@ -12,24 +11,22 @@ module.exports = {
|
||||
done();
|
||||
},
|
||||
|
||||
after: (client) => {
|
||||
after: client => {
|
||||
client.end();
|
||||
},
|
||||
|
||||
'admin logs in': (client) => {
|
||||
'admin logs in': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {testData: {admin}} = client.globals;
|
||||
const { testData: { admin } } = client.globals;
|
||||
|
||||
adminPage.navigateAndLogin(admin);
|
||||
},
|
||||
'navigate to the embed stream': (client) => {
|
||||
'navigate to the embed stream': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
embedStream.navigate().ready();
|
||||
},
|
||||
'admin bans user': (client) => {
|
||||
'admin bans user': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
@@ -46,50 +43,42 @@ module.exports = {
|
||||
.click('@banDialogConfirmButton')
|
||||
.waitForElementNotVisible('@banDialog');
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
'admin logs out': client => {
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
|
||||
comments
|
||||
.logout();
|
||||
comments.logout();
|
||||
},
|
||||
'user logs in': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
'user logs in': client => {
|
||||
const { testData: { user } } = client.globals;
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
|
||||
comments
|
||||
.openLoginPopup((popup) => popup.login(user));
|
||||
comments.openLoginPopup(popup => popup.login(user));
|
||||
},
|
||||
'user account is banned, should see restricted message box': (client) => {
|
||||
'user account is banned, should see restricted message box': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@restrictedMessageBox');
|
||||
comments.waitForElementVisible('@restrictedMessageBox');
|
||||
},
|
||||
'user logs out': (client) => {
|
||||
'user logs out': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments
|
||||
.logout();
|
||||
comments.logout();
|
||||
},
|
||||
'admin logs in (2)': (client) => {
|
||||
'admin logs in (2)': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {testData: {admin}} = client.globals;
|
||||
const { testData: { admin } } = client.globals;
|
||||
|
||||
adminPage.navigateAndLogin(admin);
|
||||
},
|
||||
'admin goes to community': (client) => {
|
||||
'admin goes to community': client => {
|
||||
const adminPage = client.page.admin();
|
||||
|
||||
adminPage
|
||||
.goToCommunity()
|
||||
.goToPeople();
|
||||
adminPage.goToCommunity().goToPeople();
|
||||
},
|
||||
'admin removes ban from user': (client) => {
|
||||
const people = client.page.admin()
|
||||
.section.community
|
||||
.section.people;
|
||||
'admin removes ban from user': client => {
|
||||
const people = client.page.admin().section.community.section.people;
|
||||
|
||||
people
|
||||
.waitForElementVisible('@firstRow')
|
||||
@@ -98,24 +87,21 @@ module.exports = {
|
||||
.waitForElementVisible('@dropdownStatusActive')
|
||||
.click('@optionRemoveBan');
|
||||
},
|
||||
'admin logs out 2': (client) => {
|
||||
'admin logs out 2': client => {
|
||||
client.page.admin().logout();
|
||||
},
|
||||
'navigate to the embed stream 2': (client) => {
|
||||
'navigate to the embed stream 2': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
embedStream.navigate().ready();
|
||||
},
|
||||
'user logs in 2': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
'user logs in 2': client => {
|
||||
const { testData: { user } } = client.globals;
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
|
||||
comments
|
||||
.openLoginPopup((popup) => popup.login(user));
|
||||
comments.openLoginPopup(popup => popup.login(user));
|
||||
},
|
||||
'user should be able to comment': (client) => {
|
||||
'user should be able to comment': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
module.exports = {
|
||||
|
||||
before: (client) => {
|
||||
before: client => {
|
||||
client.setWindowPosition(0, 0);
|
||||
client.resizeWindow(1600, 1200);
|
||||
},
|
||||
@@ -12,24 +11,21 @@ module.exports = {
|
||||
done();
|
||||
},
|
||||
|
||||
after: (client) => {
|
||||
after: client => {
|
||||
client.end();
|
||||
},
|
||||
'user logs in': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
'user logs in': client => {
|
||||
const { testData: { user } } = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
embedStream.navigate().ready();
|
||||
|
||||
comments
|
||||
.openLoginPopup((popup) => popup.login(user));
|
||||
comments.openLoginPopup(popup => popup.login(user));
|
||||
},
|
||||
'user posts comment': (client) => {
|
||||
'user posts comment': client => {
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
const {testData: {comment}} = client.globals;
|
||||
const { testData: { comment } } = client.globals;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@commentBoxTextarea')
|
||||
@@ -37,31 +33,28 @@ module.exports = {
|
||||
.waitForElementVisible('@commentBoxPostButton')
|
||||
.click('@commentBoxPostButton')
|
||||
.waitForElementVisible('@firstCommentContent')
|
||||
.getText('@firstCommentContent', (result) => {
|
||||
.getText('@firstCommentContent', result => {
|
||||
comments.assert.equal(result.value, comment.body);
|
||||
});
|
||||
},
|
||||
'user logs out': (client) => {
|
||||
'user logs out': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments
|
||||
.logout();
|
||||
comments.logout();
|
||||
},
|
||||
'admin logs in': (client) => {
|
||||
'admin logs in': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {testData: {admin}} = client.globals;
|
||||
const { testData: { admin } } = client.globals;
|
||||
|
||||
adminPage.navigateAndLogin(admin);
|
||||
},
|
||||
'navigate to the embed stream': (client) => {
|
||||
'navigate to the embed stream': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
embedStream.navigate().ready();
|
||||
},
|
||||
'admin reports comment': (client) => {
|
||||
'admin reports comment': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
@@ -81,9 +74,9 @@ module.exports = {
|
||||
.waitForElementVisible('@popUpText')
|
||||
.click('@continueButton');
|
||||
},
|
||||
'admin suspends user': (client) => {
|
||||
'admin suspends user': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {moderate, userDetailDrawer, suspendUserDialog} = adminPage.section;
|
||||
const { moderate, userDetailDrawer, suspendUserDialog } = adminPage.section;
|
||||
|
||||
adminPage
|
||||
.navigate()
|
||||
@@ -113,11 +106,10 @@ module.exports = {
|
||||
.waitForElementVisible('@toast')
|
||||
.waitForElementVisible('@toastClose')
|
||||
.click('@toastClose');
|
||||
|
||||
},
|
||||
'admin checks user status and ban and suspension history': (client) => {
|
||||
'admin checks user status and ban and suspension history': client => {
|
||||
const adminPage = client.page.admin();
|
||||
const {moderate, userDetailDrawer} = adminPage.section;
|
||||
const { moderate, userDetailDrawer } = adminPage.section;
|
||||
|
||||
moderate
|
||||
.waitForElementVisible('@comment')
|
||||
@@ -136,29 +128,24 @@ module.exports = {
|
||||
.waitForElementVisible('@accountHistory')
|
||||
.click('@closeButton');
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
'admin logs out': client => {
|
||||
const adminPage = client.page.admin();
|
||||
|
||||
adminPage
|
||||
.logout();
|
||||
adminPage.logout();
|
||||
},
|
||||
'user logs in (2)': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
'user logs in (2)': client => {
|
||||
const { testData: { user } } = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = client.page.embedStream().section.comments;
|
||||
|
||||
embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
embedStream.navigate().ready();
|
||||
|
||||
comments
|
||||
.openLoginPopup((popup) => popup.login(user));
|
||||
comments.openLoginPopup(popup => popup.login(user));
|
||||
},
|
||||
'user account is suspended, should see restricted message box': (client) => {
|
||||
'user account is suspended, should see restricted message box': client => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@restrictedMessageBox');
|
||||
comments.waitForElementVisible('@restrictedMessageBox');
|
||||
},
|
||||
};
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/**
|
||||
* SortedWindowHandler assists in making e2e tests more robust by returning
|
||||
* deterministic window handles. An instance must be created before new windows
|
||||
@@ -6,16 +5,17 @@
|
||||
* closed.
|
||||
*/
|
||||
class SortedWindowHandler {
|
||||
|
||||
/**
|
||||
* Constructor, must be called before new windows were created.
|
||||
*/
|
||||
constructor(client) {
|
||||
this.client = client;
|
||||
this.client.windowHandles((result) => {
|
||||
this.client.windowHandles(result => {
|
||||
this.handles = result.value;
|
||||
if (this.handles.length > 2) {
|
||||
throw new Error('SortedWindowHandler must be created before new windows were created.');
|
||||
throw new Error(
|
||||
'SortedWindowHandler must be created before new windows were created.'
|
||||
);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -24,20 +24,25 @@ class SortedWindowHandler {
|
||||
* windowHandles will call given `callback` with an array of window handles.
|
||||
*/
|
||||
windowHandles(callback) {
|
||||
this.client.windowHandles((result) => {
|
||||
|
||||
this.client.windowHandles(result => {
|
||||
if (result.value.message) {
|
||||
throw new Error(result.value.message);
|
||||
}
|
||||
|
||||
this.handles = this.handles.filter((handle) => result.value.includes(handle));
|
||||
const remaining = result.value.filter((handle) => !this.handles.includes(handle));
|
||||
this.handles = this.handles.filter(handle =>
|
||||
result.value.includes(handle)
|
||||
);
|
||||
const remaining = result.value.filter(
|
||||
handle => !this.handles.includes(handle)
|
||||
);
|
||||
|
||||
if (remaining.length === 1) {
|
||||
this.handles.push(remaining[0]);
|
||||
}
|
||||
if (remaining.length > 1) {
|
||||
throw new Error('Cannot detect new window handle, because more than one windows was created.');
|
||||
throw new Error(
|
||||
'Cannot detect new window handle, because more than one windows was created.'
|
||||
);
|
||||
}
|
||||
callback(this.handles);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user