Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating method to get the last appVersion - Speculos e2e #8752

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -277,7 +277,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
Loading