diff --git a/apps/remix-ide-e2e/src/commands/pinChain.ts b/apps/remix-ide-e2e/src/commands/pinGrid.ts similarity index 58% rename from apps/remix-ide-e2e/src/commands/pinChain.ts rename to apps/remix-ide-e2e/src/commands/pinGrid.ts index 9c049b9068..6c82922960 100644 --- a/apps/remix-ide-e2e/src/commands/pinChain.ts +++ b/apps/remix-ide-e2e/src/commands/pinGrid.ts @@ -1,14 +1,14 @@ import { NightwatchBrowser } from 'nightwatch' import EventEmitter from 'events' -class pinChain extends EventEmitter { - command (this: NightwatchBrowser, provider: string): NightwatchBrowser { +class pinGrid extends EventEmitter { + command (this: NightwatchBrowser, provider: string, status: boolean): NightwatchBrowser { this.api.useCss().waitForElementVisible('[data-id="settingsSelectEnvOptions"]') .click('[data-id="settingsSelectEnvOptions"] button') .waitForElementVisible(`[data-id="dropdown-item-another-chain"]`) .click(`[data-id="dropdown-item-another-chain"]`) - .waitForElementVisible(`[data-id="${provider}-unpinned"]`) - .click(`[data-id="${provider}-unpinned"]`) + .waitForElementVisible(`[data-id="${provider}-${status ? 'unpinned' : 'pinned'}"]`) + .click(`[data-id="${provider}-${status ? 'unpinned' : 'pinned'}"]`) .perform((done) => { done() this.emit('complete') @@ -17,4 +17,4 @@ class pinChain extends EventEmitter { } } -module.exports = pinChain +module.exports = pinGrid diff --git a/apps/remix-ide-e2e/src/tests/grid.test.ts b/apps/remix-ide-e2e/src/tests/grid.test.ts new file mode 100644 index 0000000000..5da7379328 --- /dev/null +++ b/apps/remix-ide-e2e/src/tests/grid.test.ts @@ -0,0 +1,36 @@ +'use strict' +import { NightwatchBrowser } from 'nightwatch' +import init from '../helpers/init' + +module.exports = { + before: function (browser: NightwatchBrowser, done: VoidFunction) { + init(browser, done, 'http://127.0.0.1:8080?plugins=solidity,udapp', false) + }, + 'pin chain': function (browser: NightwatchBrowser) { + browser + .clickLaunchIcon('udapp') + .pinGrid('vm-custom-fork', true) + .waitForElementVisible('[data-id="settingsSelectEnvOptions"]') + .click('[data-id="settingsSelectEnvOptions"] button') + .waitForElementVisible(`[data-id="dropdown-item-vm-custom-fork"]`) + .click('[data-id="settingsSelectEnvOptions"] button') // close the dropdown + .pinGrid('vm-sepolia-fork', true) + .waitForElementVisible('[data-id="settingsSelectEnvOptions"]') + .click('[data-id="settingsSelectEnvOptions"] button') + .waitForElementVisible(`[data-id="dropdown-item-vm-sepolia-fork"]`) + .click('[data-id="settingsSelectEnvOptions"] button') // close the dropdown + }, + 'unpin chain': function (browser: NightwatchBrowser) { + browser + .pinGrid('vm-custom-fork', false) + .waitForElementVisible('[data-id="settingsSelectEnvOptions"]') + .click('[data-id="settingsSelectEnvOptions"] button') + .waitForElementNotPresent(`[data-id="dropdown-item-vm-custom-fork"]`) + .click('[data-id="settingsSelectEnvOptions"] button') // close the dropdown + .pinGrid('vm-sepolia-fork', false) + .waitForElementVisible('[data-id="settingsSelectEnvOptions"]') + .click('[data-id="settingsSelectEnvOptions"] button') + .waitForElementNotPresent(`[data-id="dropdown-item-vm-sepolia-fork"]`) + .click('[data-id="settingsSelectEnvOptions"] button') // close the dropdown + } +} \ No newline at end of file diff --git a/apps/remix-ide-e2e/src/tests/terminal.test.ts b/apps/remix-ide-e2e/src/tests/terminal.test.ts index 99905f17f6..9d73831389 100644 --- a/apps/remix-ide-e2e/src/tests/terminal.test.ts +++ b/apps/remix-ide-e2e/src/tests/terminal.test.ts @@ -313,7 +313,7 @@ module.exports = { 'Should connect to the sepolia fork and run web3.eth.getCode in the terminal #group9': function (browser: NightwatchBrowser) { if (runMasterTests) browser - .pinChain('vm-custom-fork') + .pinGrid('vm-custom-fork', true) .switchEnvironment('vm-custom-fork') .waitForElementVisible('[data-id="vm-custom-fork-modal-footer-ok-react"]') .execute(() => { diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index a1a39f2d92..4a5b1831ee 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -70,7 +70,7 @@ declare module 'nightwatch' { currentSelectedFileIs(name: string): NightwatchBrowser switchWorkspace: (workspaceName: string) => NightwatchBrowser switchEnvironment: (provider: string) => NightwatchBrowser - pinChain: (provider: string) => NightwatchBrowser + pinGrid: (provider: string, status: boolean) => NightwatchBrowser connectToExternalHttpProvider: (url: string, identifier: string) => NightwatchBrowser waitForElementNotContainsText: (id: string, value: string, timeout: number = 10000) => NightwatchBrowser hideToolTips: (this: NightwatchBrowser) => NightwatchBrowser