Skip to content

Commit

Permalink
test: fix broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranjamie committed Dec 6, 2024
1 parent a5bd8f6 commit 65d5cf3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 8 deletions.
10 changes: 5 additions & 5 deletions src/app/pages/legacy-account-auth/legacy-account-auth.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { closeWindow } from '@shared/utils';

// import { useCancelAuthRequest } from '@app/common/authentication/use-cancel-auth-request';
import { useCancelAuthRequest } from '@app/common/authentication/use-cancel-auth-request';
import { useFinishAuthRequest } from '@app/common/authentication/use-finish-auth-request';
import { useAppDetails } from '@app/common/hooks/auth/use-app-details';
// import { useOnMount } from '@app/common/hooks/use-on-mount';
import { useOnMount } from '@app/common/hooks/use-on-mount';
import { useSwitchAccountSheet } from '@app/common/switch-account/use-switch-account-sheet-context';
import { openInNewTab } from '@app/common/utils/open-in-new-tab';
import { CurrentAccountDisplayer } from '@app/features/current-account/current-account-displayer';
Expand All @@ -20,10 +20,10 @@ export function LegacyAccountAuth() {

useOnOriginTabClose(() => closeWindow());

// const cancelAuthentication = useCancelAuthRequest();
const cancelAuthentication = useCancelAuthRequest();

// const handleUnmount = async () => cancelAuthentication();
// useOnMount(() => window.addEventListener('beforeunload', handleUnmount));
const handleUnmount = async () => cancelAuthentication();
useOnMount(() => window.addEventListener('beforeunload', handleUnmount));

if (!url) throw new Error('No app details found');

Expand Down
5 changes: 4 additions & 1 deletion tests/specs/profile/profile.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { TestAppPage } from '@tests/page-object-models/test-app.page';
import { UpdateProfileRequestPage } from '@tests/page-object-models/update-profile-request.page';
import { OnboardingSelectors } from '@tests/selectors/onboarding.selectors';

import { delay } from '@leather.io/utils';

import { test } from '../../fixtures/fixtures';

test.describe.configure({ mode: 'serial' });
Expand All @@ -20,7 +22,8 @@ test.describe('Profile updating', () => {
const newPagePromise = context.waitForEvent('page');
await testAppPage.page.getByTestId(OnboardingSelectors.SignUpBtn).click();
const accountsPage = await newPagePromise;
await accountsPage.getByTestId('switch-account-item-0').click({ force: true });
await delay(1000);
await accountsPage.getByRole('button').getByText('Confirm').click({ force: true });
await testAppPage.page.bringToFront();
await testAppPage.page.click('text=Profile', {

Check failure on line 28 in tests/specs/profile/profile.spec.ts

View workflow job for this annotation

GitHub Actions / Shard 4 of 10

[chromium] › specs/profile/profile.spec.ts:21:3 › Profile updating › should show an error for invalid profile

1) [chromium] › specs/profile/profile.spec.ts:21:3 › Profile updating › should show an error for invalid profile Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: page.click: Target page, context or browser has been closed Call log: - waiting for locator('text=Profile') 26 | await accountsPage.getByRole('button').getByText('Confirm').click({ force: true }); 27 | await testAppPage.page.bringToFront(); > 28 | await testAppPage.page.click('text=Profile', { | ^ 29 | timeout: 30000, 30 | }); 31 | await accountsPage.close(); at /home/runner/work/extension/extension/tests/specs/profile/profile.spec.ts:28:28

Check failure on line 28 in tests/specs/profile/profile.spec.ts

View workflow job for this annotation

GitHub Actions / Shard 4 of 10

[chromium] › specs/profile/profile.spec.ts:21:3 › Profile updating › should show an error for invalid profile

1) [chromium] › specs/profile/profile.spec.ts:21:3 › Profile updating › should show an error for invalid profile Retry #2 ─────────────────────────────────────────────────────────────────────────────────────── Error: page.click: Target page, context or browser has been closed Call log: - waiting for locator('text=Profile') 26 | await accountsPage.getByRole('button').getByText('Confirm').click({ force: true }); 27 | await testAppPage.page.bringToFront(); > 28 | await testAppPage.page.click('text=Profile', { | ^ 29 | timeout: 30000, 30 | }); 31 | await accountsPage.close(); at /home/runner/work/extension/extension/tests/specs/profile/profile.spec.ts:28:28
timeout: 30000,
Expand Down
8 changes: 6 additions & 2 deletions tests/specs/transactions/transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@ import { TestAppPage } from '@tests/page-object-models/test-app.page';
import { TransactionRequestPage } from '@tests/page-object-models/transaction-request.page';
import { OnboardingSelectors } from '@tests/selectors/onboarding.selectors';

import { delay, stxToMicroStx } from '@leather.io/utils';
import { stxToMicroStx } from '@leather.io/utils';

import { createDelay } from '@shared/utils';

import { test } from '../../fixtures/fixtures';

const delayAnimationDuration = createDelay(1200);

test.describe('Transaction signing', () => {
let testAppPage: TestAppPage;

Expand Down Expand Up @@ -50,8 +54,8 @@ test.describe('Transaction signing', () => {
const newPagePromise = context.waitForEvent('page');
await testAppPage.page.getByTestId(OnboardingSelectors.SignUpBtn).click();
const accountsPage = await newPagePromise;
await delayAnimationDuration();
await accountsPage.getByRole('button').getByText('Confirm').click({ force: true });
await delay(2000);
await testAppPage.page.bringToFront();
await testAppPage.page.click('text=Debugger', {

Check failure on line 60 in tests/specs/transactions/transactions.spec.ts

View workflow job for this annotation

GitHub Actions / Shard 10 of 10

[chromium] › specs/transactions/transactions.spec.ts:53:5 › Transaction signing › App initiated STX transfer › that it broadcasts correctly with given fee and amount

1) [chromium] › specs/transactions/transactions.spec.ts:53:5 › Transaction signing › App initiated STX transfer › that it broadcasts correctly with given fee and amount Error: page.click: Target page, context or browser has been closed Call log: - waiting for locator('text=Debugger') 58 | await accountsPage.getByRole('button').getByText('Confirm').click({ force: true }); 59 | await testAppPage.page.bringToFront(); > 60 | await testAppPage.page.click('text=Debugger', { | ^ 61 | timeout: 30000, 62 | }); 63 | await accountsPage.close(); at /home/runner/work/extension/extension/tests/specs/transactions/transactions.spec.ts:60:30

Check failure on line 60 in tests/specs/transactions/transactions.spec.ts

View workflow job for this annotation

GitHub Actions / Shard 10 of 10

[chromium] › specs/transactions/transactions.spec.ts:53:5 › Transaction signing › App initiated STX transfer › that it broadcasts correctly with given fee and amount

1) [chromium] › specs/transactions/transactions.spec.ts:53:5 › Transaction signing › App initiated STX transfer › that it broadcasts correctly with given fee and amount Retry #1 ─────────────────────────────────────────────────────────────────────────────────────── Error: page.click: Target page, context or browser has been closed Call log: - waiting for locator('text=Debugger') 58 | await accountsPage.getByRole('button').getByText('Confirm').click({ force: true }); 59 | await testAppPage.page.bringToFront(); > 60 | await testAppPage.page.click('text=Debugger', { | ^ 61 | timeout: 30000, 62 | }); 63 | await accountsPage.close(); at /home/runner/work/extension/extension/tests/specs/transactions/transactions.spec.ts:60:30
timeout: 30000,
Expand Down

0 comments on commit 65d5cf3

Please sign in to comment.