e2e tests

This commit is contained in:
Belen Curcio
2017-10-30 07:52:08 -03:00
parent 34b58779e8
commit a6a903c459
3 changed files with 81 additions and 0 deletions
+14
View File
@@ -0,0 +1,14 @@
module.exports = {
commands: [{
url: function() {
return `${this.api.launchUrl}/admin/community`;
},
ready() {
return this
.waitForElementVisible('body');
},
}],
elements: {
container: '.talk-admin-community',
}
};
+11
View File
@@ -41,10 +41,21 @@ module.exports = {
signInButton: '#coralSignInButton',
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',
respectButton: '.talk-stream-comment.talk-stream-comment-level-0 .talk-stream-comment-footer .talk-plugin-respect-button'
},
sections: {
flag: {
selector: '.talk-plugin-flags-popup',
elements: {
offensiveUsernameRadio: '.talk-plugin-flags-popup-radio#USERNAME_OFFENSIVE',
flagUsernameRadio: '.talk-plugin-flags-popup-radio#USERS',
continueButton: '.talk-plugin-flags-popup-button',
popUpText: '.talk-plugin-flags-popup-text'
}
},
profile: {
selector: '.talk-embed-stream-profile-tab-pane',
elements: {
+56
View File
@@ -0,0 +1,56 @@
module.exports = {
'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');
client.pause(3000);
adminPage
.waitForElementVisible('@moderationContainer');
},
'admin flags user\'s username as offensive': (client) => {
const embedStream = client.page.embedStream();
const flagSection = client.page.embedStream().section.embed.section.flag;
const embed = embedStream
.navigate()
.getEmbedSection();
embed
.waitForElementVisible('@firstComment')
.waitForElementVisible('@flagButton')
.click('@flagButton');
flagSection
.waitForElementVisible('@flagUsernameRadio')
.click('@flagUsernameRadio')
.waitForElementVisible('@continueButton')
.click('@continueButton')
.waitForElementVisible('@offensiveUsernameRadio')
.click('@offensiveUsernameRadio')
.click('@continueButton')
.waitForElementVisible('@popUpText')
.click('@continueButton');
},
'admin goes to Reported Usernames': (client) => {
const community = client.page.adminCommunity();
community
.navigate();
community
.waitForElementVisible('@container');
},
after: (client) => {
client.end();
}
};