提交 890137bc 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix ci with browser.open() & hostname

上级 bebce38a
......@@ -118,6 +118,10 @@ export class Browser extends EventEmitter {
public async open(url: string = `https://${this.hostname}`): Promise<void> {
log.verbose('PuppetWebBrowser', `open(${url})`)
if (!this.hostname) {
throw new Error('hostname unknown')
}
// TODO: set a timer to guard driver.get timeout, then retry 3 times 201607
try {
await this.driver.get(url)
......
......@@ -25,10 +25,12 @@ test('Cookie smoking test', async t => {
t.truthy(browser, 'should instanciate a browser instance')
browser.state.target('open')
browser.hostname = 'wx.qq.com'
await browser.driver.init()
t.pass('should init driver')
await browser.open('https://wx.qq.com')
await browser.open()
t.pass('should opened')
browser.state.current('open')
......@@ -100,6 +102,7 @@ test('Cookie save/load', async t => {
t.truthy(browser, 'should get a new Browser')
browser.state.target('open')
browser.hostname = 'wx.qq.com'
await browser.driver.init()
t.pass('should init driver')
......@@ -169,6 +172,7 @@ test('Cookie save/load', async t => {
t.pass('should started a new Browser')
browser.state.target('open')
browser.hostname = 'wx.qq.com'
await browser.driver.init()
t.pass('should inited the new Browser')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册