Skip to content

Commit ed3c6d7

Browse files
Merge pull request #11 from matrix-org/test-key-restore-marks-session-as-verified
Write more actions + make changes for selectors
2 parents 85867ca + f9b38ee commit ed3c6d7

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

cypress/e2e/trafficlight/trafficlight.spec.ts

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function runAction(action: string, data: JSONValue): string | undefined {
7272
switch (action) {
7373
case 'register':
7474
cy.visit('/#/register');
75-
cy.get('.mx_ServerPicker_change', { timeout: 15000 }).click();
75+
cy.get('.mx_ServerPicker_change').click();
7676
cy.get('.mx_ServerPickerDialog_continue').should('be.visible');
7777
cy.get('.mx_ServerPickerDialog_otherHomeserver').type(data['homeserver_url']['local']);
7878
cy.get('.mx_ServerPickerDialog_continue').click();
@@ -88,7 +88,7 @@ function runAction(action: string, data: JSONValue): string | undefined {
8888
return 'registered';
8989
case 'login':
9090
cy.visit('/#/login');
91-
cy.get('#mx_LoginForm_username', { timeout: 15000 }).should('be.visible');
91+
cy.get('#mx_LoginForm_username').should('be.visible');
9292
cy.get('.mx_ServerPicker_change').click();
9393
cy.get('.mx_ServerPickerDialog_otherHomeserver').clear().type(data['homeserver_url']['local']);
9494
cy.get('.mx_ServerPickerDialog_continue').click();
@@ -100,9 +100,9 @@ function runAction(action: string, data: JSONValue): string | undefined {
100100
// Try to restore from key backup if needed
101101
if (data["key_backup_passphrase"]) {
102102
cy.log("Restoring from keybackup ...");
103-
cy.get(".mx_CompleteSecurity_actionRow .mx_AccessibleButton_kind_primary").click();
103+
cy.get(".mx_CompleteSecurity_actionRow .mx_AccessibleButton_kind_primary").last().click();
104104
cy.get("#mx_passPhraseInput").clear().type(data["key_backup_passphrase"]);
105-
cy.get(".mx_AccessSecretStorageDialog_primaryContainer [data-test-id='dialog-primary-button']").click();
105+
cy.get(".mx_AccessSecretStorageDialog_primaryContainer [data-testid='dialog-primary-button']").click();
106106
cy.get(".mx_CompleteSecurity_actionRow .mx_AccessibleButton_kind_primary").click();
107107
} else {
108108
cy.log("Skipping security popup ...");
@@ -152,6 +152,13 @@ function runAction(action: string, data: JSONValue): string | undefined {
152152
cy.get('.mx_VerificationShowSas_buttonRow > .mx_AccessibleButton_kind_primary').click();
153153
cy.get('.mx_UserInfo_container > .mx_AccessibleButton').click();
154154
return 'verified_crosssign';
155+
case "verify_trusted_device":
156+
cy.gotoAllSettings();
157+
cy.get("[data-testid='settings-tab-USER_SECURITY_TAB']").click();
158+
// For now, we only care if there are any verified devices
159+
cy.contains(/^Verified devices$/);
160+
cy.get(".mx_DevicesPanel_device").children();
161+
return "verified";
155162
case 'idle':
156163
cy.wait(5000);
157164
break;
@@ -205,18 +212,18 @@ function runAction(action: string, data: JSONValue): string | undefined {
205212
cy.get("[data-testid='settings-tab-USER_SECURITY_TAB']").click();
206213
cy.get(".mx_SecureBackupPanel_buttonRow").contains("Set up").click();
207214
cy.get(".mx_CreateSecretStorageDialog_optionIcon_securePhrase").click();
208-
cy.get("[data-test-id='dialog-primary-button']").click();
215+
cy.get(".mx_CreateSecretStorageDialog [data-testid='dialog-primary-button']").click();
209216
const password = data["key_backup_passphrase"];
210217
if (!password) {
211218
throw new Error("'key_backup_passphrase' not in data for action 'enable_dehydrated_device'");
212219
}
213220
cy.get(".mx_CreateSecretStorageDialog_passPhraseContainer input[type='password']").type(password);
214-
cy.get("[data-test-id='dialog-primary-button']").click();
221+
cy.get("[data-testid='dialog-primary-button']").click();
215222
// confirm the password again
216223
cy.get(".mx_CreateSecretStorageDialog_passPhraseContainer input[type='password']").type(password);
217-
cy.get("[data-test-id='dialog-primary-button']").click();
224+
cy.get("[data-testid='dialog-primary-button']").click();
218225
// Continue to next screen
219-
cy.get("[data-test-id='dialog-primary-button']").click();
226+
cy.get("[data-testid='dialog-primary-button']").click();
220227
// Classic flakiness fix
221228
cy.wait(500);
222229
cy.get(".mx_CreateSecretStorageDialog").contains("Continue").click();

0 commit comments

Comments
 (0)