mirror of
https://github.com/wassname/talk.git
synced 2026-07-20 12:40:47 +08:00
refacotr
This commit is contained in:
@@ -52,7 +52,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs
|
||||
</td>
|
||||
<td className="mdl-data-table__cell--non-numeric">
|
||||
<Dropdown
|
||||
className="talk-admin-community-people-dd-status"
|
||||
containerClassName="talk-admin-community-people-dd-status"
|
||||
value={row.status}
|
||||
placeholder={t('community.status')}
|
||||
onChange={(status) => setCommenterStatus(row.id, status)}>
|
||||
@@ -62,7 +62,7 @@ const Table = ({users, setRole, onHeaderClickHandler, setCommenterStatus, viewUs
|
||||
</td>
|
||||
<td className="mdl-data-table__cell--non-numeric">
|
||||
<Dropdown
|
||||
className="talk-admin-community-people-dd-role"
|
||||
containerClassName="talk-admin-community-people-dd-role"
|
||||
value={row.roles[0] || ''}
|
||||
placeholder={t('community.role')}
|
||||
onChange={(role) => setRole(row.id, role)}>
|
||||
|
||||
@@ -27,7 +27,7 @@ module.exports = {
|
||||
people: {
|
||||
selector: '.talk-admin-community-people-container',
|
||||
elements: {
|
||||
row: '.talk-admin-community-people-row',
|
||||
firstRow: '.talk-admin-community-people-row:first-child',
|
||||
dropdownStatus: '.talk-admin-community-people-dd-status',
|
||||
dropdownRole: '.talk-admin-community-people-dd-role',
|
||||
dropdownStatusActive: '.talk-admin-community-people-dd-status .dd-list-active',
|
||||
|
||||
@@ -13,9 +13,8 @@ module.exports = {
|
||||
return this.section.embed;
|
||||
},
|
||||
login(user = {}) {
|
||||
const embedStream = this.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
|
||||
const embed = this
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
@@ -23,15 +22,15 @@ module.exports = {
|
||||
.waitForElementVisible('@signInButton')
|
||||
.click('@signInButton');
|
||||
|
||||
this.pause(3000);
|
||||
this.api.pause(3000);
|
||||
|
||||
// Focusing on the Login PopUp
|
||||
this.windowHandles((result) => {
|
||||
this.api.windowHandles((result) => {
|
||||
const handle = result.value[1];
|
||||
this.switchWindow(handle);
|
||||
this.api.switchWindow(handle);
|
||||
});
|
||||
|
||||
const login = this.page.login();
|
||||
const login = this.api.page.login();
|
||||
|
||||
login
|
||||
.setValue('@emailInput', user.email)
|
||||
@@ -41,15 +40,13 @@ module.exports = {
|
||||
.click('@loginButton');
|
||||
|
||||
// Focusing on the Embed Window
|
||||
this.windowHandles((result) => {
|
||||
this.api.windowHandles((result) => {
|
||||
const handle = result.value[0];
|
||||
this.switchWindow(handle);
|
||||
this.api.switchWindow(handle);
|
||||
});
|
||||
},
|
||||
logout() {
|
||||
const embedStream = this.page.embedStream();
|
||||
|
||||
const embed = embedStream
|
||||
logout() {
|
||||
const embed = this
|
||||
.navigate()
|
||||
.getEmbedSection();
|
||||
|
||||
@@ -95,6 +92,8 @@ module.exports = {
|
||||
restrictedMessageBox: '.talk-restricted-message-box',
|
||||
suspendedAccountInput: '.talk-suspended-account-username-input',
|
||||
suspendedAccountSubmitButton: '.talk-suspended-account-submit-button',
|
||||
banDialog: '.talk-ban-user-dialog',
|
||||
banDialogConfirmButton: '.talk-ban-user-dialog-button-confirm',
|
||||
},
|
||||
sections: {
|
||||
flag: {
|
||||
@@ -112,8 +111,6 @@ module.exports = {
|
||||
arrow: '.talk-plugin-moderation-actions-arrow',
|
||||
menu: '.talk-plugin-modetarion-actions-menu',
|
||||
banButton: '.talk-plugin-moderation-actions-ban',
|
||||
banDialog: '.talk-ban-user-dialog',
|
||||
banDialogbanButton: '.talk-ban-user-dialog-button-ban',
|
||||
},
|
||||
},
|
||||
profile: {
|
||||
|
||||
@@ -14,6 +14,7 @@ module.exports = {
|
||||
.getEmbedSection();
|
||||
},
|
||||
'admin bans user': (client) => {
|
||||
const embed = client.page.embedStream().section.embed;
|
||||
const modSection = client.page.embedStream().section.embed.section.mod;
|
||||
|
||||
modSection
|
||||
@@ -21,10 +22,12 @@ module.exports = {
|
||||
.click('@arrow')
|
||||
.waitForElementVisible('@menu')
|
||||
.waitForElementVisible('@banButton')
|
||||
.click('@banButton')
|
||||
.click('@banButton');
|
||||
|
||||
embed
|
||||
.waitForElementVisible('@banDialog')
|
||||
.waitForElementVisible('@banDialogbanButton')
|
||||
.click('@banDialogbanButton')
|
||||
.waitForElementVisible('@banDialogConfirmButton')
|
||||
.click('@banDialogConfirmButton')
|
||||
.waitForElementNotVisible('@banDialog');
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
@@ -73,7 +76,7 @@ module.exports = {
|
||||
const modSection = client.page.adminCommunity().section.people;
|
||||
|
||||
modSection
|
||||
.waitForElementVisible('@row')
|
||||
.waitForElementVisible('@firstRow')
|
||||
.waitForElementVisible('@dropdownStatus')
|
||||
.click('@dropdownStatus')
|
||||
.waitForElementVisible('@dropdownStatusActive')
|
||||
Reference in New Issue
Block a user