Update gist test

pull/668/head
ioedeveloper 4 years ago
parent e84d81bd7e
commit bd5c452116
  1. 24
      apps/remix-ide-e2e/src/tests/gist.test.ts
  2. 1
      libs/remix-ui/modal-dialog/src/lib/remix-ui-modal-dialog.tsx

@ -13,7 +13,7 @@ module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) { before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done) init(browser, done)
}, },
'UploadToGists': function (browser: NightwatchBrowser) { UploadToGists: function (browser: NightwatchBrowser) {
/* /*
- set the access token - set the access token
- publish to gist - publish to gist
@ -24,18 +24,23 @@ module.exports = {
const runtimeBrowser = browser.options.desiredCapabilities.browserName const runtimeBrowser = browser.options.desiredCapabilities.browserName
browser browser
.refresh()
.pause(10000)
.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000) .waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.clickLaunchIcon('fileExplorers') .clickLaunchIcon('fileExplorers')
.rightClick('[data-path="browser/README.txt"]') .click('[data-id="fileExplorerNewFilecreateNewFolder"]')
.click('*[id="menuitemcreate folder"]') .pause(1000)
.waitForElementVisible('*[data-id="modalDialogContainer"]') .keys('Browser_Tests')
.setValue('*[data-id="modalDialogCustomPromptText"]', 'Browser_Tests') .keys(browser.Keys.ENTER)
.modalFooterOKClick()
.waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]') .waitForElementVisible('*[data-id="treeViewLibrowser/Browser_Tests"]')
.addFile('File.sol', { content: '' }) .addFile('File.sol', { content: '' })
.click('*[data-id="fileExplorerNewFilepublishToGist"]') .click('*[data-id="fileExplorerNewFilepublishToGist"]')
.modalFooterOKClick() .waitForElementVisible('*[data-id="modalDialogContainer-react"]')
.getModalBody((value, done) => { .pause(2000)
.click('.modal-ok')
.getText('[data-id="modalDialogModalBody-react"]', (result) => {
console.log(result)
const value = typeof result.value === 'string' ? result.value : null
const reg = /gist.github.com\/([^.]+)/ const reg = /gist.github.com\/([^.]+)/
const id = value.match(reg) const id = value.match(reg)
@ -45,13 +50,12 @@ module.exports = {
} else { } else {
const gistid = id[1] const gistid = id[1]
browser browser
.modalFooterCancelClick() .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(`li[key="browser/gists/${gistid}"]`)
.click(`li[key="browser/gists/${gistid}"]`) .click(`li[key="browser/gists/${gistid}"]`)
.openFile(`browser/gists/${gistid}/README.txt`) .openFile(`browser/gists/${gistid}/README.txt`)
.perform(done)
} }
}) })
}, },

@ -88,6 +88,7 @@ export const ModalDialog = (props: ModalDialogProps) => {
} }
{ props.cancel && { props.cancel &&
<span <span
data-id='modal-footer-cancel-react'
className={'modal-cancel btn btn-sm ' + (state.toggleBtn ? 'btn-light' : 'btn-dark')} className={'modal-cancel btn btn-sm ' + (state.toggleBtn ? 'btn-light' : 'btn-dark')}
data-dismiss="modal" data-dismiss="modal"
onClick={() => { onClick={() => {

Loading…
Cancel
Save