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

code clean

上级 b60d6ebb
......@@ -54,8 +54,7 @@ class Browser extends EventEmitter {
})
}
open(url) {
url = url || 'https://wx.qq.com'
open(url = 'https://wx.qq.com') {
log.verbose('PuppetWebBrowser', `open(${url})`)
// TODO: set a timer to guard driver.get timeout, then retry 3 times 201607
......@@ -324,7 +323,7 @@ this.onResourceRequested = function(request, net) {
*/
// if (cookie.expiry) { cookie.expiry = cookie.expiry * 1000 /* XXX: be aware of new version of webdriver */}
log.silly('PuppetWebBrowser', 'addCookies("%s")', JSON.stringify(cookie))
log.silly('PuppetWebBrowser', 'addCookies(%s)', JSON.stringify(cookie))
return this.driver.manage()
// this is old webdriver format
......
......@@ -60,6 +60,7 @@ test('Browser class cookie smoking tests', async t => {
const cookies0 = cookies.filter(c => { return RegExp(EXPECTED_COOKIES[0].name).test(c.name) })
t.is(cookies0[0].name, EXPECTED_COOKIES[0].name, 'getCookies() should filter out the cookie named wechaty0')
const cookies1 = cookies.filter(c => { return RegExp(EXPECTED_COOKIES[1].name).test(c.name) })
t.truthy(cookies1, 'should get cookies1')
t.is(cookies1[0].name, EXPECTED_COOKIES[1].name, 'getCookies() should filter out the cookie named wechaty1')
await b.open()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册