From 62eb7c66ceb1b9623c47e42c0387ef6d2af9efb2 Mon Sep 17 00:00:00 2001 From: hzheng-ledger Date: Tue, 29 Aug 2023 09:37:29 +0200 Subject: [PATCH] fix: cosmos bot tests --- libs/coin-framework/src/bot/types.ts | 2 ++ libs/ledger-live-common/src/bot/engine.ts | 6 ++++++ libs/ledger-live-common/src/families/cosmos/specs.ts | 3 +++ 3 files changed, 11 insertions(+) diff --git a/libs/coin-framework/src/bot/types.ts b/libs/coin-framework/src/bot/types.ts index 65eb6654ae39..6c3f9a2a0850 100644 --- a/libs/coin-framework/src/bot/types.ts +++ b/libs/coin-framework/src/bot/types.ts @@ -144,6 +144,8 @@ export type AppSpec = { skipMutationsTimeout?: number; // do not expect an account to always be found (Hedera case) allowEmptyAccounts?: boolean; + // do not keep operations in accounts (Cosmos family case) + skipOperationHistory?: boolean; }; export type SpecReport = { spec: AppSpec; diff --git a/libs/ledger-live-common/src/bot/engine.ts b/libs/ledger-live-common/src/bot/engine.ts index 242f324a49c4..9d2614ccbdd3 100644 --- a/libs/ledger-live-common/src/bot/engine.ts +++ b/libs/ledger-live-common/src/bot/engine.ts @@ -603,6 +603,9 @@ export async function runOnAccount({ const testBefore = now(); const timeOut = mutation.testTimeout || spec.testTimeout || 5 * 60 * 1000; const step = account => { + if (spec.skipOperationHistory) { + return optimisticOperation; + } const timedOut = now() - testBefore > timeOut; const operation = account.operations.find(o => o.id === optimisticOperation.id); @@ -663,6 +666,9 @@ export async function runOnAccount({ log("bot", "remaining time to test destination: " + (newTimeOut / 1000).toFixed(0) + "s"); const sendingOperation = operation; const step = account => { + if (spec.skipOperationHistory) { + return sendingOperation; + } const timedOut = now() - ntestBefore > newTimeOut; let operation; try { diff --git a/libs/ledger-live-common/src/families/cosmos/specs.ts b/libs/ledger-live-common/src/families/cosmos/specs.ts index 80ee08295085..99d1b2d25e22 100644 --- a/libs/ledger-live-common/src/families/cosmos/specs.ts +++ b/libs/ledger-live-common/src/families/cosmos/specs.ts @@ -444,12 +444,14 @@ const osmosis = { const desmos = { ...generateGenericCosmosTest("desmos", { testTimeout: 8 * 60 * 1000, + skipOperationHistory: true, }), }; const umee = { ...generateGenericCosmosTest("umee", { testTimeout: 8 * 60 * 1000, + skipOperationHistory: true, }), }; @@ -462,6 +464,7 @@ const persistence = { const quicksilver = { ...generateGenericCosmosTest("quicksilver", { testTimeout: 8 * 60 * 1000, + skipOperationHistory: true, }), };