From f1c1068a0e409dc7acbb46b41d45ece4ad99f085 Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Thu, 7 Mar 2024 16:12:19 +0500 Subject: [PATCH] chore: addressing PR comments --- commands/keplr.js | 18 +++--------------- tests/e2e/specs/keplr/keplr-spec.js | 7 ++----- 2 files changed, 5 insertions(+), 20 deletions(-) diff --git a/commands/keplr.js b/commands/keplr.js index b950a3249..0121b0c6f 100644 --- a/commands/keplr.js +++ b/commands/keplr.js @@ -360,22 +360,10 @@ const keplr = { const innerTexts = await parentElement.allInnerTexts(); const textArray = innerTexts[0].split('\n'); - let numberString; - for (const element of textArray) { - const elementWithNoCommas = element.replace(/,/g, ''); - if (!isNaN(parseFloat(elementWithNoCommas))) { - numberString = elementWithNoCommas; - break; - } - } - - if (!numberString) { - throw new Error(`Token value for ${tokenName} not found`); - } - - let tokenValue = parseFloat(numberString); + const tokenValue = textArray[3]; + const parsedTokenValue = Number(tokenValue.replace(/,/g, '')); await playwright.switchToCypressWindow(); - return tokenValue; + return parsedTokenValue; }, }; diff --git a/tests/e2e/specs/keplr/keplr-spec.js b/tests/e2e/specs/keplr/keplr-spec.js index 16f77cb45..f419e53fd 100644 --- a/tests/e2e/specs/keplr/keplr-spec.js +++ b/tests/e2e/specs/keplr/keplr-spec.js @@ -97,13 +97,10 @@ describe('Keplr', () => { }); cy.addNewTokensFound(); cy.getTokenAmount('ATOM').then(tokenValue => { - expect(Number.isFinite(tokenValue)).to.be.true; + expect(tokenValue).to.equal(0); }); cy.getTokenAmount('BLD').then(tokenValue => { - expect(Number.isFinite(tokenValue)).to.be.true; - }); - cy.getTokenAmount('IST').then(tokenValue => { - expect(Number.isFinite(tokenValue)).to.be.true; + expect(tokenValue).to.equal(331); }); }); it(`should disconnect the wallet from all the connected DAPPs`, () => {