@@ -16,6 +16,7 @@ import {
1616 logOutOfElement ,
1717 verify ,
1818} from "./utils" ;
19+ import { bootstrapCrossSigningForClient } from "../../pages/client.ts" ;
1920
2021test . describe ( "Cryptography" , function ( ) {
2122 test . use ( {
@@ -307,5 +308,30 @@ test.describe("Cryptography", function () {
307308 const penultimate = page . locator ( ".mx_EventTile" ) . filter ( { hasText : "test encrypted from verified" } ) ;
308309 await expect ( penultimate . locator ( ".mx_EventTile_e2eIcon" ) ) . not . toBeVisible ( ) ;
309310 } ) ;
311+
312+ test ( "should show correct shields on events sent by users with changed identity" , async ( {
313+ page,
314+ app,
315+ bot : bob ,
316+ homeserver,
317+ } ) => {
318+ // Verify Bob
319+ await verify ( app , bob ) ;
320+
321+ // Bob logs in a new device and resets cross-signing
322+ const bobSecondDevice = await createSecondBotDevice ( page , homeserver , bob ) ;
323+ await bootstrapCrossSigningForClient ( await bobSecondDevice . prepareClient ( ) , bob . credentials , true ) ;
324+
325+ /* should show an error for a message from a previously verified device */
326+ await bobSecondDevice . sendMessage ( testRoomId , "test encrypted from user that was previously verified" ) ;
327+ const last = page . locator ( ".mx_EventTile_last" ) ;
328+ await expect ( last ) . toContainText ( "test encrypted from user that was previously verified" ) ;
329+ const lastE2eIcon = last . locator ( ".mx_EventTile_e2eIcon" ) ;
330+ await expect ( lastE2eIcon ) . toHaveClass ( / m x _ E v e n t T i l e _ e 2 e I c o n _ w a r n i n g / ) ;
331+ await lastE2eIcon . focus ( ) ;
332+ await expect ( await app . getTooltipForElement ( lastE2eIcon ) ) . toContainText (
333+ "Sender's verified identity has changed" ,
334+ ) ;
335+ } ) ;
310336 } ) ;
311337} ) ;
0 commit comments