Skip to content

Commit

Permalink
chore(suite): fix UI tests to corespond with the reality
Browse files Browse the repository at this point in the history
  • Loading branch information
vojtatranta committed Feb 7, 2025
1 parent cea83a4 commit 3d48a6e
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions packages/suite-desktop-core/e2e/support/bridge.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export const expectBridgeToBeStopped = async (request: APIRequestContext) => {
}).rejects.toThrow('ECONNREFUSED');
};

// We wait for `@welcome/title` or `@dashboard/graph` since
// We wait for `@welcome-layout/body` or `@dashboard/graph` since
// one or the other will be display depending on the state of the app
// due to previously run tests. And both means the same for the porpoise of this test.
// Bridge should be ready to check `/status` endpoint.
export const waitForAppToBeInitialized = async (suite: any) =>
await Promise.race([
expect(suite.window.getByTestId('@welcome/title')).toBeVisible(),
expect(suite.window.getByTestId('@welcome-layout/body')).toBeVisible(),
expect(suite.window.getByTestId('@dashboard/graph')).toBeVisible(),
]);
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class OnboardingActions {
readonly pin: PinActions;
readonly tutorial: TutorialActions;

readonly welcomeTitle: Locator;
readonly welcomeBody: Locator;
readonly onboardingContinueButton: Locator;
readonly onboardingViewOnlySkipButton: Locator;
readonly onboardingViewOnlyEnableButton: Locator;
Expand Down Expand Up @@ -52,7 +52,7 @@ export class OnboardingActions {
this.tutorial = new TutorialActions(page);
this.pin = new PinActions(page);

this.welcomeTitle = this.page.getByTestId('@welcome/title');
this.welcomeBody = this.page.getByTestId('@welcome-layout/body');
this.onboardingContinueButton = this.page.getByTestId('@onboarding/exit-app-button');
this.onboardingViewOnlySkipButton = this.page.getByTestId('@onboarding/viewOnly/skip');
this.onboardingViewOnlyEnableButton = this.page.getByTestId('@onboarding/viewOnly/enable');
Expand Down Expand Up @@ -83,7 +83,7 @@ export class OnboardingActions {

@step()
async optionallyDismissFwHashCheckError() {
await expect(this.welcomeTitle).toBeVisible({ timeout: 10000 });
await expect(this.welcomeBody).toBeVisible({ timeout: 10000 });
// dismisses the error modal only if it appears (handle it async in parallel, not necessary to block the rest of the flow)
this.page
.$('[data-testid="@device-compromised/back-button"]')
Expand Down Expand Up @@ -114,7 +114,7 @@ export class OnboardingActions {
return;
}

await expect(this.welcomeTitle).toBeVisible({ timeout: 10000 });
await expect(this.welcomeBody).toBeVisible({ timeout: 10000 });
// eslint-disable-next-line @typescript-eslint/no-shadow
await this.page.evaluate(SuiteActions => {
window.store.dispatch({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ test.describe.skip('Tor loading screen', { tag: ['@group=suite', '@desktopOnly']
state: 'visible',
});

await suite.window.waitForSelector('[data-testid="@welcome/title"]', { timeout });
await suite.window.waitForSelector('[data-testid="@welcome-layout/body"]', { timeout });

suite.electronApp.close();
});
Expand Down Expand Up @@ -83,7 +83,7 @@ test.describe.skip('Tor loading screen', { tag: ['@group=suite', '@desktopOnly']
state: 'visible',
});

await suite.window.waitForSelector('[data-testid="@welcome/title"]', { timeout });
await suite.window.waitForSelector('[data-testid="@welcome-layout/body"]', { timeout });
networkAnalyzer.stop();
const requests = networkAnalyzer.getRequests();
requests.forEach(request => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { expect, test } from '../../support/fixtures';
test.use({ startEmulator: false, ...devices['Desktop Firefox'], channel: 'firefox' });
test.describe('Firefox', { tag: ['@group=other', '@webOnly'] }, () => {
test('Suite does support Firefox', async ({ page, onboardingPage }) => {
await expect(onboardingPage.welcomeTitle).toBeVisible({ timeout: 20_000 });
await expect(onboardingPage.welcomeBody).toBeVisible({ timeout: 20_000 });
await expect(page.getByText('Continue at my own risk')).not.toBeVisible();
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ test.describe('Safari', { tag: ['@group=other', '@webOnly', '@snapshot'] }, () =
'Continue at my own risk',
);
await onboardingPage.continueAtYourOwnRiskButton.click({ force: true });
await expect(onboardingPage.welcomeTitle).toBeVisible({ timeout: 20_000 });
await expect(onboardingPage.welcomeBody).toBeVisible({ timeout: 20_000 });
});
});

0 comments on commit 3d48a6e

Please sign in to comment.