pull/1879/head
yann300 3 years ago
parent e5d59482f5
commit 5fb724ccef
  1. 15
      apps/remix-ide-e2e/src/commands/modalFooterCancelClick.ts
  2. 11
      apps/remix-ide-e2e/src/commands/modalFooterOKClick.ts
  3. 6
      apps/remix-ide-e2e/src/tests/gist.test.ts
  4. 4
      apps/remix-ide-e2e/src/types/index.d.ts
  5. 2
      libs/remix-core-plugin/src/lib/gist-handler.ts

@ -1,14 +1,15 @@
import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class ModalFooterOKClick extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser {
this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => {
this.api.execute(function () {
const elem = document.querySelector('#modal-footer-cancel') as HTMLElement
class ModalFooterCancelClick extends EventEmitter {
command (this: NightwatchBrowser, id?: string): NightwatchBrowser {
const clientId = id ? `*[data-id="${id}-modal-footer-cancel-react"]` : '#modal-footer-cancel'
this.api.waitForElementVisible(clientId).perform((client, done) => {
this.api.execute(function (clientId) {
const elem = document.querySelector(clientId) as HTMLElement
elem.click()
}, [], () => {
}, [clientId], () => {
done()
this.emit('complete')
})
@ -17,4 +18,4 @@ class ModalFooterOKClick extends EventEmitter {
}
}
module.exports = ModalFooterOKClick
module.exports = ModalFooterCancelClick

@ -2,13 +2,14 @@ import { NightwatchBrowser } from 'nightwatch'
import EventEmitter from 'events'
class ModalFooterOKClick extends EventEmitter {
command (this: NightwatchBrowser): NightwatchBrowser {
this.api.waitForElementVisible('#modal-footer-ok').perform((client, done) => {
this.api.execute(function () {
const elem = document.querySelector('#modal-footer-ok') as HTMLElement
command (this: NightwatchBrowser, id?: string): NightwatchBrowser {
const clientId = id ? `*[data-id="${id}-modal-footer-ok-react"]` : '#modal-footer-ok'
this.api.waitForElementVisible(clientId).perform((client, done) => {
this.api.execute(function (clientId) {
const elem = document.querySelector(clientId) as HTMLElement
elem.click()
}, [], () => {
}, [clientId], () => {
done()
this.emit('complete')
})

@ -81,7 +81,7 @@ module.exports = {
.waitForElementVisible('*[data-id="gisthandlerModalDialogModalBody-react"]')
.assert.containsText('*[data-id="gisthandlerModalDialogModalBody-react"]', 'Enter the ID of the Gist or URL you would like to load.')
.waitForElementVisible('*[data-id="modalDialogCustomPromp"]')
.modalFooterCancelClick()
.modalFooterCancelClick('gisthandler')
},
'Display Error Message For Invalid Gist ID': function (browser: NightwatchBrowser) {
@ -91,10 +91,10 @@ module.exports = {
.scrollAndClick('*[data-id="landingPageImportFromGistButton"]')
.waitForElementVisible('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]')
.setValue('*[data-id="gisthandlerModalDialogModalBody-react"] input[data-id="modalDialogCustomPromp"]', testData.invalidGistId)
.modalFooterOKClick()
.modalFooterOKClick('gisthandler')
.waitForElementVisible('*[data-id="gisthandlerModalDialogModalBody-react"]')
.assert.containsText('*[data-id="gisthandlerModalDialogModalBody-react"]', 'Not Found')
.modalFooterOKClick()
.modalFooterOKClick('gisthandler')
},
'Display Error Message For Missing Gist Token When Publishing': function (browser: NightwatchBrowser) {

@ -18,7 +18,7 @@ declare module 'nightwatch' {
goToVMTraceStep(step: number, incr?: number): NightwatchBrowser,
checkVariableDebug(id: string, debugValue: NightwatchCheckVariableDebugValue): NightwatchBrowser,
addAtAddressInstance(address: string, isValidFormat: boolean, isValidChecksum: boolean): NightwatchBrowser,
modalFooterOKClick(): NightwatchBrowser,
modalFooterOKClick(id?: string): NightwatchBrowser,
clickInstance(index: number): NightwatchBrowser,
journalLastChildIncludes(val: string): NightwatchBrowser,
executeScript(script: string): NightwatchBrowser,
@ -32,7 +32,7 @@ declare module 'nightwatch' {
scrollToLine(line: number): NightwatchBrowser,
waitForElementContainsText(id: string, value: string, timeout?: number): NightwatchBrowser,
getModalBody(callback: (value: string, cb: VoidFunction) => void): NightwatchBrowser,
modalFooterCancelClick(): NightwatchBrowser,
modalFooterCancelClick(id?: string): NightwatchBrowser,
selectContract(contractName: string): NightwatchBrowser,
createContract(inputParams: string): NightwatchBrowser,
getAddressAtPosition(index: number, cb: (pos: string) => void): NightwatchBrowser,

@ -37,7 +37,7 @@ export class GistHandler extends Plugin {
setTimeout(() => resolve(value), 0)
},
cancelFn: () => {
setTimeout(() => reject("Canceled"), 0)
setTimeout(() => reject(new Error('Canceled')), 0)
}
}
this.call('modal', 'modal', modalContent)

Loading…
Cancel
Save