@@ -14,9 +14,10 @@ See the License for the specific language governing permissions and
1414limitations under the License.
1515*/
1616
17+ import { MatrixClient , Room } from "matrix-js-sdk/src/matrix" ;
18+
1719import type { VerificationRequest } from "matrix-js-sdk/src/crypto/verification/request/VerificationRequest" ;
1820import type { ISasEvent } from "matrix-js-sdk/src/crypto/verification/SAS" ;
19- import type { MatrixClient , Room } from "matrix-js-sdk/src/matrix" ;
2021import { SynapseInstance } from "../../plugins/synapsedocker" ;
2122import Chainable = Cypress . Chainable ;
2223
@@ -60,7 +61,6 @@ const testMessages = function(this: CryptoTestContext) {
6061 // check the invite message
6162 cy . contains ( ".mx_EventTile_body" , "Hey!" ) . closest ( ".mx_EventTile" ) . within ( ( ) => {
6263 cy . get ( ".mx_EventTile_e2eIcon_warning" ) . should ( "not.exist" ) ;
63- cy . get ( ".mx_EventTile_receiptSent" ) . should ( "exist" ) ;
6464 } ) ;
6565
6666 // Bob sends a response
@@ -73,17 +73,31 @@ const testMessages = function(this: CryptoTestContext) {
7373} ;
7474
7575const bobJoin = function ( this : CryptoTestContext ) {
76- cy . botJoinRoomByName ( this . bob , "Alice" ) . as ( "bobsRoom" ) ;
76+ cy . window ( { log : false } ) . then ( async win => {
77+ const bobRooms = this . bob . getRooms ( ) ;
78+ if ( ! bobRooms . length ) {
79+ await new Promise < void > ( resolve => {
80+ const onMembership = ( _event ) => {
81+ this . bob . off ( win . matrixcs . RoomMemberEvent . Membership , onMembership ) ;
82+ resolve ( ) ;
83+ } ;
84+ this . bob . on ( win . matrixcs . RoomMemberEvent . Membership , onMembership ) ;
85+ } ) ;
86+ }
87+ } ) . then ( ( ) => {
88+ cy . botJoinRoomByName ( this . bob , "Alice" ) . as ( "bobsRoom" ) ;
89+ } ) ;
90+
7791 cy . contains ( ".mx_TextualEvent" , "Bob joined the room" ) . should ( "exist" ) ;
7892} ;
7993
8094const handleVerificationRequest = ( request : VerificationRequest ) : Chainable < EmojiMapping [ ] > => {
8195 return cy . wrap ( new Promise < EmojiMapping [ ] > ( ( resolve ) => {
8296 const onShowSas = ( event : ISasEvent ) => {
83- resolve ( event . sas . emoji ) ;
8497 verifier . off ( "show_sas" , onShowSas ) ;
8598 event . confirm ( ) ;
8699 verifier . done ( ) ;
100+ resolve ( event . sas . emoji ) ;
87101 } ;
88102
89103 const verifier = request . beginKeyVerification ( "m.sas.v1" ) ;
0 commit comments