mirror of
https://github.com/wassname/talk.git
synced 2026-07-16 11:22:16 +08:00
e2e tests
This commit is contained in:
@@ -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',
|
||||
}
|
||||
};
|
||||
@@ -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: {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user