This repository was archived by the owner on Sep 11, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 806
End to end tests for threads #8267
Merged
Merged
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
078b61f
WIP E2E tests for threads
t3chguy 156a689
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy 6c2f2d2
Iterate
t3chguy 4dce99f
Iterate e2e test
t3chguy 17dd372
Fix log line
t3chguy 86460ef
Scatter the tests with a bunch of assertions
t3chguy 7017fc7
Fix timings
t3chguy e478b32
Merge branch 'develop' of github.com:matrix-org/matrix-react-sdk into…
t3chguy 36ea104
Tidy
t3chguy f086572
Improve logging
t3chguy 104da56
fix performance monitoring
t3chguy a3a403d
Remove unused code
t3chguy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ element/env | |
| performance-entries.json | ||
| lib | ||
| logs | ||
| homeserver.log | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,45 @@ | ||
| /* | ||
| Copyright 2022 The Matrix.org Foundation C.I.C. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| import uuidv4 = require('uuid/v4'); | ||
|
|
||
| import { RestSession } from "./session"; | ||
| import { Logger } from "../logger"; | ||
|
|
||
| /* no pun intended */ | ||
|
t3chguy marked this conversation as resolved.
Outdated
|
||
| export class RestThread { | ||
| constructor( | ||
| readonly session: RestSession, | ||
| readonly roomId: string, | ||
| readonly threadId: string, | ||
| readonly log: Logger, | ||
| ) {} | ||
|
|
||
| async talk(message: string): Promise<void> { | ||
|
t3chguy marked this conversation as resolved.
Outdated
|
||
| this.log.step(`says "${message}" in ${this.roomId}`); | ||
| const txId = uuidv4(); | ||
| await this.session.put(`/rooms/${this.roomId}/send/m.room.message/${txId}`, { | ||
| "msgtype": "m.text", | ||
| "body": message, | ||
| "m.relates_to": { | ||
| "rel_type": "m.thread", | ||
| "event_id": this.threadId, | ||
| }, | ||
| }); | ||
| this.log.done(); | ||
| return txId; | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| /* | ||
| Copyright 2022 The Matrix.org Foundation C.I.C. | ||
|
|
||
| Licensed under the Apache License, Version 2.0 (the "License"); | ||
| you may not use this file except in compliance with the License. | ||
| You may obtain a copy of the License at | ||
|
|
||
| http://www.apache.org/licenses/LICENSE-2.0 | ||
|
|
||
| Unless required by applicable law or agreed to in writing, software | ||
| distributed under the License is distributed on an "AS IS" BASIS, | ||
| WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| See the License for the specific language governing permissions and | ||
| limitations under the License. | ||
| */ | ||
|
|
||
| import { ElementSession } from "../session"; | ||
| import { | ||
| assertTimelineThreadSummary, | ||
| clickTimelineThreadSummary, | ||
| editThreadMessage, | ||
| reactThreadMessage, | ||
| redactThreadMessage, | ||
| sendThreadMessage, | ||
| startThread, | ||
| } from "../usecases/threads"; | ||
| import { sendMessage } from "../usecases/send-message"; | ||
| import { | ||
| assertThreadListHasUnreadIndicator, | ||
| clickLatestThreadInThreadListPanel, | ||
| closeRoomRightPanel, | ||
| openThreadListPanel, | ||
| } from "../usecases/rightpanel"; | ||
|
|
||
| export async function threadsScenarios(alice: ElementSession, bob: ElementSession): Promise<void> { | ||
| console.log(" threads tests:"); | ||
|
|
||
| // Alice sends message | ||
| await sendMessage(alice, "Hey bob, what do you think about X?"); | ||
|
|
||
| // Bob responds via a thread | ||
| await startThread(bob, "I think its Y!"); | ||
|
|
||
| // Alice sees thread summary and opens thread panel | ||
| await assertTimelineThreadSummary(alice, "bob", "I think its Y!"); | ||
| await assertTimelineThreadSummary(bob, "bob", "I think its Y!"); | ||
| await clickTimelineThreadSummary(alice); | ||
|
|
||
| // Bob closes right panel | ||
| await closeRoomRightPanel(bob); | ||
|
|
||
| // Alice responds in thread | ||
| await sendThreadMessage(alice, "Great!"); | ||
| await assertTimelineThreadSummary(alice, "alice", "Great!"); | ||
| await assertTimelineThreadSummary(bob, "alice", "Great!"); | ||
|
|
||
| // Alice reacts to Bob's message instead | ||
| await reactThreadMessage(alice, "😁"); | ||
| await assertTimelineThreadSummary(alice, "alice", "Great!"); | ||
| await assertTimelineThreadSummary(bob, "alice", "Great!"); | ||
| await redactThreadMessage(alice); | ||
| await assertTimelineThreadSummary(alice, "bob", "I think its Y!"); | ||
| await assertTimelineThreadSummary(bob, "bob", "I think its Y!"); | ||
|
|
||
| // Bob sees notification dot on the thread header icon | ||
| await assertThreadListHasUnreadIndicator(bob); | ||
|
|
||
| // Bob opens thread list and inspects it | ||
| await openThreadListPanel(bob); | ||
|
|
||
| // Bob opens thread in right panel via thread list | ||
| await clickLatestThreadInThreadListPanel(bob); | ||
|
|
||
| // Bob responds to thread | ||
| await sendThreadMessage(bob, "Testing threads s'more :)"); | ||
| await assertTimelineThreadSummary(alice, "bob", "Testing threads s'more :)"); | ||
| await assertTimelineThreadSummary(bob, "bob", "Testing threads s'more :)"); | ||
|
|
||
| // Bob edits thread response | ||
| await editThreadMessage(bob, "Testing threads some more :)"); | ||
| await assertTimelineThreadSummary(alice, "bob", "Testing threads some more :)"); | ||
| await assertTimelineThreadSummary(bob, "bob", "Testing threads some more :)"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.