Skip to content

Commit

Permalink
[MS] Fixed export recovery file e2e tests & recovery device detection
Browse files Browse the repository at this point in the history
  • Loading branch information
Max-7 committed Nov 13, 2024
1 parent 84732a2 commit a394e68
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions client/src/locales/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@
"label": "Recovery file already created",
"subtitle": "A recovery file allows you to get back access to your data in case your forgot your password or lose your devices.",
"subtitle2": "Without a recovery file, your account cannot be recovered and you will need to be re-invited to join the organization.",
"button": "Create recovery file",
"button": "Create a recovery file",
"recreateQuestionTitle": "Create a new recovery file?",
"recreateQuestionMessage": "You have already created a recovery file in the past. Do you want to create a new one?",
"recreateYes": "Create a new recovery file",
Expand All @@ -724,7 +724,7 @@
"label": "Action required",
"subtitle": "A recovery file allows you to get back access to your data in case your forgot your password or lose your devices.",
"subtitle2": "Without a recovery file, your account cannot be recovered and you will need to be re-invited to join the organization.",
"button": "Create recovery file"
"button": "Create a recovery file"
}
},
"greet": {
Expand Down
4 changes: 2 additions & 2 deletions client/src/locales/fr-FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@
"label": "Fichier de récupération déjà créé",
"subtitle": "Un fichier de récupération vous permet de retrouver l'accès à vos données en cas d'oubli de votre mot de passe ou de perte de vos appareils.",
"subtitle2": "Sans fichier de récupération, votre compte ne pourra pas être récupéré et vous devrez être réinvité à rejoindre l'organisation.",
"button": "Créer fichier de récupération",
"button": "Créer un fichier de récupération",
"recreateQuestionTitle": "Créer un nouveau fichier de récupération ?",
"recreateQuestionMessage": "Vous avez déjà créé un fichier de récupération dans le passé. Souhaitez-vous en créer un nouveau ?",
"recreateYes": "Créer un nouveau fichier",
Expand All @@ -724,7 +724,7 @@
"label": "Action requise",
"subtitle": "Un fichier de récupération vous permet de retrouver l'accès à vos données en cas d'oubli de votre mot de passe ou de perte de vos appareils.",
"subtitle2": "Sans fichier de récupération, votre compte ne pourra pas être récupéré et vous devrez être réinvité à rejoindre l'organisation.",
"button": "Créer fichier de récupération"
"button": "Créer un fichier de récupération"
}
},
"greet": {
Expand Down
3 changes: 2 additions & 1 deletion client/src/parsec/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ export async function listOwnDevices(): Promise<Result<Array<OwnDeviceInfo>, Cli
if (result.ok) {
result.value.map((device) => {
(device as OwnDeviceInfo).isCurrent = device.id === clientResult.value.deviceId;
(device as OwnDeviceInfo).isRecovery = device.deviceLabel.startsWith(RECOVERY_DEVICE_PREFIX);
(device as OwnDeviceInfo).isRecovery =
device.deviceLabel.startsWith(RECOVERY_DEVICE_PREFIX) || device.purpose === DevicePurpose.PassphraseRecovery;
return device;
});
}
Expand Down
12 changes: 8 additions & 4 deletions client/tests/e2e/specs/export_recovery_device.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
// Parsec Cloud (https://parsec.cloud) Copyright (c) BUSL-1.1 2016-present Scille SAS

import { expect, msTest } from '@tests/e2e/helpers';
import { answerQuestion, expect, msTest } from '@tests/e2e/helpers';

msTest('Export recovery device', async ({ myProfilePage }) => {
const container = myProfilePage.locator('.restore-password');
await container.locator('.restore-password-button').click();
await expect(myProfilePage.locator('.topbar-left').locator('.topbar-left__title')).toHaveText('Recovery files');
await answerQuestion(myProfilePage, true, {
expectedTitleText: 'Create a new recovery file?',
expectedQuestionText: 'You have already created a recovery file in the past. Do you want to create a new one?',
expectedPositiveText: 'Create a new recovery file',
expectedNegativeText: 'Cancel',
});
await expect(myProfilePage.locator('.topbar-left').locator('.topbar-left__title')).toHaveText('Recovery file');
const recoveryContainer = myProfilePage.locator('.recovery-container');
await expect(recoveryContainer.locator('ion-button')).toHaveText('I understand');
await recoveryContainer.locator('ion-button').click();
const fileContainer = recoveryContainer.locator('.file-item').nth(0);
const passphraseContainer = recoveryContainer.locator('.file-item').nth(1);

Expand Down
2 changes: 1 addition & 1 deletion client/tests/e2e/specs/import_recovery_device.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ msTest('Import recovery device', async ({ home }, testInfo: TestInfo) => {
const container = home.locator('.recovery-content');

await expect(container.locator('.container-textinfo')).toHaveText(
'You must have created recovery files in order to reset your authentication.',
'You must have created a recovery file in order to reset your authentication method.',
);

const okButton = container.locator('#to-password-change-btn');
Expand Down
7 changes: 4 additions & 3 deletions client/tests/e2e/specs/my_profile_page.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ msTest('Check devices list', async ({ myProfilePage }) => {
msTest('Check if restore-password section is displayed', async ({ myProfilePage }) => {
const restorePassword = myProfilePage.locator('.restore-password');
await expect(restorePassword).toBeVisible();
await expect(restorePassword.locator('.restore-password-header__title')).toHaveText('Authentication recovery files');
await expect(restorePassword.locator('.restore-password-header__title')).toHaveText('Create a recovery file');
await expect(restorePassword.locator('.restore-password-subtitles')).toHaveText(
'Authentication recovery files have been created and downloaded.',
`A recovery file allows you to get back access to your data in case your forgot your password or lose your
devices.Without a recovery file, your account cannot be recovered and you will need to be re-invited to join the organization.`,
);
await expect(restorePassword.locator('.restore-password-button')).toHaveText('Re-download recovery files');
await expect(restorePassword.locator('.restore-password-button')).toHaveText('Create a recovery file');
});

msTest('Open authentication section', async ({ myProfilePage }) => {
Expand Down

0 comments on commit a394e68

Please sign in to comment.