mirror of
https://github.com/wassname/talk.git
synced 2026-08-12 12:30:39 +08:00
merge conficts
This commit is contained in:
+1
-1
@@ -11,7 +11,7 @@ module.exports = {
|
||||
shutdown();
|
||||
done();
|
||||
},
|
||||
waitForConditionTimeout: 5000,
|
||||
waitForConditionTimeout: parseInt(process.env.WAIT_FOR_TIMEOUT) || 10000,
|
||||
testData: {
|
||||
admin: {
|
||||
email: 'admin@test.com',
|
||||
|
||||
@@ -57,6 +57,10 @@ module.exports = {
|
||||
suspendUserDialog: '.talk-admin-suspend-user-dialog',
|
||||
suspendUserConfirmButton: '.talk-admin-suspend-user-dialog-confirm',
|
||||
supendUserSendButton: '.talk-admin-suspend-user-dialog-send',
|
||||
usernameDialog: '.talk-reject-username-dialog',
|
||||
usernameDialogButtons: '.talk-reject-username-dialog-buttons',
|
||||
usernameDialogSuspend: '.talk-reject-username-dialog-button-k',
|
||||
usernameDialogSuspensionMessage: '.talk-reject-username-dialog-suspension-message',
|
||||
toast: '.toastify',
|
||||
toastClose: '.toastify__close',
|
||||
},
|
||||
@@ -95,10 +99,6 @@ module.exports = {
|
||||
flaggedUser:'.talk-admin-community-flagged-user',
|
||||
flaggedUserApproveButton: '.talk-admin-flagged-user-approve-button',
|
||||
flaggedUserRejectButton: '.talk-admin-flagged-user-reject-button',
|
||||
usernameDialog: '.talk-reject-username-dialog',
|
||||
usernameDialogButtons: '.talk-reject-username-dialog-buttons',
|
||||
usernameDialogSuspend: '.talk-reject-username-dialog-button-k',
|
||||
usernameDialogSuspensionMessage: '.talk-reject-username-dialog-suspension-message'
|
||||
},
|
||||
sections: {
|
||||
people: {
|
||||
@@ -143,6 +143,10 @@ module.exports = {
|
||||
this.parent
|
||||
.click('@drawerOverlay')
|
||||
.waitForElementNotPresent('@drawerOverlay');
|
||||
|
||||
// Wait a bit to let animations terminate cleanly.
|
||||
this.api.pause(200);
|
||||
|
||||
return this.parent;
|
||||
},
|
||||
}],
|
||||
|
||||
@@ -62,24 +62,12 @@ module.exports = {
|
||||
// Focusing on the Login PopUp
|
||||
windowHandler.windowHandles((handles) => {
|
||||
this.api.switchWindow(handles[1]);
|
||||
});
|
||||
|
||||
const popup = this.api.page.popup().ready();
|
||||
callback(popup);
|
||||
const popup = this.api.page.popup().ready();
|
||||
callback(popup);
|
||||
|
||||
// Give a tiny bit of time to let popup close.
|
||||
this.api.pause(50);
|
||||
|
||||
if (this.api.capabilities.browserName === 'MicrosoftEdge') {
|
||||
|
||||
// More time for edge.
|
||||
// https://www.browserstack.com/automate/builds/1ceccf4efb4683b7feb890f45a32b5922b40ed3f/sessions/7393dbfda8387e43b6d5851f359b0c07db414973
|
||||
this.api.pause(1000);
|
||||
}
|
||||
|
||||
// Focusing on the Embed Window
|
||||
windowHandler.windowHandles((handles) => {
|
||||
this.api.switchWindow(handles[0]);
|
||||
// Focus on the Embed Window.
|
||||
windowHandler.pop();
|
||||
|
||||
// For some reasons firefox does not automatically load auth after login.
|
||||
// https://www.browserstack.com/automate/builds/37650cb4e66c6edce0ba0800a1c1b7e7f74bf991/sessions/7a4e9da69b0f9ecdf8b7fa9150639e47b1532cb0#automate_button
|
||||
@@ -89,6 +77,7 @@ module.exports = {
|
||||
this.parent.switchToIframe();
|
||||
}
|
||||
});
|
||||
|
||||
return this;
|
||||
},
|
||||
logout() {
|
||||
|
||||
@@ -20,12 +20,10 @@ module.exports = {
|
||||
|
||||
adminPage.navigateAndLogin(admin);
|
||||
},
|
||||
'admin flags user\'s username as offensive': (client) => {
|
||||
'admin flags users username as offensive': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
|
||||
const comments = embedStream
|
||||
.navigate()
|
||||
.ready();
|
||||
const comments = embedStream.navigate().ready();
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@firstComment')
|
||||
@@ -63,15 +61,18 @@ module.exports = {
|
||||
.click('@flaggedUserRejectButton');
|
||||
},
|
||||
'admin suspends the user': (client) => {
|
||||
const adminPage = client.page.admin();
|
||||
const community = client.page.admin().section.community;
|
||||
|
||||
community
|
||||
adminPage
|
||||
.waitForElementVisible('@usernameDialog')
|
||||
.waitForElementVisible('@usernameDialogButtons')
|
||||
.waitForElementVisible('@usernameDialogSuspend')
|
||||
.click('@usernameDialogSuspend')
|
||||
.click('@usernameDialogSuspend')
|
||||
.waitForElementNotPresent('@flaggedUser');
|
||||
.waitForElementVisible('@usernameDialogSuspensionMessage')
|
||||
.click('@usernameDialogSuspend');
|
||||
|
||||
community.waitForElementNotPresent('@flaggedUser');
|
||||
},
|
||||
'admin logs out': (client) => {
|
||||
client.page.admin().logout();
|
||||
@@ -89,8 +90,15 @@ module.exports = {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments.waitForElementVisible('@restrictedMessageBox');
|
||||
},
|
||||
'user should not be able to comment': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@restrictedMessageBox');
|
||||
.waitForElementNotPresent('@commentBoxTextarea')
|
||||
.waitForElementNotPresent('@commentBoxPostButton');
|
||||
},
|
||||
'user picks another username': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
@@ -103,5 +111,13 @@ module.exports = {
|
||||
.waitForElementVisible('@changeUsernameSubmitButton')
|
||||
.click('@changeUsernameSubmitButton')
|
||||
.waitForElementNotPresent('@changeUsernameInput');
|
||||
}
|
||||
},
|
||||
'user should be able to comment': (client) => {
|
||||
const embedStream = client.page.embedStream();
|
||||
const comments = embedStream.section.comments;
|
||||
|
||||
comments
|
||||
.waitForElementVisible('@commentBoxTextarea')
|
||||
.waitForElementVisible('@commentBoxPostButton');
|
||||
},
|
||||
};
|
||||
|
||||
@@ -25,8 +25,14 @@ class SortedWindowHandler {
|
||||
*/
|
||||
windowHandles(callback) {
|
||||
this.client.windowHandles((result) => {
|
||||
|
||||
if (result.value.message) {
|
||||
throw new Error(result.value.message);
|
||||
}
|
||||
|
||||
this.handles = this.handles.filter((handle) => result.value.includes(handle));
|
||||
const remaining = result.value.filter((handle) => !this.handles.includes(handle));
|
||||
|
||||
if (remaining.length === 1) {
|
||||
this.handles.push(remaining[0]);
|
||||
}
|
||||
@@ -36,6 +42,14 @@ class SortedWindowHandler {
|
||||
callback(this.handles);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Switch to main window handle and remove latest handle.
|
||||
*/
|
||||
pop() {
|
||||
this.client.switchWindow(this.handles[0]);
|
||||
this.handles.splice(-1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = SortedWindowHandler;
|
||||
|
||||
Reference in New Issue
Block a user