Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .maestro/scripts/data-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,24 @@ const deleteCreatedUsers = () => {
}
};

const deleteReportedMessages = (username, password) => {
try {
const { userId } = login(username, password);

login(output.account.adminUser, output.account.adminPassword);

postWithRetry(`${data.server}/api/v1/moderation.user.deleteReportedMessages`, {
headers: {
'Content-Type': 'application/json',
...headers
},
body: JSON.stringify({ userId })
});
} catch (error) {
console.log(JSON.stringify(error));
}
};

function logAccounts() {
console.log(JSON.stringify(data.accounts));
}
Expand Down Expand Up @@ -260,8 +278,9 @@ output.utils = {
createRandomRoom,
sendMessage,
getProfileInfo,
deleteReportedMessages,
post,
login,
getDeepLink,
createDM
};
};
72 changes: 72 additions & 0 deletions .maestro/tests/room/report-message.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
appId: ${APP_ID}
name: Report Message
onFlowStart:
- runFlow: '../../helpers/setup.yaml'
onFlowComplete:
- evalScript: ${output.otherUser && output.utils.deleteReportedMessages(output.otherUser.username, output.otherUser.password)}
- evalScript: ${output.utils.deleteCreatedUsers()}
tags:
- test-10

---
- evalScript: ${output.user = output.utils.createUser()}
- evalScript: ${output.otherUser = output.utils.createUser()}
- evalScript: ${output.utils.sendMessage(output.otherUser.username, output.otherUser.password, '@' + output.user.username, 'message-to-report')}

- runFlow:
file: '../../helpers/login-with-deeplink.yaml'
env:
USERNAME: ${output.user.username}
PASSWORD: ${output.user.password}
- runFlow:
file: '../../helpers/navigate-to-room.yaml'
env:
ROOM: ${output.otherUser.username}

# should report another user's message
- extendedWaitUntil:
visible:
id: 'message-content-message-to-report'
timeout: 60000
- longPressOn:
id: 'message-content-message-to-report'
- extendedWaitUntil:
visible:
id: action-sheet
timeout: 60000
- swipe:
from:
id: action-sheet-handle
direction: UP
- scrollUntilVisible:
element:
id: message-actions-report
- tapOn:
id: message-actions-report
- extendedWaitUntil:
visible:
text: 'Message reported'
timeout: 60000
- tapOn: 'OK'

# should not report own message
- runFlow:
file: '../../helpers/send-message.yaml'
env:
message: 'own-message-to-report'
- runFlow: '../../helpers/hide-keyboard.yaml'
- longPressOn:
id: 'message-content-own-message-to-report'
- extendedWaitUntil:
visible:
id: action-sheet
timeout: 60000
- swipe:
from:
id: action-sheet-handle
direction: UP
- scrollUntilVisible:
element:
id: message-actions-delete
- assertNotVisible:
id: message-actions-report
Loading