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

code clean

上级 33a687f4
此差异已折叠。
......@@ -759,15 +759,4 @@ export class Contact implements Sayable {
}
// Contact.search = function(options) {
// if (options.name) {
// const regex = new RegExp(options.name)
// return Object.keys(Contact.pool)
// .filter(k => regex.test(Contact.pool[k].name()))
// .map(k => Contact.pool[k])
// }
// return []
// }
export default Contact
......@@ -16,7 +16,7 @@
* limitations under the License.
*
*/
import { test } from 'ava'
import { test } from 'ava'
import {
config,
......
......@@ -122,11 +122,13 @@ export class BrowserCookie {
}
try {
// `as any as DriverCookie` because selenium-webdriver @types is outdated with 2.x, where we r using 3.0
let cookies: IWebDriverOptionsCookie[] = await this.driver.manage().getCookies()
console.log(cookies)
cookies = cookieFilter(cookies)
// log.silly('PuppetWeb', 'saving %d cookies for session: %s', cookies.length
// , util.inspect(cookies.map(c => { return {name: c.name /*, value: c.value, expiresType: typeof c.expires, expires: c.expires*/} })))
// log.silly('PuppetWebBrowserCookie', 'save() saving %d cookies for session: %s', cookies.length
// , require('util').inspect(cookies.map(c => { return {name: c.name, value: c.value, expiresType: typeof c.expiry, expiry: c.expiry} })))
log.silly('PuppetWebBrowserCookie', 'save() saving %d cookies: %s', cookies.length, cookies.map(c => c.name).join(','))
const jsonStr = JSON.stringify(cookies)
......@@ -239,8 +241,9 @@ export class BrowserCookie {
public async add(cookie: IWebDriverOptionsCookie | IWebDriverOptionsCookie[]): Promise<void> {
if (Array.isArray(cookie)) {
log.verbose('PuppetWebBrowserCookie', 'add(Array: %s)', JSON.stringify(cookie))
for (const c of cookie) {
const cookieList = cookie
log.verbose('PuppetWebBrowserCookie', 'add(Array.length = %d)', cookieList.length)
for (const c of cookieList) {
await this.add(c)
}
return
......
......@@ -519,4 +519,8 @@ export class Browser extends EventEmitter {
public cleanCookie() { return this.cookie.clean() }
}
export {
IWebDriverOptionsCookie,
}
export default Browser
......@@ -16,14 +16,20 @@
* limitations under the License.
*
*/
export { Bridge } from './bridge'
export { Browser } from './browser'
export { Event } from './event'
export { PuppetWebFriendRequest as FriendRequest } from './friend-request'
export { Bridge } from './bridge'
export {
Browser,
IWebDriverOptionsCookie,
} from './browser'
export { Event } from './event'
export {
PuppetWebFriendRequest as FriendRequest,
} from './friend-request'
import { PuppetWeb } from './puppet-web'
export { Server } from './server'
export { Watchdog } from './watchdog'
export { Server } from './server'
export { Watchdog } from './watchdog'
import PuppetWeb from './puppet-web'
export { PuppetWeb }
export default PuppetWeb
export {
PuppetWeb,
}
......@@ -16,14 +16,14 @@
* limitations under the License.
*
*/
import { test } from 'ava'
import { test } from 'ava'
import {
config,
log,
} from '../../src/config'
import PuppetWeb from '../../src/puppet-web'
import PuppetWebServer from '../../src/puppet-web/server'
} from '../../src/config'
import PuppetWeb from '../../src/puppet-web'
import PuppetWebServer from '../../src/puppet-web/server'
/**
* the reason why use `test.serial` here is:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册