From 96b238b48d35fd07347b672a11ba50f27b2040af Mon Sep 17 00:00:00 2001 From: frazarshad Date: Wed, 13 Mar 2024 17:52:47 +0500 Subject: [PATCH] Fix for switching between keplr windows with same url (#27) * fix: checking added for window instance * test: test added for edge case --- commands/playwright-keplr.js | 3 ++- tests/e2e/specs/keplr/keplr-spec.js | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/commands/playwright-keplr.js b/commands/playwright-keplr.js index 2c2f42fcb..45b8e5e5f 100644 --- a/commands/playwright-keplr.js +++ b/commands/playwright-keplr.js @@ -340,7 +340,8 @@ module.exports = { if ( page .url() - .includes(`chrome-extension://${keplrExtensionData.id}/popup.html`) + .includes(`chrome-extension://${keplrExtensionData.id}/popup.html`) && + page !== keplrWindow ) { keplrNotificationWindow = page; retries = 0; diff --git a/tests/e2e/specs/keplr/keplr-spec.js b/tests/e2e/specs/keplr/keplr-spec.js index a2f9b1791..927c2d128 100644 --- a/tests/e2e/specs/keplr/keplr-spec.js +++ b/tests/e2e/specs/keplr/keplr-spec.js @@ -103,6 +103,16 @@ describe('Keplr', () => { expect(tokenValue).to.equal(331); }); }); + it(`should differntiate between keplrWindow and keplrNotificationWindow when they have the same URL`, () => { + cy.getTokenAmount('ATOM').then(tokenValue => { + expect(tokenValue).to.equal(0); + }); + + cy.contains('Make an Offer').click(); + cy.confirmTransaction().then(taskCompleted => { + expect(taskCompleted).to.be.true; + }); + }); it(`should disconnect the wallet from all the connected DAPPs`, () => { cy.disconnectWalletFromDapp().then(taskCompleted => { expect(taskCompleted).to.be.true;