@@ -60,6 +60,11 @@ test.describe("User verification", () => {
60
60
// Accept
61
61
await toast . getByRole ( "button" , { name : "Verify User" } ) . click ( ) ;
62
62
63
+ // Wait for the QR code to be rendered. If we don't do this, then the QR code can be rendered just as
64
+ // Playwright tries to click the "Verify by emoji" button, which seems to make it miss the button.
65
+ // (richvdh: I thought Playwright was supposed to be resilient to such things, but empirically not.)
66
+ await expect ( page . getByAltText ( "QR Code" ) ) . toBeVisible ( ) ;
67
+
63
68
// request verification by emoji
64
69
await page . locator ( "#mx_RightPanel" ) . getByRole ( "button" , { name : "Verify by emoji" } ) . click ( ) ;
65
70
@@ -101,20 +106,29 @@ test.describe("User verification", () => {
101
106
const toast = await toasts . getToast ( "Verification requested" ) ;
102
107
await toast . getByRole ( "button" , { name : "Verify User" } ) . click ( ) ;
103
108
109
+ // Wait for the QR code to be rendered. If we don't do this, then the QR code can be rendered just as
110
+ // Playwright tries to click the "Verify by emoji" button, which seems to make it miss the button.
111
+ // (richvdh: I thought Playwright was supposed to be resilient to such things, but empirically not.)
112
+ await expect ( page . getByAltText ( "QR Code" ) ) . toBeVisible ( ) ;
113
+
104
114
// request verification by emoji
105
115
await page . locator ( "#mx_RightPanel" ) . getByRole ( "button" , { name : "Verify by emoji" } ) . click ( ) ;
106
116
107
117
/* on the bot side, wait for the verifier to exist ... */
108
118
const botVerifier = await awaitVerifier ( bobVerificationRequest ) ;
109
- // ... confirm ...
110
- botVerifier . evaluate ( ( verifier ) => verifier . verify ( ) ) . catch ( ( ) => { } ) ;
119
+ // ... and confirm. We expect the verification to fail; we catch the error on the DOM side
120
+ // to stop playwright marking the evaluate as failing in the UI.
121
+ const botVerification = botVerifier . evaluate ( ( verifier ) => verifier . verify ( ) . catch ( ( ) => { } ) ) ;
122
+
111
123
// ... and abort the verification
112
124
await page . getByRole ( "button" , { name : "They don't match" } ) . click ( ) ;
113
125
114
126
const dialog = page . locator ( ".mx_Dialog" ) ;
115
127
await expect ( dialog . getByText ( "Your messages are not secure" ) ) . toBeVisible ( ) ;
116
128
await dialog . getByRole ( "button" , { name : "OK" } ) . click ( ) ;
117
129
await expect ( dialog ) . not . toBeVisible ( ) ;
130
+
131
+ await botVerification ;
118
132
} ) ;
119
133
} ) ;
120
134
0 commit comments