mirror of
https://github.com/wassname/talk.git
synced 2026-06-28 23:58:38 +08:00
113 lines
3.3 KiB
JavaScript
113 lines
3.3 KiB
JavaScript
module.exports = {
|
|
'@tags': ['embedStream', 'login'],
|
|
|
|
before: (client) => {
|
|
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');
|
|
},
|
|
};
|