From 51e969d4a6bbdc7ab989b81221aa99449de4fd06 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 10 Jan 2022 17:00:27 +0100 Subject: [PATCH] fix E2E test --- .../src/local-plugin/src/app/app.tsx | 2 +- apps/remix-ide-e2e/src/tests/plugin_api.ts | 21 ++++++++++++------- apps/remix-ide/ci/browser_tests_plugin_api.sh | 1 + 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx b/apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx index 50c4699997..d1a559764e 100644 --- a/apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx +++ b/apps/remix-ide-e2e/src/local-plugin/src/app/app.tsx @@ -33,7 +33,7 @@ function App () { useEffect(() => { client.onload(async () => { - const customProfiles = ['menuicons', 'tabs', 'solidityUnitTesting'] + const customProfiles = ['menuicons', 'tabs', 'solidityUnitTesting', 'hardhat-provider'] client.testCommand = async (data: any) => { console.log(data) diff --git a/apps/remix-ide-e2e/src/tests/plugin_api.ts b/apps/remix-ide-e2e/src/tests/plugin_api.ts index 1741a5a66b..b303864438 100644 --- a/apps/remix-ide-e2e/src/tests/plugin_api.ts +++ b/apps/remix-ide-e2e/src/tests/plugin_api.ts @@ -10,7 +10,7 @@ declare global { const localPluginData: Profile & LocationProfile & ExternalProfile = { name: 'localPlugin', displayName: 'Local Plugin', - canActivate: ['dGitProvider', 'flattener', 'solidityUnitTesting', 'udapp'], + canActivate: ['dGitProvider', 'flattener', 'solidityUnitTesting', 'udapp', 'hardhat-provider'], url: 'http://localhost:2020', location: 'sidePanel' } @@ -328,15 +328,20 @@ module.exports = { // PROVIDER - 'Should switch to hardhat provider (provider plugin)': async function (browser: NightwatchBrowser) { + 'Should switch to hardhat provider (provider plugin) #group8': function (browser: NightwatchBrowser) { browser + .frameParent() + .useCss() + .clickLaunchIcon('pluginManager') + .scrollAndClick('[data-id="pluginManagerComponentActivateButtonhardhat-provider"]') .clickLaunchIcon('udapp') - .click('*[data-id="Hardhat provider"]') + .click('*[data-id="Hardhat Provider"]') .modalFooterOKClick('hardhatprovider') .waitForElementContainsText('*[data-id="settingsNetworkEnv"]', 'Custom') // e.g Custom (1337) network - .getValue('*[data-id="settingsNetworkEnv"]', (result) => { - browser.assert.ok((result.value as string).match(/^Custom \(\d+\) network$/) !== undefined, 'Expected to ') - }) + .clickLaunchIcon('localPlugin') + .useXpath() + // @ts-ignore + .frame(0) .perform(async () => { const request = { id: 9999, @@ -344,8 +349,8 @@ module.exports = { method: 'net_listening', params: [] } - const result = true - await clickAndCheckLog(browser, 'hardhat-provider:sendAsync', {}, result, request) + const result = '{"jsonrpc":"2.0","result":true,"id":9999}' + await clickAndCheckLog(browser, 'hardhat-provider:sendAsync', result, null, request) }) } } diff --git a/apps/remix-ide/ci/browser_tests_plugin_api.sh b/apps/remix-ide/ci/browser_tests_plugin_api.sh index eae0d5b389..282b979c98 100755 --- a/apps/remix-ide/ci/browser_tests_plugin_api.sh +++ b/apps/remix-ide/ci/browser_tests_plugin_api.sh @@ -6,6 +6,7 @@ BUILD_ID=${CIRCLE_BUILD_NUM:-${TRAVIS_JOB_NUMBER}} echo "$BUILD_ID" TEST_EXITCODE=0 +npm run ganache-cli & npm run serve:production & npx nx serve remix-ide-e2e-src-local-plugin &