mirror of
https://github.com/wassname/talk.git
synced 2026-07-15 11:26:58 +08:00
Merge branch 'master'
Conflicts: client/coral-admin/src/containers/ModerationQueue/ModerationQueue.js
This commit is contained in:
+16
-2
@@ -1,4 +1,18 @@
|
||||
module.exports = {
|
||||
waitForConditionTimeout: 20000,
|
||||
baseUrl: 'localhost:3011/'
|
||||
waitForConditionTimeout: 8000,
|
||||
baseUrl: 'http://localhost:3000',
|
||||
users: {
|
||||
admin: {
|
||||
email: 'admin@test.com',
|
||||
pass: 'test'
|
||||
},
|
||||
moderator: {
|
||||
email: 'moderator@test.com',
|
||||
pass: 'test'
|
||||
},
|
||||
commenter: {
|
||||
email: 'commenter@test.com',
|
||||
pass: 'test'
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
const embedStreamCommands = {
|
||||
url: function () {
|
||||
return `${this.api.launchUrl}/admin`;
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body', 2000);
|
||||
},
|
||||
approveComment() {
|
||||
return this
|
||||
.waitForElementVisible('@commentList')
|
||||
.waitForElementVisible('@approveButton')
|
||||
.click('@approveButton');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
commands: [embedStreamCommands],
|
||||
elements: {
|
||||
commentList: {
|
||||
selector: '#commentList'
|
||||
},
|
||||
banButton: {
|
||||
selector: '#commentList .actions:first-child .ban'
|
||||
},
|
||||
rejectButton: {
|
||||
selector: '#commentList .actions:first-child .reject'
|
||||
},
|
||||
approveButton: {
|
||||
selector: '#commentList .actions:first-child .approve'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -1,45 +0,0 @@
|
||||
const fetch = require('node-fetch');
|
||||
|
||||
const embedCommands = {
|
||||
ready() {
|
||||
return this.resizeWindow(1200, 800)
|
||||
.url(client.globals.baseUrl)
|
||||
.waitForElementVisible('body', 2000)
|
||||
.frame('coralStreamIframe');
|
||||
},
|
||||
setConfig(config, baseUrl) {
|
||||
return fetch(`${baseUrl}/api/v1/settings`, {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
body: JSON.stringify(config)
|
||||
});
|
||||
},
|
||||
enterComment() {
|
||||
const comment = 'This is a test comment';
|
||||
return this
|
||||
.waitForElementVisible('@commentBox')
|
||||
.setValue('@commentBox', comment)
|
||||
.click('@postButton')
|
||||
.waitForElementVisible('.comment', 1000);
|
||||
},
|
||||
validateComment(comment) {
|
||||
return this
|
||||
.assert.equal(comment, '.comment');
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
commands: [embedCommands],
|
||||
elements: {
|
||||
|
||||
commentBox: {
|
||||
selector: '#commentBox'
|
||||
},
|
||||
postButton: {
|
||||
selector: '#commentBox .coral-plugin-commentbox-button'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,160 @@
|
||||
const embedStreamCommands = {
|
||||
url: function () {
|
||||
return this
|
||||
.api.launchUrl;
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body', 4000)
|
||||
.waitForElementVisible('iframe#coralStreamIframe')
|
||||
.api.frame('coralStreamIframe');
|
||||
},
|
||||
signUp(user) {
|
||||
return this
|
||||
.waitForElementVisible('@signInButton', 2000)
|
||||
.click('@signInButton')
|
||||
.waitForElementVisible('@signInDialog')
|
||||
.waitForElementVisible('@registerButton')
|
||||
.click('@registerButton')
|
||||
.setValue('@signInDialogEmail', user.email)
|
||||
.setValue('@signInDialogPassword', user.pass)
|
||||
.setValue('@signUpDialogConfirmPassword', user.pass)
|
||||
.setValue('@signUpDialogDisplayName', user.displayName)
|
||||
.waitForElementVisible('@signUpButton')
|
||||
.click('@signUpButton')
|
||||
.waitForElementVisible('@logInButton')
|
||||
.click('@logInButton')
|
||||
.waitForElementVisible('@logoutButton', 5000);
|
||||
},
|
||||
login(user) {
|
||||
return this
|
||||
.waitForElementVisible('@signInButton', 2000)
|
||||
.click('@signInButton')
|
||||
.waitForElementVisible('@signInDialog')
|
||||
.waitForElementVisible('@signInDialogEmail')
|
||||
.waitForElementVisible('@signInDialogPassword')
|
||||
.setValue('@signInDialogEmail', user.email)
|
||||
.setValue('@signInDialogPassword', user.pass)
|
||||
.waitForElementVisible('@logInButton')
|
||||
.click('@logInButton')
|
||||
.waitForElementVisible('@logoutButton', 5000);
|
||||
},
|
||||
logout() {
|
||||
return this
|
||||
.waitForElementVisible('@logoutButton')
|
||||
.click('@logoutButton')
|
||||
.waitForElementVisible('@signInButton', 2000);
|
||||
},
|
||||
postComment(comment = 'Test Comment') {
|
||||
return this
|
||||
.waitForElementVisible('@commentBox', 2000)
|
||||
.setValue('@commentBox', comment)
|
||||
.click('@postButton');
|
||||
},
|
||||
likeComment() {
|
||||
return this
|
||||
.waitForElementVisible('@likeButton')
|
||||
.click('@likeButton');
|
||||
},
|
||||
flagComment() {
|
||||
return this
|
||||
.waitForElementVisible('@flagButton')
|
||||
.click('@flagButton');
|
||||
},
|
||||
flagUsername() {
|
||||
return this
|
||||
.waitForElementVisible('@flagButton')
|
||||
.click('@flagButton');
|
||||
},
|
||||
getPermalink(fn) {
|
||||
return this
|
||||
.waitForElementVisible('@permalinkButton')
|
||||
.click('@permalinkButton')
|
||||
.waitForElementVisible('@permalinkPopUp')
|
||||
.getValue('@permalinkInput', result => fn(result.value));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
commands: [embedStreamCommands],
|
||||
elements: {
|
||||
signInButton: {
|
||||
selector: '#coralSignInButton'
|
||||
},
|
||||
signInDialog:{
|
||||
selector: '#signInDialog'
|
||||
},
|
||||
signInDialogEmail: {
|
||||
selector: '#signInDialog #email'
|
||||
},
|
||||
signInDialogPassword: {
|
||||
selector: '#signInDialog #password'
|
||||
},
|
||||
signUpDialogConfirmPassword: {
|
||||
selector: '#signInDialog #confirmPassword'
|
||||
},
|
||||
signUpDialogDisplayName: {
|
||||
selector: '#signInDialog #displayName'
|
||||
},
|
||||
logInButton: {
|
||||
selector: '#coralLogInButton'
|
||||
},
|
||||
signUpButton: {
|
||||
selector: '#coralSignUpButton'
|
||||
},
|
||||
logoutButton: {
|
||||
selector: '.commentStream #logout'
|
||||
},
|
||||
commentBox: {
|
||||
selector: '.coral-plugin-commentbox-textarea'
|
||||
},
|
||||
postButton: {
|
||||
selector: '#commentBox .coral-plugin-commentbox-button'
|
||||
},
|
||||
likeButton: {
|
||||
selector: '.comment .coral-plugin-likes-container .coral-plugin-likes-button'
|
||||
},
|
||||
likeText: {
|
||||
selector: '.comment .coral-plugin-likes-container .coral-plugin-likes-button .coral-plugin-likes-button-text'
|
||||
},
|
||||
likesCount: {
|
||||
selector: '.comment .coral-plugin-likes-container .coral-plugin-likes-button .coral-plugin-likes-like-count'
|
||||
},
|
||||
flagButton: {
|
||||
selector: '.comment .coral-plugin-flags-container .coral-plugin-flags-button'
|
||||
},
|
||||
flagPopUp: {
|
||||
selector: '.comment .coral-plugin-flags-popup'
|
||||
},
|
||||
flagCommentOption: {
|
||||
selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-radio-label[for="comments"]'
|
||||
},
|
||||
flagUsernameOption: {
|
||||
selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-radio-label[for="user"]'
|
||||
},
|
||||
flagOtherOption: {
|
||||
selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-radio-label[for="other"]'
|
||||
},
|
||||
flagHeaderMessage: {
|
||||
selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-header'
|
||||
},
|
||||
flagButtonText: {
|
||||
selector: '.comment .coral-plugin-flags-button-text'
|
||||
},
|
||||
flagDoneButton: {
|
||||
selector: '.comment .coral-plugin-flags-popup .coral-plugin-flags-popup-button'
|
||||
},
|
||||
permalinkButton: {
|
||||
selector: '.comment .coral-plugin-permalinks-button'
|
||||
},
|
||||
permalinkPopUp: {
|
||||
selector: '.comment .coral-plugin-permalinks-popover.active'
|
||||
},
|
||||
permalinkInput: {
|
||||
selector: '.comment .coral-plugin-permalinks-popover.active input'
|
||||
},
|
||||
registerButton: {
|
||||
selector: '#signInDialog #coralRegister'
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -6,8 +6,5 @@ module.exports = {
|
||||
.url(baseUrl)
|
||||
.assert.title('Coral Talk')
|
||||
.waitForElementPresent('body', 1000);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
module.exports = {
|
||||
'@tags': ['embedStream'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
},
|
||||
'Login as commenter': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
'Add test comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
embedStreamPage
|
||||
.postComment('Test Comment');
|
||||
},
|
||||
'Logout': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
embedStreamPage
|
||||
.logout();
|
||||
},
|
||||
'Login as admin': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
embedStreamPage
|
||||
.login(users.admin);
|
||||
},
|
||||
'Approve test comment': client => {
|
||||
const adminPage = client.page.adminPage();
|
||||
|
||||
adminPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
adminPage
|
||||
.approveComment();
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
'@tags': ['login', 'admin'],
|
||||
before(client) {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {launchUrl} = client;
|
||||
|
||||
client
|
||||
.url(launchUrl);
|
||||
|
||||
embedStreamPage
|
||||
.ready();
|
||||
},
|
||||
'Admin logs in': client => {
|
||||
const {users} = client.globals;
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.admin);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
module.exports = {
|
||||
'@tags': ['flag', 'comments', 'commenter'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
'Commenter flags a comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.flagComment()
|
||||
.waitForElementVisible('@flagPopUp')
|
||||
.waitForElementVisible('@flagCommentOption')
|
||||
.click('@flagCommentOption')
|
||||
.waitForElementVisible('@flagDoneButton')
|
||||
.click('@flagDoneButton')
|
||||
.waitForElementVisible('@flagOtherOption')
|
||||
.click('@flagOtherOption')
|
||||
.waitForElementVisible('@flagDoneButton')
|
||||
.click('@flagDoneButton')
|
||||
.click('@flagDoneButton')
|
||||
.expect.element('@flagButtonText').text.to.equal('Reported');
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
module.exports = {
|
||||
'@tags': ['flag', 'commenter'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
'Commenter flags a username': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.flagUsername()
|
||||
.waitForElementVisible('@flagPopUp')
|
||||
.waitForElementVisible('@flagUsernameOption')
|
||||
.click('@flagUsernameOption')
|
||||
.waitForElementVisible('@flagDoneButton')
|
||||
.click('@flagDoneButton')
|
||||
.waitForElementVisible('@flagOtherOption')
|
||||
.click('@flagOtherOption')
|
||||
.waitForElementVisible('@flagDoneButton')
|
||||
.click('@flagDoneButton')
|
||||
.click('@flagDoneButton');
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
module.exports = {
|
||||
'@tags': ['like', 'comments', 'commenter'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
'Commenter likes a comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.likeComment()
|
||||
.waitForElementVisible('@likesCount', 2000)
|
||||
.expect.element('@likeText').text.to.equal('Liked');
|
||||
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
'@tags': ['login', 'commenter'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
},
|
||||
'Commenter logs in': client => {
|
||||
const {users} = client.globals;
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
let permalink = '';
|
||||
|
||||
module.exports = {
|
||||
'@tags': ['permalink', 'commenter'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
'Commenter gets the permalink of a comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
embedStreamPage
|
||||
.getPermalink(value => {
|
||||
permalink = value;
|
||||
});
|
||||
},
|
||||
'Commenter navigates to the permalink': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
embedStreamPage
|
||||
.navigate(permalink);
|
||||
|
||||
client.assert.urlContains(permalink);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
module.exports = {
|
||||
'@tags': ['write', 'commenter'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.commenter);
|
||||
},
|
||||
'Commenter posts a comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.postComment('I read the comments');
|
||||
},
|
||||
after: client => {
|
||||
const adminPage = client.page.adminPage();
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {users} = client.globals;
|
||||
|
||||
embedStreamPage
|
||||
.logout()
|
||||
.login(users.admin);
|
||||
|
||||
adminPage
|
||||
.navigate()
|
||||
.ready();
|
||||
|
||||
adminPage
|
||||
.approveComment();
|
||||
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
module.exports = {
|
||||
'@tags': ['login', 'moderator'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const {launchUrl} = client;
|
||||
|
||||
client
|
||||
.url(launchUrl);
|
||||
|
||||
embedStreamPage
|
||||
.ready();
|
||||
},
|
||||
'Moderator logs in': client => {
|
||||
const {users} = client.globals;
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.login(users.moderator);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
'@tags': ['flag', 'comments', 'visitor'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
},
|
||||
'Visitor tries to flag a comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.flagComment()
|
||||
.waitForElementVisible('@signInDialog', 2000);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,20 @@
|
||||
module.exports = {
|
||||
'@tags': ['like', 'comments', 'visitor'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
},
|
||||
'Visitor tries to like a comment': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.likeComment()
|
||||
.waitForElementVisible('@signInDialog', 2000);
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,24 @@
|
||||
module.exports = {
|
||||
'@tags': ['signup', 'visitor'],
|
||||
before: client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
|
||||
embedStreamPage
|
||||
.navigate()
|
||||
.ready();
|
||||
},
|
||||
'Visitor signs up': client => {
|
||||
const embedStreamPage = client.page.embedStreamPage();
|
||||
const hash = Math.floor(Math.random() * (999 - 0));
|
||||
|
||||
embedStreamPage
|
||||
.signUp({
|
||||
email: `visitor_${hash}@test.com`,
|
||||
displayName: 'Visitor',
|
||||
pass: 'testtest'
|
||||
});
|
||||
},
|
||||
after: client => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user