Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
weixin_46011646
wechaty
提交
3f7791ef
W
wechaty
项目概览
weixin_46011646
/
wechaty
与 Fork 源项目一致
Fork自
wechaty / wechaty
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
W
wechaty
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
3f7791ef
编写于
8月 26, 2017
作者:
Huan (李卓桓)
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support(switch account): try to click the button if found (#636)
上级
2aa39eb5
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
16 addition
and
17 deletion
+16
-17
src/puppet-web/bridge.ts
src/puppet-web/bridge.ts
+0
-4
src/puppet-web/puppet-web.ts
src/puppet-web/puppet-web.ts
+12
-12
test/puppet-web/puppet-web.spec.ts
test/puppet-web/puppet-web.spec.ts
+4
-1
未找到文件。
src/puppet-web/bridge.ts
浏览文件 @
3f7791ef
...
...
@@ -583,10 +583,6 @@ export class Bridge {
})
}
public
async
clickSwitchAccount
():
Promise
<
boolean
>
{
log
.
verbose
(
'
PuppetWebBridge
'
,
'
clickSwitchAccount()
'
)
return
this
.
puppet
.
browser
.
clickSwitchAccount
()
}
}
/* tslint:disable:jsdoc-format */
...
...
src/puppet-web/puppet-web.ts
浏览文件 @
3f7791ef
...
...
@@ -103,11 +103,11 @@ export class PuppetWeb extends Puppet {
await
this
.
initServer
()
log
.
verbose
(
'
PuppetWeb
'
,
'
initServer() done
'
)
await
this
.
initBrowser
()
this
.
browser
=
await
this
.
initBrowser
()
log
.
verbose
(
'
PuppetWeb
'
,
'
initBrowser() done
'
)
try
{
await
this
.
initBridge
()
this
.
bridge
=
await
this
.
initBridge
()
}
catch
(
e
)
{
const
blockedMessage
=
await
this
.
bridge
.
blockedMessageBody
()
||
await
this
.
bridge
.
blockedMessageAlert
()
...
...
@@ -119,7 +119,7 @@ export class PuppetWeb extends Puppet {
}
log
.
verbose
(
'
PuppetWeb
'
,
'
initBridge() done
'
)
const
clicked
=
await
this
.
br
idge
.
clickSwitchAccount
()
const
clicked
=
await
this
.
br
owser
.
clickSwitchAccount
()
if
(
clicked
)
{
log
.
verbose
(
'
PuppetWeb
'
,
'
init() bridge.clickSwitchAccount() clicked
'
)
}
...
...
@@ -230,15 +230,15 @@ export class PuppetWeb extends Puppet {
}
}
public
async
initBrowser
():
Promise
<
void
>
{
public
async
initBrowser
():
Promise
<
Browser
>
{
log
.
verbose
(
'
PuppetWeb
'
,
'
initBrowser()
'
)
this
.
browser
=
new
Browser
({
const
browser
=
new
Browser
({
head
:
<
HeadName
>
this
.
setting
.
head
,
sessionFile
:
this
.
setting
.
profile
,
})
this
.
browser
.
on
(
'
dead
'
,
Event
.
onBrowserDead
.
bind
(
this
))
browser
.
on
(
'
dead
'
,
Event
.
onBrowserDead
.
bind
(
this
))
if
(
this
.
state
.
target
()
===
'
dead
'
)
{
const
e
=
new
Error
(
'
found state.target()) != live, no init anymore
'
)
...
...
@@ -247,19 +247,19 @@ export class PuppetWeb extends Puppet {
}
try
{
await
this
.
browser
.
init
()
await
browser
.
init
()
}
catch
(
e
)
{
log
.
error
(
'
PuppetWeb
'
,
'
initBrowser() exception: %s
'
,
e
.
message
)
Raven
.
captureException
(
e
)
throw
e
}
return
return
browser
}
public
async
initBridge
():
Promise
<
void
>
{
public
async
initBridge
():
Promise
<
Bridge
>
{
log
.
verbose
(
'
PuppetWeb
'
,
'
initBridge()
'
)
this
.
bridge
=
new
Bridge
(
const
bridge
=
new
Bridge
(
this
,
// use puppet instead of browser, is because browser might change(die) duaring run time,
this
.
port
,
)
...
...
@@ -271,7 +271,7 @@ export class PuppetWeb extends Puppet {
}
try
{
await
this
.
bridge
.
init
()
await
bridge
.
init
()
}
catch
(
e
)
{
Raven
.
captureException
(
e
)
if
(
!
this
.
browser
)
{
...
...
@@ -284,7 +284,7 @@ export class PuppetWeb extends Puppet {
throw
e
}
}
return
return
bridge
}
private
async
initServer
():
Promise
<
void
>
{
...
...
test/puppet-web/puppet-web.spec.ts
浏览文件 @
3f7791ef
...
...
@@ -41,7 +41,10 @@ import {
*/
test
.
serial
(
'
login/logout events
'
,
async
t
=>
{
const
STUB_INIT_BROWSER
=
stub
(
PuppetWeb
.
prototype
,
'
initBrowser
'
)
STUB_INIT_BROWSER
.
resolves
()
STUB_INIT_BROWSER
.
resolves
({
clickSwitchAccount
:
()
=>
false
,
})
const
STUB_BRIDGE_INIT
=
stub
(
PuppetWebBridge
.
prototype
,
'
init
'
)
STUB_BRIDGE_INIT
.
resolves
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录