remix-project mirror
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
remix-project/test-browser/commands/switchBrowserWindow.js

25 lines
622 B

const EventEmitter = require('events')
class SwitchBrowserWindow extends EventEmitter {
command (url, windowName) {
this.api.perform((done) => {
switchWindow(this.api, url, windowName, () => {
done()
this.emit('complete')
})
})
return this
}
}
function switchWindow (browser, url, windowName, callback) {
browser.execute(function (url, windowName) {
window.open(url, windowName, 'width=2560, height=1440')
}, [url, windowName], function () {
browser.switchWindow(windowName)
.assert.urlContains(url)
callback()
})
}
module.exports = SwitchBrowserWindow