Skip to content

Commit

Permalink
test: 🎨 Improve receive E2E test
Browse files Browse the repository at this point in the history
  • Loading branch information
VicAlbr committed Nov 27, 2024
1 parent eb4a19b commit faef7ed
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 6 deletions.
6 changes: 6 additions & 0 deletions .changeset/rotten-horses-shop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": minor
"@ledgerhq/live-common": minor
---

Fix Speculos CI + Update checks on receive and subAccount tests"
6 changes: 6 additions & 0 deletions apps/ledger-live-desktop/tests/page/modal/receive.modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ export class ReceiveModal extends Modal {
await this.skipDeviceButton.click();
}

@step("Retrieve fees amount value")
async getAddressDisplayed() {
const text = await this.addressDisplayedValue.textContent();
return text ? text?.split(" ")[0] : "";
}

@step("Verify receive address correctness $0")
async expectValidReceiveAddress(address: string) {
await expect(this.verifyAddressOnDeviceLabel).toBeVisible();
Expand Down
4 changes: 2 additions & 2 deletions apps/ledger-live-desktop/tests/page/speculos.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { delegateCosmos, sendCosmos } from "tests/families/cosmos";
import { delegateSolana, sendSolana } from "tests/families/solana";
export class SpeculosPage extends AppPage {
@step("Verify receive address correctness on device")
async expectValidAddressDevice(account: Account) {
async expectValidAddressDevice(account: Account, addressDisplayed: string) {
let deviceLabels: string[];

switch (account.currency) {
Expand All @@ -46,7 +46,7 @@ export class SpeculosPage extends AppPage {

await waitFor(deviceLabels[0]);
const events = await pressUntilTextFound(deviceLabels[1]);
const isAddressCorrect = containsSubstringInEvent(account.address, events);
const isAddressCorrect = containsSubstringInEvent(addressDisplayed, events);
expect(isAddressCorrect).toBeTruthy();
await pressBoth();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ for (const account of accounts) {
break;
}
await app.modal.continue();
await app.receive.expectValidReceiveAddress(account.account.address);
const displayedAddress = await app.receive.getAddressDisplayed();
await app.receive.expectValidReceiveAddress(displayedAddress);

await app.speculos.expectValidAddressDevice(account.account);
await app.speculos.expectValidAddressDevice(account.account, displayedAddress);
await app.receive.expectApproveLabel();
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,11 @@ for (const token of subAccountReceive) {
await app.receive.selectToken(token.account);

await app.modal.continue();
await app.receive.expectValidReceiveAddress(token.account.address);

await app.speculos.expectValidAddressDevice(token.account);
const displayedAddress = await app.receive.getAddressDisplayed();
await app.receive.expectValidReceiveAddress(displayedAddress);

await app.speculos.expectValidAddressDevice(token.account, displayedAddress);
await app.receive.expectApproveLabel();
},
);
Expand Down

0 comments on commit faef7ed

Please sign in to comment.