Skip to content

Commit

Permalink
Merge pull request #7845 from LedgerHQ/support/qaa164
Browse files Browse the repository at this point in the history
Link 1 test case to 1 test id (Speculos x Xray)
  • Loading branch information
VicAlbr authored Sep 24, 2024
2 parents 14dac72 + 7122715 commit 2acceb5
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 114 deletions.
44 changes: 23 additions & 21 deletions apps/ledger-live-desktop/tests/specs/speculos/add.account.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,52 +3,54 @@ import { Currency } from "../../enum/Currency";
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";

const currencies: Currency[] = [
Currency.BTC,
Currency.ETH,
Currency.ETC,
Currency.XRP,
//todo: Reactivate after DOT API issue is resolved - TSD-3603
//Currency.DOT,
Currency.TRX,
Currency.ADA,
Currency.XLM,
Currency.BCH,
Currency.ALGO,
Currency.ATOM,
Currency.XTZ,
Currency.SOL,
Currency.TON,
const currencies = [
{
currency: Currency.BTC,
xrayTicket: "B2CQA-2499, B2CQA-2644, B2CQA-2658, B2CQA-2672, B2CQA-929, B2CQA-786",
},
{ currency: Currency.ETH, xrayTicket: "B2CQA-2503, B2CQA-2645, B2CQA-2659, B2CQA-2673" },
{ currency: Currency.ETC, xrayTicket: "B2CQA-2502, B2CQA-2646, B2CQA-2660, B2CQA-2674" },
{ currency: Currency.XRP, xrayTicket: "B2CQA-2505, B2CQA-2647, B2CQA-2661, B2CQA-2675" },
{ currency: Currency.DOT, xrayTicket: "B2CQA-2504, B2CQA-2648, B2CQA-2662, B2CQA-2676" },
{ currency: Currency.TRX, xrayTicket: "B2CQA-2508, B2CQA-2649, B2CQA-2663, B2CQA-2677" },
{ currency: Currency.ADA, xrayTicket: "B2CQA-2500, B2CQA-2650, B2CQA-2664, B2CQA-2678" },
{ currency: Currency.XLM, xrayTicket: "B2CQA-2506, B2CQA-2651, B2CQA-2665, B2CQA-2679" },
{ currency: Currency.BCH, xrayTicket: "B2CQA-2498, B2CQA-2652, B2CQA-2666, B2CQA-2680" },
{ currency: Currency.ALGO, xrayTicket: "B2CQA-2497, B2CQA-2653, B2CQA-2667, B2CQA-2681" },
{ currency: Currency.ATOM, xrayTicket: "B2CQA-2501, B2CQA-2654, B2CQA-2668, B2CQA-2682" },
{ currency: Currency.XTZ, xrayTicket: "B2CQA-2507, B2CQA-2655, B2CQA-2669, B2CQA-2683" },
{ currency: Currency.SOL, xrayTicket: "B2CQA-2642, B2CQA-2656, B2CQA-2670, B2CQA-2684" },
{ currency: Currency.TON, xrayTicket: "B2CQA-2643, B2CQA-2657, B2CQA-2671, B2CQA-2685" },
];

for (const currency of currencies) {
test.describe("Add Accounts", () => {
test.use({
userdata: "skip-onboarding",
speculosApp: currency.speculosApp,
speculosApp: currency.currency.speculosApp,
});
let firstAccountName = "NO ACCOUNT NAME YET";

test(
`[${currency.name}] Add account`,
`[${currency.currency.name}] Add account`,
{
annotation: {
type: "TMS",
description: "B2CQA-101, B2CQA-102, B2CQA-314, B2CQA-330, B2CQA-929, B2CQA-786",
description: currency.xrayTicket,
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));

await app.portfolio.openAddAccountModal();
await app.addAccount.expectModalVisiblity();
await app.addAccount.selectCurrency(currency);
await app.addAccount.selectCurrency(currency.currency);
firstAccountName = await app.addAccount.getFirstAccountName();

await app.addAccount.addAccounts();
await app.addAccount.done();
// Todo: Remove 'if' when CounterValue is fixed for $TON - LIVE-13685
if (currency.name !== Currency.TON.name) {
if (currency.currency.name !== Currency.TON.name) {
await app.layout.expectBalanceVisibility();
}
await app.layout.goToAccounts();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,45 @@ import { Account } from "../../enum/Account";
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";

const accounts: Account[] = [
Account.BTC_1,
Account.ETH_1,
Account.SOL_1,
Account.TRX_1,
Account.DOT_1,
Account.XRP_1,
Account.ADA_1,
Account.ALGO_1,
Account.XLM_1,
Account.BCH_1,
Account.ATOM_1,
Account.XTZ_1,
const accounts = [
{ account: Account.BTC_1, xrayTicket: "B2CQA-2548" },
{ account: Account.ETH_1, xrayTicket: "B2CQA-2551" },
{ account: Account.SOL_1, xrayTicket: "B2CQA-2553" },
{ account: Account.XRP_1, xrayTicket: "B2CQA-2557" },
{ account: Account.ADA_1, xrayTicket: "B2CQA-2549" },
{ account: Account.DOT_1, xrayTicket: "B2CQA-2552" },
{ account: Account.TRX_1, xrayTicket: "B2CQA-2556" },
{ account: Account.XLM_1, xrayTicket: "B2CQA-2554" },
{ account: Account.BCH_1, xrayTicket: "B2CQA-2547" },
{ account: Account.ALGO_1, xrayTicket: "B2CQA-2546" },
{ account: Account.ATOM_1, xrayTicket: "B2CQA-2550" },
{ account: Account.XTZ_1, xrayTicket: "B2CQA-2555" },
];

for (const account of accounts) {
test.describe("Delete Accounts", () => {
test.use({
userdata: "speculos-tests-app",
speculosApp: account.currency.speculosApp,
speculosApp: account.account.currency.speculosApp,
});

test(
`[${account.currency.name}] Delete Account`,
`[${account.account.currency.name}] Delete Account`,
{
annotation: {
type: "TMS",
description: "B2CQA-320",
description: account.xrayTicket,
},
},
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.accounts.navigateToAccountByName(account.account.accountName);
await app.account.expectAccountVisibility(account.account.accountName);

await app.account.deleteAccount();
await app.accounts.expectAccountAbsence(account.accountName);
await app.accounts.expectAccountAbsence(account.account.accountName);
},
);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@ import { Account } from "../../enum/Account";
import { addTmsLink } from "tests/utils/allureUtils";
import { getDescription } from "../../utils/customJsonReporter";

const accounts: Account[] = [
// Derivation path is updated when account receive money
Account.BTC_1,
Account.ETH_1,
Account.SOL_1,
Account.TRX_1,
Account.DOT_1,
Account.XRP_1,
Account.BCH_1,
Account.ATOM_1,
Account.XTZ_1,
Account.BSC_1,
const accounts = [
{ account: Account.BTC_1, xrayTicket: "B2CQA-2559, B2CQA-2687" },
{ account: Account.ETH_1, xrayTicket: "B2CQA-2561, B2CQA-2688, B2CQA-2697" },
{ account: Account.SOL_1, xrayTicket: "B2CQA-2563, B2CQA-2689" },
{ account: Account.TRX_1, xrayTicket: "B2CQA-2565, B2CQA-2690, B2CQA-2699" },
{ account: Account.DOT_1, xrayTicket: "B2CQA-2562, B2CQA-2691" },
{ account: Account.XRP_1, xrayTicket: "B2CQA-2566, B2CQA-2692" },
{ account: Account.BCH_1, xrayTicket: "B2CQA-2558, B2CQA-2693" },
{ account: Account.ATOM_1, xrayTicket: "B2CQA-2560, B2CQA-2694" },
{ account: Account.XTZ_1, xrayTicket: "B2CQA-2564, B2CQA-2695" },
{ account: Account.BSC_1, xrayTicket: "B2CQA-2686, B2CQA-2696, B2CQA-2698" },
];

//Warning 🚨: Test may fail due to the GetAppAndVersion issue - Jira: LIVE-12581
for (const account of accounts) {
test.describe("Receive", () => {
test.use({
userdata: "speculos-tests-app",
speculosApp: account.currency.speculosApp,
speculosApp: account.account.currency.speculosApp,
});

test(
`[${account.currency.name}] Receive`,
`[${account.account.currency.name}] Receive`,
{
annotation: {
type: "TMS",
Expand All @@ -37,24 +36,27 @@ for (const account of accounts) {
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.accounts.navigateToAccountByName(account.account.accountName);
await app.account.expectAccountVisibility(account.account.accountName);
await app.account.clickReceive();
switch (account) {
switch (account.account) {
case Account.TRX_1:
await app.receive.verifySendCurrencyTokensWarningMessage(account, "TRC10/TRC20");
await app.receive.verifySendCurrencyTokensWarningMessage(
account.account,
"TRC10/TRC20",
);
break;
case Account.ETH_1:
await app.receive.verifySendCurrencyTokensWarningMessage(account, "Ethereum");
await app.receive.verifySendCurrencyTokensWarningMessage(account.account, "Ethereum");
break;
case Account.BSC_1:
await app.receive.verifySendCurrencyTokensWarningMessage(account, "BEP20");
await app.receive.verifySendCurrencyTokensWarningMessage(account.account, "BEP20");
break;
}
await app.modal.continue();
await app.receive.expectValidReceiveAddress(account.address);
await app.receive.expectValidReceiveAddress(account.account.address);

await app.speculos.expectValidReceiveAddress(account);
await app.speculos.expectValidReceiveAddress(account.account);
await app.receive.expectApproveLabel();
},
);
Expand Down
50 changes: 34 additions & 16 deletions apps/ledger-live-desktop/tests/specs/speculos/send.tx.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,44 @@ const transactionsInputsInvalid = [
{
transaction: new Transaction(Account.ETH_1, Account.ETH_2, "", Fee.MEDIUM),
expectedErrorMessage: null,
xrayTicket: "B2CQA-2568",
},
{
transaction: new Transaction(Account.ETH_1, Account.ETH_2, "0", Fee.MEDIUM),
expectedErrorMessage: null,
xrayTicket: "B2CQA-2569",
},
{
transaction: new Transaction(Account.XRP_1, Account.XRP_2, "1", Fee.MEDIUM),
expectedErrorMessage: "Recipient address is inactive. Send at least 10 XRP to activate it",
xrayTicket: "B2CQA-2571",
},
{
transaction: new Transaction(Account.DOT_1, Account.DOT_2, "1.2", Fee.MEDIUM),
expectedErrorMessage: "Balance cannot be below 1 DOT. Send max to empty account.",
xrayTicket: "B2CQA-2567",
},
{
transaction: new Transaction(Account.DOT_1, Account.DOT_3, "0.5", Fee.MEDIUM),
expectedErrorMessage: "Recipient address is inactive. Send at least 1 DOT to activate it",
xrayTicket: "B2CQA-2570",
},
{
transaction: new Transaction(Account.ETH_1, Account.ETH_2, "100", Fee.MEDIUM),
expectedErrorMessage: "Sorry, insufficient funds",
xrayTicket: "B2CQA-2572",
},
];

const transactionE2E = [
new Transaction(Account.sep_ETH_1, Account.sep_ETH_2, "0.00001", Fee.SLOW),
new Transaction(Account.DOGE_1, Account.DOGE_2, "0.01", Fee.SLOW),
{
transaction: new Transaction(Account.sep_ETH_1, Account.sep_ETH_2, "0.00001", Fee.SLOW),
xrayTicket: "B2CQA-2574",
},
{
transaction: new Transaction(Account.DOGE_1, Account.DOGE_2, "0.01", Fee.SLOW),
xrayTicket: "B2CQA-2573",
},
];

//Warning 🚨: Test may fail due to the GetAppAndVersion issue - Jira: LIVE-12581 or insufficient funds
Expand All @@ -43,39 +55,43 @@ for (const transaction of transactionE2E) {
test.describe("Send from 1 account to another", () => {
test.use({
userdata: "speculos-tests-app",
speculosApp: transaction.accountToDebit.currency.speculosApp,
speculosApp: transaction.transaction.accountToDebit.currency.speculosApp,
});

test(
`Send from ${transaction.accountToDebit.accountName} to ${transaction.accountToCredit.accountName}`,
`Send from ${transaction.transaction.accountToDebit.accountName} to ${transaction.transaction.accountToCredit.accountName}`,
{
annotation: {
type: "TMS",
description: "B2CQA-473",
description: transaction.xrayTicket,
},
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations).split(", "));

await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(transaction.accountToDebit.accountName);
await app.accounts.navigateToAccountByName(
transaction.transaction.accountToDebit.accountName,
);

await app.account.clickSend();
await app.send.fillTxInfo(transaction);
await app.send.expectTxInfoValidity(transaction);
await app.send.fillTxInfo(transaction.transaction);
await app.send.expectTxInfoValidity(transaction.transaction);
await app.send.clickContinueToDevice();

await app.speculos.expectValidTxInfo(transaction);
await app.speculos.expectValidTxInfo(transaction.transaction);
await app.send.expectTxSent();
await app.account.navigateToViewDetails();
await app.drawer.addressValueIsVisible(transaction.accountToCredit.address);
await app.drawer.addressValueIsVisible(transaction.transaction.accountToCredit.address);
await app.drawer.close();

await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(transaction.accountToCredit.accountName);
await app.accounts.navigateToAccountByName(
transaction.transaction.accountToCredit.accountName,
);
await app.layout.syncAccounts();
await app.account.clickOnLastOperation();
await app.drawer.expectReceiverInfos(transaction);
await app.drawer.expectReceiverInfos(transaction.transaction);
},
);
});
Expand All @@ -97,7 +113,7 @@ test.describe("Send token (subAccount) - invalid address input", () => {
{
annotation: {
type: "TMS",
description: "B2CQA-479",
description: "B2CQA-2702",
},
},
async ({ app }) => {
Expand All @@ -123,12 +139,14 @@ test.describe("Send token (subAccount) - invalid amount input", () => {
expectedWarningMessage: new RegExp(
/You need \d+\.\d+ BNB in your account to pay for transaction fees on the Binance Smart Chain network\. .*/,
),
xrayTicket: "B2CQA-2700",
},
{
transaction: new Transaction(Account.ETH_USDT_2, Account.ETH_USDT_1, "1", Fee.MEDIUM),
expectedWarningMessage: new RegExp(
/You need \d+\.\d+ ETH in your account to pay for transaction fees on the Ethereum network\. .*/,
),
xrayTicket: "B2CQA-2701",
},
];
for (const transaction of tokenTransactionInvalid) {
Expand All @@ -141,7 +159,7 @@ test.describe("Send token (subAccount) - invalid amount input", () => {
{
annotation: {
type: "TMS",
description: "B2CQA-475",
description: transaction.xrayTicket,
},
},
async ({ app }) => {
Expand Down Expand Up @@ -178,7 +196,7 @@ test.describe("Send token (subAccount) - valid address & amount input", () => {
{
annotation: {
type: "TMS",
description: "B2CQA-479, B2CQA-475",
description: "B2CQA-2703, B2CQA-475",
},
},
async ({ app }) => {
Expand Down Expand Up @@ -242,7 +260,7 @@ for (const transaction of transactionsInputsInvalid) {
{
annotation: {
type: "TMS",
description: "B2CQA-473",
description: transaction.xrayTicket,
},
},
async ({ app }) => {
Expand Down
Loading

0 comments on commit 2acceb5

Please sign in to comment.