mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
* 'reply' of github.com:coralproject/talk: (193 commits) Add some margin to loadmore typo updated tests updated tests Fully implement SetUsername removed snakecase fix to optional required param Use correct mutation and show errors refactored mailer service with lodash! Fix live status updates Move ChangeUsername to the appropiate tab Fix change username not displaying errors Remove defunct refetch detection workaround Rename UnBan and UnSuspend hardened configuration user cli patches don't apply configuration from dotfiles during testing applied rename to graph mutation edges reintroduced the errors.ErrSameUsernameProvided fixed wrong query logic ...
153 lines
4.3 KiB
JavaScript
153 lines
4.3 KiB
JavaScript
module.exports = {
|
|
'@tags': ['embedStream', 'login'],
|
|
|
|
before: (client) => {
|
|
client.setWindowPosition(0, 0);
|
|
client.resizeWindow(1600, 1200);
|
|
},
|
|
|
|
afterEach: (client, done) => {
|
|
if (client.currentTest.results.failed) {
|
|
throw new Error('Test Case failed, skipping all the rest');
|
|
}
|
|
done();
|
|
},
|
|
|
|
after: (client) => {
|
|
client.end();
|
|
},
|
|
|
|
'creates a new asset': (client) => {
|
|
|
|
const asset = 'newAssetTest';
|
|
const embedStream = client.page.embedStream();
|
|
|
|
embedStream
|
|
.navigateToAsset(asset)
|
|
.assert.title(asset)
|
|
.ready();
|
|
},
|
|
|
|
'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();
|
|
|
|
comments
|
|
.openLoginPopup((popup) => {
|
|
popup.register(user);
|
|
});
|
|
},
|
|
'user posts a comment': (client) => {
|
|
const comments = client.page.embedStream().section.comments;
|
|
const {testData: {comment}} = client.globals;
|
|
|
|
comments
|
|
.waitForElementVisible('@commentBoxTextarea')
|
|
.setValue('@commentBoxTextarea', comment.body)
|
|
.waitForElementVisible('@commentBoxPostButton')
|
|
.click('@commentBoxPostButton')
|
|
.waitForElementVisible('@firstCommentContent')
|
|
.getText('@firstCommentContent', (result) => {
|
|
comments.assert.equal(result.value, comment.body);
|
|
});
|
|
},
|
|
|
|
'signed in user sees comment history': (client) => {
|
|
const profile = client.page.embedStream().goToProfileSection();
|
|
const {testData: {comment}} = client.globals;
|
|
|
|
profile
|
|
.waitForElementVisible('@myCommentHistory')
|
|
.waitForElementVisible('@myCommentHistoryComment')
|
|
.getText('@myCommentHistoryComment', (result) => {
|
|
profile.assert.equal(result.value, comment.body);
|
|
});
|
|
},
|
|
'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) => {
|
|
profile.assert.equal(result.value, '0');
|
|
});
|
|
},
|
|
'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');
|
|
|
|
const profile = embedStream.goToProfileSection();
|
|
|
|
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 comments = embedStream.goToCommentsSection();
|
|
|
|
comments
|
|
.logout();
|
|
},
|
|
'not logged in user clicks my profile tab': (client) => {
|
|
const embedStream = client.page.embedStream();
|
|
const profile = embedStream.goToProfileSection();
|
|
|
|
profile
|
|
.assert.visible('@notLoggedIn');
|
|
},
|
|
'admin logs in': (client) => {
|
|
const {testData: {admin}} = client.globals;
|
|
const embedStream = client.page.embedStream();
|
|
|
|
embedStream
|
|
.navigate()
|
|
.ready()
|
|
.openLoginPopup((popup) => popup.login(admin));
|
|
},
|
|
'admin closes stream, users won\'t be able to perform some actions: reply ': (client) => {
|
|
|
|
const embedStream = client.page.embedStream();
|
|
|
|
embedStream
|
|
.goToCommentsSection()
|
|
.waitForElementVisible('@firstComment')
|
|
.waitForElementVisible('@replyButton');
|
|
|
|
embedStream
|
|
.goToConfigSection()
|
|
.closeStream();
|
|
|
|
embedStream
|
|
.goToCommentsSection()
|
|
.waitForElementVisible('@firstComment')
|
|
.waitForElementNotPresent('@replyButton');
|
|
|
|
embedStream
|
|
.goToConfigSection()
|
|
.openStream();
|
|
},
|
|
'adming logs out': (client) => {
|
|
const embedStream = client.page.embedStream();
|
|
const comments = embedStream.goToCommentsSection();
|
|
|
|
comments
|
|
.logout();
|
|
},
|
|
};
|