-
Notifications
You must be signed in to change notification settings - Fork 332
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEAT]: Add trustchain & createQRCodeHostInstance flow (#7520)
[FIX]: issue when staying long time on DisplayQRcode page Rework Hook
- Loading branch information
1 parent
3de93cc
commit 641cc17
Showing
18 changed files
with
394 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"live-mobile": patch | ||
--- | ||
|
||
Add trustchain & createQRCodeHostInstance flow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
apps/ledger-live-mobile/src/newArch/features/Accounts/types/enum/addAccount.ts
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
...e-mobile/src/newArch/features/WalletSync/__integrations__/scanQRCode.integration.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from "react"; | ||
import { render, screen } from "@tests/test-renderer"; | ||
|
||
import { INITIAL_TEST, WalletSyncSettingsNavigator } from "./shared"; | ||
|
||
describe("scanQRCode", () => { | ||
it("Should open the QR code scene when 'scan a qr code' toggle is pressed", async () => { | ||
const { user } = render(<WalletSyncSettingsNavigator />, { | ||
overrideInitialState: INITIAL_TEST, | ||
}); | ||
await user.press(await screen.findByText(/ledger sync/i)); | ||
await user.press(await screen.findByText(/already created a key?/i)); | ||
await user.press(await screen.findByText(/scan a qr code/i)); | ||
await expect(await screen.findByText(/show qr/i)).toBeVisible(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
...c/newArch/features/WalletSync/__integrations__/synchronizeWithQrCode.integration.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import React from "react"; | ||
import { render, screen, waitFor } from "@tests/test-renderer"; | ||
|
||
import { INITIAL_TEST, WalletSyncSettingsNavigator } from "./shared"; | ||
import getWalletSyncEnvironmentParams from "@ledgerhq/live-common/walletSync/getEnvironmentParams"; | ||
|
||
jest.mock("@ledgerhq/trustchain/qrcode/index", () => ({ | ||
createQRCodeHostInstance: () => ({ | ||
trustchainApiBaseUrl: getWalletSyncEnvironmentParams("STAGING").trustchainApiBaseUrl, | ||
onDisplayQRCode: jest.fn().mockImplementation(url => url), | ||
onDisplayDigits: jest.fn().mockImplementation(digits => digits), | ||
addMember: jest.fn(), | ||
}), | ||
})); | ||
|
||
describe("SynchronizeWithQrCode", () => { | ||
it("Should display the QR code when 'show qr' toggle is pressed and add a new member through the flow", async () => { | ||
const { user } = render(<WalletSyncSettingsNavigator />, { | ||
overrideInitialState: INITIAL_TEST, | ||
}); | ||
await user.press(await screen.findByText(/ledger sync/i)); | ||
await user.press(await screen.findByText(/already created a key?/i)); | ||
await user.press(await screen.findByText(/scan a qr code/i)); | ||
await user.press(await screen.findByText(/show qr/i)); | ||
expect(await screen.getByTestId("ws-qr-code-displayed")).toBeVisible(); | ||
|
||
//PinCode Page after scanning QRCode | ||
// Need to wait 3 seconds to simulate the time taken to scan the QR code | ||
setTimeout(async () => { | ||
await waitFor(() => { | ||
expect(screen.getByText("Enter the code")).toBeDefined(); | ||
}); | ||
}, 3000); | ||
|
||
//Succes Page after PinCode | ||
setTimeout(async () => { | ||
await waitFor(() => { | ||
expect( | ||
screen.getByText( | ||
"Changes in your accounts will now automatically appear across all apps and platforms.", | ||
), | ||
).toBeDefined(); | ||
}); | ||
}, 3000); | ||
}); | ||
}); |
Oops, something went wrong.