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 {
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
}
}

@ -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

@ -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')
})
})
},

@ -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

Loading…
Cancel
Save