clipboard test

pull/5370/head
Joseph Izang 11 months ago
parent 772a009e99
commit f18e1babaa
  1. 12
      apps/remix-ide-e2e/src/commands/clickLaunchIcon.ts
  2. 68
      apps/remix-ide-e2e/src/commands/connectToExternalHttpProvider.ts
  3. 11
      apps/remix-ide-e2e/src/tests/vyper_api.test.ts
  4. 1
      apps/remix-ide-e2e/src/types/index.d.ts

@ -4,12 +4,12 @@ import EventEmitter from 'events'
class ClickLaunchIcon extends EventEmitter { class ClickLaunchIcon extends EventEmitter {
command (this: NightwatchBrowser, icon: string): NightwatchBrowser { command (this: NightwatchBrowser, icon: string): NightwatchBrowser {
this.api this.api
.waitForElementVisible('#icon-panel div[plugin="' + icon + '"]') .waitForElementVisible('#icon-panel div[plugin="' + icon + '"]')
.click('#icon-panel div[plugin="' + icon + '"]') .click('#icon-panel div[plugin="' + icon + '"]')
.perform((done) => { .perform((done) => {
done() done()
this.emit('complete') this.emit('complete')
}) })
return this return this
} }
} }

@ -2,40 +2,40 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events' import EventEmitter from 'events'
class ConnectToExternalHttpProvider extends EventEmitter { class ConnectToExternalHttpProvider extends EventEmitter {
command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser { command(this: NightwatchBrowser, url: string, identifier: string): NightwatchBrowser {
this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`, this.api.element('xpath', `//*[@class='udapp_environment' and contains(.,'${identifier}')]`,
(result) => { (result) => {
if (result.status as any === -1) { if (result.status as any === -1) {
console.log("No connection to external provider found. Adding one.", url) console.log("No connection to external provider found. Adding one.", url)
browser browser
.click({ .click({
locateStrategy: 'css selector', locateStrategy: 'css selector',
selector: '[data-id="basic-http-provider-modal-footer-ok-react"]', selector: '[data-id="basic-http-provider-modal-footer-ok-react"]',
abortOnFailure: false, abortOnFailure: false,
suppressNotFoundErrors: true, suppressNotFoundErrors: true,
timeout: 5000 timeout: 5000
}) })
.switchEnvironment('basic-http-provider') .switchEnvironment('basic-http-provider')
.waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]') .waitForElementPresent('[data-id="basic-http-provider-modal-footer-ok-react"]')
.execute(() => { .execute(() => {
(document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus() (document.querySelector('*[data-id="basic-http-providerModalDialogContainer-react"] input[data-id="modalDialogCustomPromp"]') as any).focus()
}, [], () => { }) }, [], () => { })
.setValue('[data-id="modalDialogCustomPromp"]', url) .setValue('[data-id="modalDialogCustomPromp"]', url)
.modalFooterOKClick('basic-http-provider') .modalFooterOKClick('basic-http-provider')
.perform((done) => { .perform((done) => {
done() done()
this.emit('complete') this.emit('complete')
}) })
} else { } else {
this.api.perform((done) => { this.api.perform((done) => {
done() done()
this.emit('complete') this.emit('complete')
}) })
} }
} }
) )
return this return this
} }
} }
module.exports = ConnectToExternalHttpProvider module.exports = ConnectToExternalHttpProvider

@ -61,7 +61,12 @@ module.exports = {
}, },
'Should copy abi after blind_auction compile #group1': function (browser: NightwatchBrowser) { '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') browser//.clickLaunchIcon('vyper')
.frame(0) .frame(0)
.click('[data-id="remote-compiler"]') .click('[data-id="remote-compiler"]')
@ -77,9 +82,9 @@ module.exports = {
.execute(() => { .execute(() => {
navigator.clipboard.readText() navigator.clipboard.readText()
.then((clippedText) => { .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')
}) })
}) })
}, },

@ -15,6 +15,7 @@ declare module 'nightwatch' {
verifyContracts(compiledContractNames: string[], opts?: {wait: number; version?: string; runs?: string}): NightwatchBrowser verifyContracts(compiledContractNames: string[], opts?: {wait: number; version?: string; runs?: string}): NightwatchBrowser
selectAccount(account?: string): NightwatchBrowser selectAccount(account?: string): NightwatchBrowser
clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser
checkClipboard(): NightwatchBrowser
testFunction(txHash: string, expectedInput: NightwatchTestFunctionExpectedInput): NightwatchBrowser testFunction(txHash: string, expectedInput: NightwatchTestFunctionExpectedInput): NightwatchBrowser
goToVMTraceStep(step: number, incr?: number): NightwatchBrowser goToVMTraceStep(step: number, incr?: number): NightwatchBrowser
checkVariableDebug(id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser checkVariableDebug(id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser

Loading…
Cancel
Save