Skip to content

Commit

Permalink
fix(e2e): Switched trezoruserenvlink import to fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
HajekOndrej committed Jan 24, 2025
1 parent 2aad678 commit 0518617
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link';

import { AccountLabelId } from '../../support/enums/accountLabelId';
import { test, expect } from '../../support/fixtures';
import { MetadataProvider } from '../../support/mocks/metadataProviderMock';
Expand All @@ -25,6 +23,7 @@ test.describe(
settingsPage,
metadataPage,
devicePrompt,
trezorUserEnvLink,
}) => {
await onboardingPage.completeOnboarding({ enableViewOnly: false });
await dashboardPage.discoveryShouldFinish();
Expand All @@ -39,12 +38,12 @@ test.describe(
await page.getByTestId('@account-menu/btc/normal/0').click();
await metadataPage.clickAddAccountLabelButton(AccountLabelId.BitcoinDefault1);
await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressNo();
await trezorUserEnvLink.pressNo();

// Reload app, cancel metadata again, and remember device
await page.reload();
await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressNo();
await trezorUserEnvLink.pressNo();

await dashboardPage.discoveryShouldFinish();
await dashboardPage.deviceSwitchingOpenButton.click();
Expand All @@ -61,10 +60,10 @@ test.describe(
await expect(page.getByTestId('@passphrase/input')).not.toBeVisible();

await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();

await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();

await page
.getByTestId('@passphrase-confirmation/step1-open-unused-wallet-button')
Expand All @@ -74,16 +73,16 @@ test.describe(
await page.getByTestId('@passphrase/hidden/submit-button').click();

await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();

await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();

await expect(page.getByTestId('@passphrase/input')).not.toBeVisible();
await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();
await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();

// Close connect to data provider modal
await page.getByTestId('@modal/close-button').click();
Expand All @@ -99,7 +98,7 @@ test.describe(

// Enable labeling dialogue appears again
await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressNo();
await trezorUserEnvLink.pressNo();
});

test.afterEach(async ({ metadataProviderMock }) => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { TrezorUserEnvLink } from '@trezor/trezor-user-env-link';

import { AccountLabelId } from '../../support/enums/accountLabelId';
import { test, expect } from '../../support/fixtures';
import { MetadataProvider } from '../../support/mocks/metadataProviderMock';
Expand Down Expand Up @@ -36,6 +34,7 @@ test.describe('Remembered device', { tag: ['@group=metadata', '@webOnly'] }, ()
settingsPage,
metadataPage,
devicePrompt,
trezorUserEnvLink,
}) => {
await onboardingPage.completeOnboarding({ enableViewOnly: true });
await dashboardPage.discoveryShouldFinish();
Expand Down Expand Up @@ -82,14 +81,14 @@ test.describe('Remembered device', { tag: ['@group=metadata', '@webOnly'] }, ()

// disabling metadata removed also all keys, so metadata init flow takes all steps now expect for providers, these stay connected
await devicePrompt.confirmOnDevicePromptIsShown();
await TrezorUserEnvLink.pressYes();
await trezorUserEnvLink.pressYes();
await page.waitForTimeout(1000);

// device saved, disconnect provider
await page.getByTestId('@menu/switch-device').click();
await page.getByTestId('@switch-device/wallet-on-index/0').click();

await TrezorUserEnvLink.stopEmu();
await trezorUserEnvLink.stopEmu();

// Device is saved, when disconnected, user still can edit labels
await metadataPage.editAccountLabel(
Expand Down

0 comments on commit 0518617

Please sign in to comment.