mirror of
https://github.com/wassname/talk.git
synced 2026-07-18 12:40:13 +08:00
Fix merge conflicts
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
const serve = require('../../serve');
|
||||
const mongoose = require('../../services/mongoose');
|
||||
const {shutdown} = require('../../bin/util');
|
||||
|
||||
module.exports = {
|
||||
before: async (done) => {
|
||||
await mongoose.connection.dropDatabase();
|
||||
await serve();
|
||||
done();
|
||||
},
|
||||
after: (done) => {
|
||||
shutdown();
|
||||
done();
|
||||
},
|
||||
waitForConditionTimeout: 5000,
|
||||
testData: {
|
||||
admin: {
|
||||
email: 'admin@test.com',
|
||||
username: 'admin',
|
||||
password: 'testtest',
|
||||
},
|
||||
user: {
|
||||
email: 'user@test.com',
|
||||
username: 'user',
|
||||
password: 'testtest',
|
||||
},
|
||||
comment: {
|
||||
body: 'This is a test comment'
|
||||
},
|
||||
organizationName: 'Coral',
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,18 @@
|
||||
module.exports = {
|
||||
commands: [{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin`;
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
},
|
||||
}],
|
||||
elements: {
|
||||
'loginLayout': '.talk-admin-login',
|
||||
'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',
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,65 @@
|
||||
const iframeId = 'coralStreamEmbed_iframe';
|
||||
|
||||
module.exports = {
|
||||
commands: [{
|
||||
navigateToAsset: function(asset) {
|
||||
this.api.url(`${this.api.launchUrl}/assets/title/${asset}`);
|
||||
return this;
|
||||
},
|
||||
getEmbedSection: function() {
|
||||
this.waitForElementVisible('@iframe');
|
||||
this.api.frame(iframeId);
|
||||
this.expect.section('@embed').to.be.present;
|
||||
return this.section.embed;
|
||||
},
|
||||
}],
|
||||
url: function() {
|
||||
return this.api.launchUrl;
|
||||
},
|
||||
elements: {
|
||||
iframe: `#${iframeId}`,
|
||||
},
|
||||
sections: {
|
||||
embed: {
|
||||
commands: [{
|
||||
getProfileSection: function() {
|
||||
this.click('@profileTabButton');
|
||||
this.expect.section('@profile').to.be.present;
|
||||
return this.section.profile;
|
||||
},
|
||||
getCommentsSection: function() {
|
||||
this.click('@commentsTabButton');
|
||||
this.expect.section('@comments').to.be.present;
|
||||
return this.section.comments;
|
||||
},
|
||||
}],
|
||||
selector: '#talk-embed-stream-container',
|
||||
elements: {
|
||||
logoutButton: '.talk-stream-userbox-logout',
|
||||
commentsTabButton: '.talk-embed-stream-comments-tab > button',
|
||||
profileTabButton: '.talk-embed-stream-profile-tab > button',
|
||||
signInButton: '#coralSignInButton',
|
||||
commentBoxTextarea: '#commentText',
|
||||
commentBoxPostButton: '.talk-plugin-commentbox-button',
|
||||
firstCommentContent: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-content',
|
||||
respectButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button'
|
||||
},
|
||||
sections: {
|
||||
profile: {
|
||||
selector: '.talk-embed-stream-profile-tab-pane',
|
||||
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'
|
||||
},
|
||||
},
|
||||
comments: {
|
||||
selector: '.talk-embed-stream-comments-tab-pane',
|
||||
elements: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,46 @@
|
||||
module.exports = {
|
||||
commands: [{
|
||||
url: function() {
|
||||
return `${this.api.launchUrl}/admin/install`;
|
||||
},
|
||||
ready() {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
}
|
||||
}],
|
||||
sections: {
|
||||
step1: {
|
||||
selector: '.talk-install-step-1',
|
||||
elements: {
|
||||
getStartedButton: '.talk-install-get-started-button',
|
||||
},
|
||||
},
|
||||
step2: {
|
||||
selector: '.talk-install-step-2',
|
||||
elements: {
|
||||
organizationNameInput: '.talk-install-step-2 #organizationName',
|
||||
saveButton: '.talk-install-step-2-save-button',
|
||||
},
|
||||
},
|
||||
step3: {
|
||||
selector: '.talk-install-step-3',
|
||||
elements: {
|
||||
emailInput: '.talk-install-step-3 #email',
|
||||
usernameInput: '.talk-install-step-3 #username',
|
||||
passwordInput: '.talk-install-step-3 #password',
|
||||
confirmPasswordInput: '.talk-install-step-3 #confirmPassword',
|
||||
saveButton: '.talk-install-step-3-save-button',
|
||||
},
|
||||
},
|
||||
step4: {
|
||||
selector: '.talk-install-step-4',
|
||||
elements: {
|
||||
domainInput: '.talk-install-step-4-permited-domains-input input',
|
||||
saveButton: '.talk-install-step-4-save-button',
|
||||
},
|
||||
},
|
||||
step5: {
|
||||
selector: '.talk-install-step-5',
|
||||
},
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,13 @@
|
||||
module.exports = {
|
||||
elements: {
|
||||
registerButton: '#coralRegister',
|
||||
signInButton: '#coralSignInButton',
|
||||
emailInput: '#email',
|
||||
usernameInput: '#username',
|
||||
passwordInput: '#password',
|
||||
confirmPasswordInput: '#confirmPassword',
|
||||
signUpButton: '#coralSignUpButton',
|
||||
signIn: '.coral-sign-in',
|
||||
loginButton: '#coralLogInButton'
|
||||
},
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"extends": "@coralproject/eslint-config-talk",
|
||||
"rules": {
|
||||
"indent": "off"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
module.exports = {
|
||||
'@tags': ['install'],
|
||||
|
||||
'User goes to install': (client) => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.navigate()
|
||||
.expect.section('@step1').to.be.present;
|
||||
|
||||
},
|
||||
'User clicks get started button': (client) => {
|
||||
const step1 = client.page.install().section.step1;
|
||||
|
||||
step1
|
||||
.waitForElementVisible('@getStartedButton')
|
||||
.click('@getStartedButton');
|
||||
},
|
||||
'User should see step 2 - Add Organization Name': (client) => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step2').to.be.present;
|
||||
},
|
||||
'User fills step 2': (client) => {
|
||||
const step2 = client.page.install().section.step2;
|
||||
const {testData} = client.globals;
|
||||
|
||||
step2
|
||||
.waitForElementVisible('@organizationNameInput')
|
||||
.setValue('@organizationNameInput', testData.organizationName)
|
||||
.waitForElementVisible('@saveButton')
|
||||
.click('@saveButton');
|
||||
},
|
||||
'User should see step 3 - Create your account': (client) => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step3').to.be.present;
|
||||
},
|
||||
'User fills step 3': (client) => {
|
||||
const step3 = client.page.install().section.step3;
|
||||
const {testData: {admin}} = client.globals;
|
||||
|
||||
step3
|
||||
.setValue('@emailInput', admin.email)
|
||||
.setValue('@usernameInput', admin.username)
|
||||
.setValue('@passwordInput', admin.password)
|
||||
.setValue('@confirmPasswordInput', admin.password)
|
||||
.waitForElementVisible('@saveButton')
|
||||
.click('@saveButton');
|
||||
},
|
||||
'User should see step 4 - Domain Whitelist': (client) => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step4').to.be.present;
|
||||
},
|
||||
'User fills step 4': (client) => {
|
||||
const step4 = client.page.install().section.step4;
|
||||
|
||||
step4
|
||||
.waitForElementVisible('@domainInput')
|
||||
.setValue('@domainInput', client.launchUrl);
|
||||
|
||||
client.keys(client.Keys.ENTER);
|
||||
|
||||
step4
|
||||
.waitForElementVisible('@saveButton')
|
||||
.click('@saveButton');
|
||||
},
|
||||
'User should see step 5 - Final Step': (client) => {
|
||||
const install = client.page.install();
|
||||
|
||||
install
|
||||
.expect.section('@step5').to.be.present;
|
||||
},
|
||||
after: (client) => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,21 @@
|
||||
module.exports = {
|
||||
'@tags': ['admin', 'login'],
|
||||
|
||||
'Admin logs in': (client) => {
|
||||
const adminPage = client.page.admin();
|
||||
const {testData: {admin}} = client.globals;
|
||||
|
||||
adminPage
|
||||
.navigate()
|
||||
.waitForElementVisible('@loginLayout')
|
||||
.waitForElementVisible('@signInForm')
|
||||
.setValue('@emailInput', admin.email)
|
||||
.setValue('@passwordInput', admin.password)
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
|
||||
},
|
||||
after: (client) => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,160 @@
|
||||
module.exports = {
|
||||
'@tags': ['embedStream', 'login'],
|
||||
'creates a new asset': (client) => {
|
||||
const asset = 'newAssetTest';
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.navigateToAsset(asset)
|
||||
.assert.title(asset)
|
||||
.getEmbedSection();
|
||||
},
|
||||
|
||||
'creates an user and user logs in': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
|
||||
client.pause(3000);
|
||||
|
||||
// Focusing on the Login PopUp
|
||||
client.windowHandles((result) => {
|
||||
const handle = result.value[1];
|
||||
client.switchWindow(handle);
|
||||
});
|
||||
|
||||
const login = client.page.login();
|
||||
|
||||
login
|
||||
.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');
|
||||
|
||||
// Focusing on the Embed Window
|
||||
client.windowHandles((result) => {
|
||||
const handle = result.value[0];
|
||||
client.switchWindow(handle);
|
||||
});
|
||||
},
|
||||
'user posts a comment': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const {testData: {comment}} = client.globals;
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@commentBoxTextarea')
|
||||
.setValue('@commentBoxTextarea', comment.body)
|
||||
.waitForElementVisible('@commentBoxPostButton')
|
||||
.click('@commentBoxPostButton')
|
||||
.waitForElementVisible('@firstCommentContent')
|
||||
.getText('@firstCommentContent', (result) => {
|
||||
embed.assert.equal(result.value, comment.body);
|
||||
});
|
||||
},
|
||||
|
||||
'signed in user sees comment history': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const {testData: {comment}} = client.globals;
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
const profile = embed
|
||||
.getProfileSection();
|
||||
|
||||
profile
|
||||
.waitForElementVisible('@myCommentHistory')
|
||||
.waitForElementVisible('@myCommentHistoryComment')
|
||||
.getText('@myCommentHistoryComment', (result) => {
|
||||
profile.assert.equal(result.value, comment.body);
|
||||
});
|
||||
},
|
||||
'user sees replies and reactions to comments': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
const profile = embed
|
||||
.getProfileSection();
|
||||
|
||||
profile
|
||||
.waitForElementVisible('@myCommentHistory')
|
||||
.waitForElementVisible('@myCommentHistoryReactions')
|
||||
.waitForElementVisible('@myCommentHistoryReactionCount')
|
||||
.getText('@myCommentHistoryReactionCount', (result) => {
|
||||
profile.assert.equal(result.value, '0');
|
||||
});
|
||||
},
|
||||
'user goes to the stream and replies and reacts to comment': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@respectButton')
|
||||
.click('@respectButton');
|
||||
|
||||
const profile = embed
|
||||
.getProfileSection();
|
||||
|
||||
profile
|
||||
.waitForElementVisible('@myCommentHistory')
|
||||
.waitForElementVisible('@myCommentHistoryReactions')
|
||||
.waitForElementVisible('@myCommentHistoryReactionCount')
|
||||
.getText('@myCommentHistoryReactionCount', (result) => {
|
||||
profile.assert.equal(result.value, '1');
|
||||
});
|
||||
},
|
||||
'user logs out': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@commentsTabButton')
|
||||
.click('@commentsTabButton')
|
||||
.waitForElementVisible('@logoutButton')
|
||||
.click('@logoutButton');
|
||||
},
|
||||
'not logged in user clicks my profile tab': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
const profile = embed
|
||||
.getProfileSection();
|
||||
|
||||
profile
|
||||
.assert.visible('@notLoggedIn');
|
||||
},
|
||||
after: (client) => {
|
||||
client.end();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user