-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d2cf10
commit e6f5697
Showing
34 changed files
with
309 additions
and
20 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { Currency } from "@ledgerhq/live-common/e2e/enum/Currency"; | ||
import { Application } from "../page"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
|
||
export async function verifyAppValidationSendInfo( | ||
app: Application, | ||
transaction: Transaction, | ||
amount: string, | ||
) { | ||
const currenciesForValidationAmount = [ | ||
Currency.sepETH, | ||
Currency.DOT, | ||
Currency.POL, | ||
Currency.ALGO, | ||
Currency.ADA, | ||
Currency.DOGE, | ||
Currency.SOL, | ||
Currency.TRX, | ||
Currency.XLM, | ||
Currency.XRP, | ||
Currency.ATOM, | ||
Currency.BCH, | ||
]; | ||
|
||
const currenciesForValidationRecipient = [Currency.sepETH, Currency.POL]; | ||
const currenciesForValidationSender = [Currency.ATOM]; | ||
|
||
const currency = transaction.accountToCredit.currency; | ||
const addressRecipient = transaction.accountToCredit.address; | ||
const addressSender = transaction.accountToDebit.address; | ||
|
||
if (currenciesForValidationAmount.includes(currency)) { | ||
await app.send.expectValidationAmount(amount); | ||
} | ||
|
||
if (currenciesForValidationRecipient.includes(currency)) { | ||
await app.send.expectValidationAddress(addressRecipient); | ||
} | ||
|
||
if (currenciesForValidationSender.includes(currency)) { | ||
await app.send.expectValidationAddress(addressSender); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,14 @@ | ||
import { expectValidAddressDevice } from "@ledgerhq/live-common/e2e/speculos"; | ||
import { expectValidAddressDevice, signSendTransaction } from "@ledgerhq/live-common/e2e/speculos"; | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
|
||
export default class SpeculosPage { | ||
@Step("Verify receive address correctness on device") | ||
async expectValidAddressDevice(account: Account, addressDisplayed: string) { | ||
await expectValidAddressDevice(account, addressDisplayed); | ||
} | ||
|
||
async signSendTransaction(tx: Transaction) { | ||
await signSendTransaction(tx); | ||
} | ||
} |
15 changes: 13 additions & 2 deletions
15
apps/ledger-live-mobile/e2e/page/trade/operationDetails.page.ts
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 |
---|---|---|
@@ -1,20 +1,31 @@ | ||
import { getElementById } from "../../helpers"; | ||
import { getElementById, scrollToId, waitForElementById } from "../../helpers"; | ||
import { expect } from "detox"; | ||
|
||
export default class OperationDetailsPage { | ||
title = () => getElementById("operationDetails-title"); | ||
titleId = "operationDetails-title"; | ||
title = () => getElementById(this.titleId); | ||
account = () => getElementById("operationDetails-account"); | ||
amount = () => getElementById("operationDetails-amount"); | ||
recipientId = "operationDetails-recipient0"; | ||
|
||
async isOpened() { | ||
await expect(this.title()).toBeVisible(); | ||
} | ||
|
||
async waitForOperationDetails() { | ||
await waitForElementById(this.titleId); | ||
} | ||
|
||
async checkAccount(account: string) { | ||
await expect(this.account()).toHaveText(account); | ||
} | ||
|
||
async checkAmount(amount: string) { | ||
await expect(this.amount()).toHaveText(amount); | ||
} | ||
|
||
async checkRecipient(recipient: string) { | ||
await scrollToId(this.recipientId); | ||
await expect(getElementById(this.recipientId)).toHaveText(recipient); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import { verifyAppValidationSendInfo } from "../../../models/send"; | ||
import { Application } from "../../../page"; | ||
import { CLI } from "../../../utils/cliUtils"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { device } from "detox"; | ||
|
||
export async function runSendTest(transaction: Transaction, tmsLink: string) { | ||
const app = new Application(); | ||
|
||
$TmsLink(tmsLink); | ||
describe(`Send flow on ${transaction.accountToCredit.currency.name}`, () => { | ||
beforeAll(async () => { | ||
await app.init({ | ||
speculosApp: transaction.accountToCredit.currency.speculosApp, | ||
cliCommands: [ | ||
() => { | ||
return CLI.liveData({ | ||
currency: transaction.accountToCredit.currency.currencyId, | ||
index: transaction.accountToCredit.index, | ||
add: true, | ||
appjson: app.userdataPath, | ||
}); | ||
}, | ||
() => { | ||
return CLI.liveData({ | ||
currency: transaction.accountToDebit.currency.currencyId, | ||
index: transaction.accountToDebit.index, | ||
add: true, | ||
appjson: app.userdataPath, | ||
}); | ||
}, | ||
], | ||
}); | ||
|
||
await app.portfolio.waitForPortfolioPageToLoad(); | ||
}); | ||
|
||
it(`Send from 1 account to another on ${transaction.accountToCredit.currency.name}`, async () => { | ||
await app.accounts.openViaDeeplink(); | ||
await app.common.goToAccountByName(transaction.accountToDebit.accountName); | ||
await app.account.tapSend(); | ||
|
||
const amountWithCode = transaction.amount + " " + transaction.accountToCredit.currency.ticker; | ||
|
||
await app.send.setRecipientAndContinue(transaction.accountToCredit.address); | ||
await app.send.setAmountAndContinue(transaction.amount); | ||
|
||
await app.send.expectSummaryAmount(amountWithCode); | ||
await app.send.expectSummaryRecepient(transaction.accountToCredit.address); | ||
await app.send.summaryContinue(); | ||
await app.send.dismissHighFeeModal(); | ||
|
||
await verifyAppValidationSendInfo(app, transaction, amountWithCode); | ||
|
||
await app.speculos.signSendTransaction(transaction); | ||
|
||
await device.disableSynchronization(); | ||
await app.common.successViewDetails(); | ||
|
||
await app.operationDetails.waitForOperationDetails(); | ||
await app.operationDetails.checkAccount(transaction.accountToDebit.accountName); | ||
await app.operationDetails.checkRecipient(transaction.accountToCredit.address); | ||
}); | ||
}); | ||
} |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendADA.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.ADA_1, Account.ADA_2, "1"); | ||
runSendTest(transaction, "B2CQA-2815"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendALGO.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.ALGO_1, Account.ALGO_2, "0.001"); | ||
runSendTest(transaction, "B2CQA-2810"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendATOM.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.ATOM_1, Account.ATOM_2, "0.0001"); | ||
runSendTest(transaction, "B2CQA-2814"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendBCH.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.BCH_1, Account.BCH_2, "0.0001"); | ||
runSendTest(transaction, "B2CQA-2808"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendDOGE.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.DOGE_1, Account.DOGE_2, "0.01"); | ||
runSendTest(transaction, "B2CQA-2573"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendDOT.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.DOT_1, Account.DOT_2, "0.0001"); | ||
runSendTest(transaction, "B2CQA-2809"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendPOL.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.POL_1, Account.POL_2, "0.001"); | ||
runSendTest(transaction, "B2CQA-2807"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendSOL.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.SOL_1, Account.SOL_2, "0.000001"); | ||
runSendTest(transaction, "B2CQA-2811"); |
6 changes: 6 additions & 0 deletions
6
apps/ledger-live-mobile/e2e/specs/speculos/send/sendSepETH.spec.ts
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,6 @@ | ||
import { Account } from "@ledgerhq/live-common/e2e/enum/Account"; | ||
import { Transaction } from "@ledgerhq/live-common/e2e/models/Transaction"; | ||
import { runSendTest } from "../send/send"; | ||
|
||
const transaction = new Transaction(Account.sep_ETH_1, Account.sep_ETH_2, "0.00001"); | ||
runSendTest(transaction, "B2CQA-2574"); |
Oops, something went wrong.