-
Notifications
You must be signed in to change notification settings - Fork 327
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: ✅ Adding new currencies for e2e send testing
- Loading branch information
Showing
17 changed files
with
345 additions
and
76 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,20 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendAlgorand(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.CAPS_APPROVE); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
|
||
//Todo: Ractivate after QAA-319 | ||
//const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
//expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,36 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Currency } from "tests/enum/Currency"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
waitFor, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendBTCBasedCoin(tx: Transaction) { | ||
let deviceLabel: string; | ||
|
||
switch (tx.accountToDebit.currency) { | ||
case Currency.BTC: | ||
deviceLabel = DeviceLabels.CONTINUE; | ||
break; | ||
case Currency.DOGE: | ||
case Currency.BCH: | ||
deviceLabel = DeviceLabels.ACCEPT; | ||
break; | ||
default: | ||
throw new Error(`Not a BTC-based coin: ${tx.accountToDebit.currency}`); | ||
} | ||
|
||
const events = await pressUntilTextFound(deviceLabel); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
await pressBoth(); | ||
await waitFor(DeviceLabels.CONFIRM); | ||
await pressUntilTextFound(DeviceLabels.ACCEPT); | ||
await pressBoth(); | ||
} |
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,28 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
waitFor, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendCardano(tx: Transaction) { | ||
await waitFor(DeviceLabels.NEW_ORDINARY_TRANSACTION); | ||
await pressBoth(); | ||
await pressUntilTextFound(DeviceLabels.SEND_TO_ADDRESS_2); | ||
await pressBoth(); | ||
const events = await pressUntilTextFound(DeviceLabels.SEND); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
await pressBoth(); | ||
await waitFor(DeviceLabels.TRANSACTION_FEE); | ||
await pressBoth(); | ||
await waitFor(DeviceLabels.CONFIRM_TRANSACTION); | ||
await pressBoth(); | ||
|
||
//Todo: Ractivate after QAA-319 | ||
//const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
//expect(isAddressCorrect).toBeTruthy(); | ||
} |
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,28 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Delegate } from "tests/models/Delegate"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
waitFor, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function delegateCosmos(delegatingAccount: Delegate) { | ||
await waitFor(DeviceLabels.PLEASE_REVIEW); | ||
const events = await pressUntilTextFound(DeviceLabels.CAPS_APPROVE); | ||
const isAmountCorrect = containsSubstringInEvent(delegatingAccount.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
await pressBoth(); | ||
} | ||
|
||
export async function sendCosmos(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.CAPS_APPROVE); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,18 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendEVM(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.ACCEPT); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,20 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Delegate } from "tests/models/Delegate"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
waitFor, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function delegateNear(delegatingAccount: Delegate) { | ||
await waitFor(DeviceLabels.VIEW_HEADER); | ||
const events = await pressUntilTextFound(DeviceLabels.CONTINUE_TO_ACTION); | ||
const isProviderCorrect = containsSubstringInEvent(delegatingAccount.provider, events); | ||
expect(isProviderCorrect).toBeTruthy(); | ||
await pressBoth(); | ||
await waitFor(DeviceLabels.VIEW_ACTION); | ||
await pressUntilTextFound(DeviceLabels.SIGN); | ||
await pressBoth(); | ||
} |
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,18 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendPolkadot(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.CAPS_APPROVE); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,25 @@ | ||
import { expect } from "@playwright/test"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
waitFor, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
|
||
export async function delegateSolana() { | ||
await waitFor(DeviceLabels.DELEGATE_FROM); | ||
await pressUntilTextFound(DeviceLabels.APPROVE); | ||
await pressBoth(); | ||
} | ||
|
||
export async function sendSolana(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.APPROVE); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,20 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendStellar(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.SIGN); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
|
||
//Todo: Ractivate after QAA-319 | ||
//const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
//expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,18 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendTron(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.SIGN); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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,18 @@ | ||
import { expect } from "@playwright/test"; | ||
import { Transaction } from "tests/models/Transaction"; | ||
import { | ||
pressBoth, | ||
pressUntilTextFound, | ||
containsSubstringInEvent, | ||
} from "@ledgerhq/live-common/e2e/speculos"; | ||
import { DeviceLabels } from "tests/enum/DeviceLabels"; | ||
|
||
export async function sendXRP(tx: Transaction) { | ||
const events = await pressUntilTextFound(DeviceLabels.SIGN); | ||
const isAmountCorrect = containsSubstringInEvent(tx.amount, events); | ||
expect(isAmountCorrect).toBeTruthy(); | ||
const isAddressCorrect = containsSubstringInEvent(tx.accountToCredit.address, events); | ||
expect(isAddressCorrect).toBeTruthy(); | ||
|
||
await pressBoth(); | ||
} |
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
Oops, something went wrong.