Fix gist test

pull/668/head
ioedeveloper 4 years ago
parent bd5c452116
commit 4c911ab63e
  1. 2
      .env
  2. 15
      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_passphrase=<passphrase>
account_password=<password> account_password=<password>
NODE_OPTIONS=--max-old-space-size=2048 NODE_OPTIONS=--max-old-space-size=2048

@ -2,9 +2,9 @@ import { NightwatchBrowser, NightwatchContractContent } from 'nightwatch'
import EventEmitter from "events" import EventEmitter from "events"
class AddFile extends EventEmitter { 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) => { this.api.perform((done) => {
addFile(this.api, name, content, () => { addFile(this.api, name, content, open, () => {
done() done()
this.emit('complete') 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') browser.clickLaunchIcon('udapp').clickLaunchIcon('fileExplorers').click('.newFile')
.pause(2000) .pause(2000)
.keys(name) .keys(name)
.keys(browser.Keys.ENTER) .keys(browser.Keys.ENTER)
.openFile('browser/' + name) .perform((done) => {
.setEditorValue(content.content) if (open) {
browser.openFile('browser/' + name)
.setEditorValue(content.content)
}
done()
})
.pause(1000) .pause(1000)
.perform(function () { .perform(function () {
done() done()

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

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

Loading…
Cancel
Save