diff --git a/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts b/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts index af1a7dbb55..fff9a61929 100644 --- a/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts +++ b/apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts @@ -4,12 +4,12 @@ import EventEmitter from 'events' class ClickLaunchIcon extends EventEmitter { command (this: NightwatchBrowser, icon: string): NightwatchBrowser { this.api - .waitForElementVisible('#icon-panel div[plugin="' + icon + '"]') - .click('#icon-panel div[plugin="' + icon + '"]') - .perform((done) => { - done() - this.emit('complete') - }) + .waitForElementVisible('#icon-panel div[plugin="' + icon + '"]') + .click('#icon-panel div[plugin="' + icon + '"]') + .perform((done) => { + done() + this.emit('complete') + }) return this } } diff --git a/apps/remix-ide-e2e/src/commands/connectToExternalHttpProvider.ts b/apps/remix-ide-e2e/src/commands/connectToExternalHttpProvider.ts index 8bac04f9fe..5a971c02cb 100644 --- a/apps/remix-ide-e2e/src/commands/connectToExternalHttpProvider.ts +++ b/apps/remix-ide-e2e/src/commands/connectToExternalHttpProvider.ts @@ -2,40 +2,40 @@ import { NightwatchBrowser } from 'nightwatch' import EventEmitter from 'events' class ConnectToExternalHttpProvider extends EventEmitter { - command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser { - this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`, - (result) => { - if (result.status as any === -1) { - console.log("No connection to external provider found. Adding one.", url) - browser - .click({ - locateStrategy: 'css selector', - selector: '[data-id="basic-http-provider-modal-footer-ok-react"]', - abortOnFailure: false, - suppressNotFoundErrors: true, - timeout: 5000 - }) - .switchEnvironment('basic-http-provider') - .waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') - .execute(() => { - (document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() - }, [], () => { }) - .setValue('[data-id="modalDialogCustomPromp"]', url) - .modalFooterOKClick('basic-http-provider') - .perform((done) => { - done() - this.emit('complete') - }) - } else { - this.api.perform((done) => { - done() - this.emit('complete') - }) - } - } - ) - return this - } + command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser { + this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`, + (result) => { + if (result.status as any === -1) { + console.log("No connection to external provider found. Adding one.", url) + browser + .click({ + locateStrategy: 'css selector', + selector: '[data-id="basic-http-provider-modal-footer-ok-react"]', + abortOnFailure: false, + suppressNotFoundErrors: true, + timeout: 5000 + }) + .switchEnvironment('basic-http-provider') + .waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') + .execute(() => { + (document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() + }, [], () => { }) + .setValue('[data-id="modalDialogCustomPromp"]', url) + .modalFooterOKClick('basic-http-provider') + .perform((done) => { + done() + this.emit('complete') + }) + } else { + this.api.perform((done) => { + done() + this.emit('complete') + }) + } + } + ) + return this + } } module.exports = ConnectToExternalHttpProvider diff --git a/apps/remix-ide-e2e/src/tests/vyper_api.test.ts b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts index 2533ac60c5..85ae82919c 100644 --- a/apps/remix-ide-e2e/src/tests/vyper_api.test.ts +++ b/apps/remix-ide-e2e/src/tests/vyper_api.test.ts @@ -61,7 +61,12 @@ module.exports = { }, 'Should copy abi after blind_auction compile #group1': function (browser: NightwatchBrowser) { - console.log(browser as any) + const chromeBrowser = (browser as any).chrome + // const firefoxBrowser = (browser as any).firefox + // console.log('chromeBrowser', chromeBrowser) + // console.log('firefoxBrowser', firefoxBrowser) + chromeBrowser.setPermission('clipboard-read', 'granted') + chromeBrowser.setPermission('clipboard-write', 'granted') browser//.clickLaunchIcon('vyper') .frame(0) .click('[data-id="remote-compiler"]') @@ -77,9 +82,9 @@ module.exports = { .execute(() => { navigator.clipboard.readText() .then((clippedText) => { - console.log('clippedText', clippedText) + console.log(`clipped text is ${clippedText.length} characters long`) + if(clippedText.length === 0) throw new Error('Clipboard is empty') }) - }) }, diff --git a/apps/remix-ide-e2e/src/types/index.d.ts b/apps/remix-ide-e2e/src/types/index.d.ts index ada7b9cca9..665a1cc4f5 100644 --- a/apps/remix-ide-e2e/src/types/index.d.ts +++ b/apps/remix-ide-e2e/src/types/index.d.ts @@ -15,6 +15,7 @@ declare module 'nightwatch' { verifyContracts(compiledContractNames: string[], opts?: {wait: number; version?: string; runs?: string}): NightwatchBrowser selectAccount(account?: string): NightwatchBrowser clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser + checkClipboard(): NightwatchBrowser testFunction(txHash: string, expectedInput: NightwatchTestFunctionExpectedInput): NightwatchBrowser goToVMTraceStep(step: number, incr?: number): NightwatchBrowser checkVariableDebug(id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser