Skip to content

Commit

Permalink
Merge pull request #8752 from LedgerHQ/support/QAA-368
Browse files Browse the repository at this point in the history
Updating method to get the last appVersion - Speculos e2e
  • Loading branch information
VicAlbr authored Dec 23, 2024
2 parents fb74461 + aa9819d commit e5c957b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .changeset/pink-bats-attack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"ledger-live-desktop": minor
"@ledgerhq/live-common": minor
---

Updating method to get Speculos app - e2e testing
15 changes: 11 additions & 4 deletions apps/ledger-live-desktop/tests/specs/speculos/delegate.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const e2eDelegationAccounts = [
{
delegate: new Delegate(Account.ATOM_1, "0.001", "Ledger"),
xrayTicket: "B2CQA-2740, B2CQA-2770",
bugLing: "LIVE-14501",
bugTicket: "LIVE-14501",
},
{
delegate: new Delegate(Account.SOL_1, "0.001", "Ledger by Figment"),
Expand Down Expand Up @@ -38,6 +38,7 @@ const validators = [
{
delegate: new Delegate(Account.ADA_1, "0.01", "LBF3 - Ledger by Figment 3"),
xrayTicket: "B2CQA-2766",
bugTicket: "LIVE-15536",
},
{
delegate: new Delegate(Account.MULTIVERS_X_1, "1", "Ledger by Figment"),
Expand Down Expand Up @@ -72,12 +73,12 @@ test.describe("Delegate flows", () => {
{
annotation: [
{ type: "TMS", description: account.xrayTicket },
{ type: "BUG", description: account.bugLing },
{ type: "BUG", description: account.bugTicket },
],
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations, "TMS").split(", "));
if (account.bugLing) {
if (account.bugTicket) {
await addBugLink(getDescription(test.info().annotations, "BUG").split(", "));
}

Expand Down Expand Up @@ -133,10 +134,16 @@ test.describe("Delegate flows", () => {
test(
`[${validator.delegate.account.currency.name}] - Select validator`,
{
annotation: { type: "TMS", description: validator.xrayTicket },
annotation: [
{ type: "TMS", description: validator.xrayTicket },
{ type: "BUG", description: validator.bugTicket },
],
},
async ({ app }) => {
await addTmsLink(getDescription(test.info().annotations, "TMS").split(", "));
if (validator.bugTicket) {
await addBugLink(getDescription(test.info().annotations, "BUG").split(", "));
}

await app.layout.goToAccounts();
await app.accounts.navigateToAccountByName(validator.delegate.account.accountName);
Expand Down
6 changes: 5 additions & 1 deletion libs/ledger-live-common/src/e2e/speculos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,11 @@ export async function startSpeculos(
const { model } = appQuery;
const { dependencies } = spec;
const newAppQuery = dependencies?.map(dep => {
return findLatestAppCandidate(appCandidates, { model, appName: dep.name });
return findLatestAppCandidate(appCandidates, {
model,
appName: dep.name,
firmware: appCandidate?.firmware,
});
});
const appVersionMap = new Map(newAppQuery?.map(app => [app?.appName, app?.appVersion]));
dependencies?.forEach(dependency => {
Expand Down
3 changes: 1 addition & 2 deletions libs/ledger-live-common/src/load/speculos.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,7 @@ export const findLatestAppCandidate = (
if (apps.length === 0) {
return null;
}

apps = apps.sort((a, b) => semver.rcompare(a.appVersion, b.appVersion));
apps = apps.sort((a, b) => semver.compare(b.appVersion, a.appVersion));
return apps[0];
};

Expand Down

0 comments on commit e5c957b

Please sign in to comment.