Fix gist test

pull/668/head
ioedeveloper 4 years ago
parent bd5c452116
commit 4c911ab63e
  1. 2
      .env
  2. 13
      apps/remix-ide-e2e/src/commands/addFile.ts
  3. 10
      apps/remix-ide-e2e/src/tests/gist.test.ts
  4. 2
      apps/remix-ide-e2e/src/types/index.d.ts

@ -1,4 +1,4 @@
gist_token=<token>
gist_token=41ecc30018511d0eaecd7fa4bd479f3263b61a48
account_passphrase=<passphrase>
account_password=<password>
NODE_OPTIONS=--max-old-space-size=2048

@ -2,9 +2,9 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from "events"
class AddFile extends EventEmitter {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent): NightwatchBrowser {
command (this: NightwatchBrowser, name: string, content: NightwatchContractContent, open = true): NightwatchBrowser {
this.api.perform((done) => {
addFile(this.api, name, content, () => {
addFile(this.api, name, content, open, () => {
done()
this.emit('complete')
})
@ -13,13 +13,18 @@ class AddFile extends EventEmitter {
}
}
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, done: VoidFunction) {
function addFile (browser: NightwatchBrowser, name: string, content: NightwatchContractContent, open: boolean, done: VoidFunction) {
browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile')
.pause(2000)
.keys(name)
.keys(browser.Keys.ENTER)
.openFile('browser/' + name)
.perform((done) => {
if (open) {
browser.openFile('browser/' + name)
.setEditorValue(content.content)
}
done()
})
.pause(1000)
.perform(function () {
done()

@ -27,17 +27,17 @@ module.exports = {
.refresh()
.pause(10000)
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers')
.click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.pause(1000)
.keys('Browser_Tests')
.keys(browser.Keys.ENTER)
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' })
.waitForElementVisible('*[data-id="treeViewLitreeViewItembrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' }, false)
.click('*[data-id="fileExplorerNewFilepublishToGist"]')
.waitForElementVisible('*[data-id="modalDialogContainer-react"]')
.pause(2000)
.click('.modal-ok')
.pause(10000)
.getText('[data-id="modalDialogModalBody-react"]', (result) => {
console.log(result)
const value = typeof result.value === 'string' ? result.value : null
@ -53,8 +53,8 @@ module.exports = {
.click('[data-id="modal-footer-cancel-react"]')
.executeScript(`remix.loadgist('${gistid}')`)
.perform((done) => { if (runtimeBrowser === 'chrome') { browser.openFile('browser/gists') } done() })
.waitForElementVisible(`li[key="browser/gists/${gistid}"]`)
.click(`li[key="browser/gists/${gistid}"]`)
.waitForElementVisible(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`)
.click(`[data-id="treeViewLitreeViewItembrowser/gists/${gistid}"]`)
.openFile(`browser/gists/${gistid}/README.txt`)
}
})

@ -10,7 +10,7 @@ declare module "nightwatch" {
scrollInto(target: string): NightwatchBrowser,
testContracts(fileName: string, contractCode: NightwatchContractContent, compiledContractNames: string[]): NightwatchBrowser,
setEditorValue(value: string, callback?: () => void): NightwatchBrowser,
addFile(name: string, content: NightwatchContractContent): NightwatchBrowser,
addFile(name: string, content: NightwatchContractContent, open?: boolean): NightwatchBrowser,
verifyContracts(compiledContractNames: string[], opts?: { wait: number, version?: string }): NightwatchBrowser,
selectAccount(account?: string): NightwatchBrowser,
clickFunction(fnFullName: string, expectedInput?: NightwatchClickFunctionExpectedInput): NightwatchBrowser,

Loading…
Cancel
Save