mirror of
https://github.com/wassname/talk.git
synced 2026-07-04 10:30:34 +08:00
refactor
This commit is contained in:
@@ -7,6 +7,23 @@ module.exports = {
|
||||
return this
|
||||
.waitForElementVisible('body');
|
||||
},
|
||||
login(user = {}) {
|
||||
const adminPage = this.page.admin();
|
||||
|
||||
adminPage
|
||||
.navigate()
|
||||
.waitForElementVisible('@loginLayout')
|
||||
.waitForElementVisible('@signInForm')
|
||||
.setValue('@emailInput', user.email)
|
||||
.setValue('@passwordInput', user.password)
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
|
||||
this.pause(3000);
|
||||
|
||||
adminPage
|
||||
.waitForElementVisible('@moderationContainer');
|
||||
},
|
||||
}],
|
||||
elements: {
|
||||
'loginLayout': '.talk-admin-login',
|
||||
|
||||
@@ -46,6 +46,19 @@ module.exports = {
|
||||
this.switchWindow(handle);
|
||||
});
|
||||
},
|
||||
logout() {
|
||||
const embedStream = this.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@commentsTabButton')
|
||||
.click('@commentsTabButton')
|
||||
.waitForElementVisible('@logoutButton')
|
||||
.click('@logoutButton');
|
||||
}
|
||||
}],
|
||||
url: function() {
|
||||
return this.api.launchUrl;
|
||||
|
||||
@@ -1,22 +1,10 @@
|
||||
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');
|
||||
.login(admin);
|
||||
},
|
||||
'navigate to the embed stream': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
@@ -39,6 +27,12 @@ module.exports = {
|
||||
.click('@banDialogbanButton')
|
||||
.waitForElementNotVisible('@banDialog');
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
embedStream
|
||||
.logout();
|
||||
},
|
||||
'user logs in': (client) => {
|
||||
const {testData: {user}} = client.globals;
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
Reference in New Issue
Block a user