From 17049e799e3b8a487ee91e64e05f4b353be8e40f Mon Sep 17 00:00:00 2001 From: Fraz Arshad Date: Mon, 4 Mar 2024 19:48:44 +0500 Subject: [PATCH 1/2] fix: added code to handle setup of keplr wallet beforehand --- plugins/index.js | 10 +++++++--- support/index.js | 13 +++++++++++-- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/plugins/index.js b/plugins/index.js index 6507a48c0..ba5eec285 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -6,10 +6,14 @@ module.exports = (on, config) => { } else if (extension === 'keplr') { selectedConfig = require('./keplr-plugin'); } else { - throw new Error( - `${extension} is not a valid extension name`, - ); + throw new Error(`${extension} is not a valid extension name`); } + if (process.env.SKIP_EXTENSION_SETUP) + config.env.SKIP_EXTENSION_SETUP = JSON.parse( + process.env.SKIP_EXTENSION_SETUP, + ); + if (process.env.EXTENSION) config.env.EXTENSION = process.env.EXTENSION; + return selectedConfig(on, config); }; diff --git a/support/index.js b/support/index.js index 8bb05ed2c..159860524 100644 --- a/support/index.js +++ b/support/index.js @@ -25,7 +25,16 @@ Cypress.on('window:before:load', win => { }); before(() => { - if (Cypress.env('EXTENSION') === 'metamask' && !Cypress.env('SKIP_EXTENSION_SETUP')) { - cy.setupMetamask(); + if (!Cypress.env('SKIP_EXTENSION_SETUP')) { + switch (Cypress.env('EXTENSION')) { + case 'metamask': + cy.setupMetamask(); + break; + case 'keplr': + cy.setupWallet(); + break; + default: + throw new Error(`Unknown extension: ${Cypress.env('EXTENSION')}`); + } } }); From 5f280a96c8844d214bc82b359b7bd111d43e9936 Mon Sep 17 00:00:00 2001 From: Fraz Arshad Date: Tue, 5 Mar 2024 12:13:02 +0500 Subject: [PATCH 2/2] chore: lint fixes --- plugins/index.js | 8 ++++++-- support/index.js | 2 -- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/index.js b/plugins/index.js index ba5eec285..29f89de05 100644 --- a/plugins/index.js +++ b/plugins/index.js @@ -9,11 +9,15 @@ module.exports = (on, config) => { throw new Error(`${extension} is not a valid extension name`); } - if (process.env.SKIP_EXTENSION_SETUP) + if (process.env.SKIP_EXTENSION_SETUP) { config.env.SKIP_EXTENSION_SETUP = JSON.parse( process.env.SKIP_EXTENSION_SETUP, ); - if (process.env.EXTENSION) config.env.EXTENSION = process.env.EXTENSION; + } + + if (process.env.EXTENSION) { + config.env.EXTENSION = process.env.EXTENSION; + } return selectedConfig(on, config); }; diff --git a/support/index.js b/support/index.js index 159860524..92911f960 100644 --- a/support/index.js +++ b/support/index.js @@ -33,8 +33,6 @@ before(() => { case 'keplr': cy.setupWallet(); break; - default: - throw new Error(`Unknown extension: ${Cypress.env('EXTENSION')}`); } } });