Skip to content

Commit

Permalink
more receive flows : checking warning messages
Browse files Browse the repository at this point in the history
  • Loading branch information
bharamboure-ledger committed Sep 3, 2024
1 parent 9a4a3bc commit e846d61
Show file tree
Hide file tree
Showing 4 changed files with 344 additions and 2 deletions.
2 changes: 1 addition & 1 deletion apps/ledger-live-desktop/tests/page/account.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class AccountPage extends AppPage {
private stakeButtonCosmos = this.page.getByTestId("stake-button-cosmos");
readonly stakeBanner = this.page.getByTestId("account-stake-banner");
private stakeBannerButton = this.page.getByTestId("account-stake-banner-button");
private receiveButton = this.page.getByTestId("receive-account-action-button");
private receiveButton = this.page.getByRole("button", { name: "Receive", exact: true });
private sendButton = this.page.getByRole("button", { name: "Send" });
private accountName = (name: string) => this.page.locator(`text=${name}`);
private lastOperation = this.page.locator("text=Latest operations");
Expand Down
17 changes: 17 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 @@ -12,6 +12,7 @@ export class ReceiveModal extends Modal {
private receiveAddressValue = (address: string) => this.page.locator(`text=${address}`);
private addressDisplayedValue = this.page.locator("#address-field");
private selectAccount = this.page.getByText("Choose a crypto asset");
private warningMessage = this.page.locator('div[type="warning"]');
readonly selectAccountInput = this.page.locator('[placeholder="Search"]');

@step("Select token")
Expand All @@ -36,4 +37,20 @@ export class ReceiveModal extends Modal {
async expectApproveLabel() {
await expect(this.approveLabel).toBeVisible();
}

@step("Verify send currency / tokens warning message $1")
async verifySendCurrencyTokensWarningMessage(account: Account, specificTokens: string) {
await expect(this.warningMessage).toBeVisible();
await expect(this.warningMessage)
.toContainText(`Please only send ${account.currency.ticker} or ${specificTokens} tokens to ${account.currency.name} accounts.
Sending other crypto assets may result in the permanent loss of funds.`);
}

@step("Verify TRON address activation warning message")
async verifyTronAddressActivationWarningMessage() {
await expect(this.warningMessage).toBeVisible();
await expect(this.warningMessage).toContainText(
`You first need to send at least 0.1 TRX to this address to activate it. Learn more`,
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const accounts: Account[] = [
Account.BCH_1,
Account.ATOM_1,
Account.XTZ_1,
Account.BSC_1,
];

//Warning 🚨: Test may fail due to the GetAppAndVersion issue - Jira: LIVE-12581
Expand All @@ -29,7 +30,7 @@ for (const account of accounts) {
{
annotation: {
type: "TMS",
description: "B2CQA-249, B2CQA-651",
description: "B2CQA-249, B2CQA-651, B2CQA-652",
},
},
async ({ app }) => {
Expand All @@ -40,6 +41,17 @@ for (const account of accounts) {
await app.account.expectAccountVisibility(account.accountName);

await app.account.clickReceive();
switch (account) {
case Account.TRX_1:
await app.receive.verifySendCurrencyTokensWarningMessage(account, "TRC10/TRC20");
break;
case Account.ETH_1:
await app.receive.verifySendCurrencyTokensWarningMessage(account, "Ethereum");
break;
case Account.BSC_1:
await app.receive.verifySendCurrencyTokensWarningMessage(account, "BEP20");
break;
}
await app.modal.continue();
await app.receive.expectValidReceiveAddress(account.address);

Check failure on line 56 in apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu) (2, 3)

[speculos_tests] › specs/speculos/receive.address.spec.ts:28:9 › Receive › [XRP] Receive

1) [speculos_tests] › specs/speculos/receive.address.spec.ts:28:9 › Receive › [XRP] Receive › Verify receive address correctness rhQvt8XfAGn1hVVtMUmdGKBUdnKzi2oimV Error: Timed out 41000ms waiting for expect(locator).toBeVisible() Locator: locator('text=Verify that the shared address exactly matches the one on your device') Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 41000ms - waiting for locator('text=Verify that the shared address exactly matches the one on your device') 54 | } 55 | await app.modal.continue(); > 56 | await app.receive.expectValidReceiveAddress(account.address); | ^ 57 | 58 | await app.speculos.expectValidReceiveAddress(account); 59 | await app.receive.expectApproveLabel(); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts:56:27

Check failure on line 56 in apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu) (2, 3)

[speculos_tests] › specs/speculos/receive.address.spec.ts:28:9 › Receive › [Bitcoin Cash] Receive

2) [speculos_tests] › specs/speculos/receive.address.spec.ts:28:9 › Receive › [Bitcoin Cash] Receive › Verify receive address correctness qz82kem69vdafku8xf4zpt9p5ytj8umwpujj7wjcv6 Error: Timed out 41000ms waiting for expect(locator).toBeVisible() Locator: locator('text=Verify that the shared address exactly matches the one on your device') Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 41000ms - waiting for locator('text=Verify that the shared address exactly matches the one on your device') 54 | } 55 | await app.modal.continue(); > 56 | await app.receive.expectValidReceiveAddress(account.address); | ^ 57 | 58 | await app.speculos.expectValidReceiveAddress(account); 59 | await app.receive.expectApproveLabel(); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts:56:27

Expand All @@ -49,3 +61,31 @@ for (const account of accounts) {
);
});
}

test.describe("Receive", () => {
const account = Account.TRX_2;
test.use({
userdata: "speculos-tests-app",
speculosApp: account.currency.speculosApp,
});
test(
`${account.currency.ticker} empty balance Receive displays address activation warning message`,
{
annotation: {
type: "TMS",
description: "B2CQA-1551",
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));

await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(account.accountName);
await app.account.expectAccountVisibility(account.accountName);

await app.account.clickReceive();
await app.modal.continue();
await app.receive.verifyTronAddressActivationWarningMessage();

Check failure on line 88 in apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts

View workflow job for this annotation

GitHub Actions / Desktop Tests E2E (Ubuntu) (2, 3)

[speculos_tests] › specs/speculos/receive.address.spec.ts:71:7 › Receive › TRX empty balance Receive displays address activation warning message

3) [speculos_tests] › specs/speculos/receive.address.spec.ts:71:7 › Receive › TRX empty balance Receive displays address activation warning message › Verify TRON address activation warning message Error: Timed out 41000ms waiting for expect(locator).toBeVisible() Locator: locator('div[type="warning"]') Expected: visible Received: <element(s) not found> Call log: - expect.toBeVisible with timeout 41000ms - waiting for locator('div[type="warning"]') 86 | await app.account.clickReceive(); 87 | await app.modal.continue(); > 88 | await app.receive.verifyTronAddressActivationWarningMessage(); | ^ 89 | }, 90 | ); 91 | }); at /home/runner/_work/ledger-live/ledger-live/apps/ledger-live-desktop/tests/specs/speculos/receive.address.spec.ts:88:25
},
);
});
Loading

0 comments on commit e846d61

Please sign in to comment.