diff --git a/commands/keplr.js b/commands/keplr.js index 8df501adf..03c141a73 100644 --- a/commands/keplr.js +++ b/commands/keplr.js @@ -42,7 +42,7 @@ const keplr = { await module.exports.goTo(permissionsUrl); }, async switchToKeplrIfNotActive() { - if (await playwright.isCypressWindowActive()) { + if (playwright.isCypressWindowActive()) { await playwright.switchToKeplrWindow(); switchBackToCypressWindow = true; } @@ -225,7 +225,10 @@ const keplr = { } await playwright.assignWindows(); - await playwright.assignActiveTabName('keplr'); + if (!playwright.isKeplrWindowActive()) { + await playwright.switchToKeplrWindow(); + } + playwright.assignActiveTabName('keplr'); await module.exports.getExtensionDetails(); await module.exports.importWallet( secretWordsOrPrivateKey, diff --git a/commands/playwright-keplr.js b/commands/playwright-keplr.js index 9ebafc484..d5ff94d84 100644 --- a/commands/playwright-keplr.js +++ b/commands/playwright-keplr.js @@ -34,25 +34,25 @@ module.exports = { keplrNotificationWindow() { return keplrNotificationWindow; }, - async assignActiveTabName(tabName) { + assignActiveTabName(tabName) { activeTabName = tabName; return true; }, - async isKeplrWindowActive() { + isKeplrWindowActive() { return activeTabName === 'keplr'; }, - async isCypressWindowActive() { + isCypressWindowActive() { return activeTabName === 'cypress'; }, async switchToKeplrWindow() { await keplrWindow.bringToFront(); - await module.exports.assignActiveTabName('keplr'); + module.exports.assignActiveTabName('keplr'); return true; }, async switchToCypressWindow() { if (mainWindow) { await mainWindow.bringToFront(); - await module.exports.assignActiveTabName('cypress'); + module.exports.assignActiveTabName('cypress'); } return true; }, diff --git a/tests/e2e/specs/keplr/keplr-spec.js b/tests/e2e/specs/keplr/keplr-spec.js index 92511f502..09ae290e9 100644 --- a/tests/e2e/specs/keplr/keplr-spec.js +++ b/tests/e2e/specs/keplr/keplr-spec.js @@ -55,23 +55,19 @@ describe('Keplr', () => { ); }); it(`should create a new wallet using 24 word phrase`, () => { - cy.switchToExtensionWindow().then(() => { - cy.setupWallet( - 'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology', - 'Test1234', - true, - ).then(setupFinished => { - expect(setupFinished).to.be.true; - }); + cy.setupWallet( + 'orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology', + 'Test1234', + true, + ).then(setupFinished => { + expect(setupFinished).to.be.true; }); }); it(`should complete Keplr setup by importing the wallet using private key`, () => { - cy.switchToExtensionWindow().then(() => { - cy.setupWallet( - 'A9C09B6E4AF70DE1F1B621CB1AA66CFD0B4AA977E4C18497C49132DD9E579485', - ).then(setupFinished => { - expect(setupFinished).to.be.true; - }); + cy.setupWallet( + 'A9C09B6E4AF70DE1F1B621CB1AA66CFD0B4AA977E4C18497C49132DD9E579485', + ).then(setupFinished => { + expect(setupFinished).to.be.true; }); }); it(`should disconnect the wallet from all the connected DAPPs`, () => {