commit
8a5f176afe
@ -0,0 +1,16 @@ |
||||
const EventEmitter = require('events') |
||||
|
||||
class GetModalBody extends EventEmitter { |
||||
command (callback) { |
||||
this.api.waitForElementVisible('.modal-body') |
||||
.getText('.modal-body', (result) => { |
||||
console.log(result) |
||||
callback(result.value, () => { |
||||
this.emit('complete') |
||||
}) |
||||
}) |
||||
return this |
||||
} |
||||
} |
||||
|
||||
module.exports = GetModalBody |
@ -0,0 +1,17 @@ |
||||
const EventEmitter = require('events') |
||||
|
||||
class ModalFooterOKClick extends EventEmitter { |
||||
command () { |
||||
this.api.waitForElementVisible('#modal-footer-cancel').perform((client, done) => { |
||||
this.api.execute(function () { |
||||
document.querySelector('#modal-footer-cancel').click() |
||||
}, [], (result) => { |
||||
done() |
||||
this.emit('complete') |
||||
}) |
||||
}) |
||||
return this |
||||
} |
||||
} |
||||
|
||||
module.exports = ModalFooterOKClick |
@ -0,0 +1,45 @@ |
||||
'use strict' |
||||
const init = require('../helpers/init') |
||||
const sauce = require('./sauce') |
||||
// 99266d6da54cc12f37f11586e8171546c7700d67
|
||||
|
||||
module.exports = { |
||||
before: function (browser, done) { |
||||
init(browser, done) |
||||
}, |
||||
'UploadToGists': function (browser) { |
||||
/* |
||||
- set the access token |
||||
- publish to gist |
||||
- retrieve the gist |
||||
- switch to a file in the new gist |
||||
*/ |
||||
console.log('token', process.env.gist_token) |
||||
browser |
||||
.waitForElementVisible('#icon-panel', 10000) |
||||
.clickLaunchIcon('settings') |
||||
.setValue('#gistaccesstoken', process.env.gist_token) |
||||
.click('#savegisttoken') |
||||
.clickLaunchIcon('fileExplorers') |
||||
.click('#publishToGist') |
||||
.modalFooterOKClick() |
||||
.getModalBody((value, done) => { |
||||
const reg = /gist.github.com\/([^.]+)/ |
||||
const id = value.match(reg) |
||||
console.log('gist regex', id) |
||||
if (!id) { |
||||
browser.assert.fail('cannot get the gist id', '', '') |
||||
} else { |
||||
let gistid = id[1] |
||||
browser |
||||
.modalFooterCancelClick() |
||||
.executeScript(`remix.loadgist('${gistid}')`) |
||||
.switchFile('browser/gists') |
||||
.switchFile(`browser/gists/${gistid}`) |
||||
.switchFile(`browser/gists/${gistid}/1_Storage.sol`) |
||||
.end() |
||||
} |
||||
}) |
||||
}, |
||||
tearDown: sauce |
||||
} |
Loading…
Reference in new issue