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

quit webdriver after unite test

......@@ -15,7 +15,7 @@ const co = require('co')
const ApiAi = require('apiai')
const EventEmitter2 = require('eventemitter2')
const Wechaty = require('../src/wechaty')
const Wechaty = require('..')
//log.level = 'verbose'
// log.level = 'silly'
......@@ -27,7 +27,7 @@ const Wechaty = require('../src/wechaty')
const APIAI_API_KEY = '7217d7bce18c4bcfbe04ba7bdfaf9c08'
const brainApiAi = ApiAi(APIAI_API_KEY)
const bot = new Wechaty({head: false})
const bot = new Wechaty({ session: 'example-bot.wechaty.json' })
console.log(`
Welcome to api.AI Wechaty Bot.
......
const log = require('npmlog')
const Wechaty = require('../src/wechaty')
const Wechaty = require('..')
const welcome = `
| __ __ _ _
......@@ -26,7 +26,7 @@ Please wait... I'm trying to login in...
`
console.log(welcome)
const bot = new Wechaty({ session: 'example.wechaty.json' })
const bot = new Wechaty({ session: 'example-bot.wechaty.json' })
bot
.on('login' , user => log.info('Bot', `${user.name()} logined`))
......
const Wechaty = require('..')
const bot = new Wechaty({ session: 'example.wechaty.json' })
const bot = new Wechaty({ session: 'example-bot.wechaty.json' })
bot
.on('scan', ({url, code}) => {
......
const Wechaty = require('..')
const bot = new Wechaty()
const bot = new Wechaty(/* no session name here */)
bot
.on('scan', ({url, code}) => {
......
......@@ -15,7 +15,7 @@ const co = require('co')
const Tuling123 = require('tuling123-client')
const EventEmitter2 = require('eventemitter2')
const Wechaty = require('../src/wechaty')
const Wechaty = require('..')
//log.level = 'verbose'
// log.level = 'silly'
......@@ -28,7 +28,7 @@ const Wechaty = require('../src/wechaty')
const TULING123_API_KEY = '18f25157e0446df58ade098479f74b21'
const brain = new Tuling123(TULING123_API_KEY)
const bot = new Wechaty({head: false})
const bot = new Wechaty({ session: 'example-bot.wechaty.json' })
console.log(`
Welcome to Tuling Wechaty Bot.
......
......@@ -250,6 +250,30 @@ e.getMsgVideo = function(e) {
return u.API_webwxgetvideo + "?msgid=" + e + "&skey=" + encodeURIComponent(c.getSkey())
}
<div class="picture"
ng-init="imageInit(message,message.MMPreviewSrc || message.MMThumbSrc || getMsgImg(message.MsgId,'slave'))">
<img class="msg-img" ng-style="message.MMImgStyle" ng-click="previewImg(message)"
ng-src="/cgi-bin/mmwebwx-bin/webwxgetmsgimg?&amp;MsgID=6944236226252183282&amp;skey=%40crypt_c117402d_2b2a8c58340c8f4b0a4570cb8f11a1e8&amp;type=slave"
src="/cgi-bin/mmwebwx-bin/webwxgetmsgimg?&amp;MsgID=6944236226252183282&amp;skey=%40crypt_c117402d_2b2a8c58340c8f4b0a4570cb8f11a1e8&amp;type=slave"
style="height: 100px; width: 75px;">
XMLHttpRequestOrig = XMLHttpRequest
XMLHttpRequest = function() { return new XMLHttpRequestOrig() }
*
.web_wechat_tab_launch-chat
contentChatController
e.getMsgImg = function(e, t, o) {
return o && "undefined" != typeof o.MMStatus && o.MMStatus != u.MSG_SEND_STATUS_SUCC ? void 0 : u.API_webwxgetmsgimg + "?&MsgID=" + e + "&skey=" + encodeURIComponent(c.getSkey()) + (t ? "&type=" + t : "")
}
,
e.getMsgVideo = function(e) {
return u.API_webwxgetvideo + "?msgid=" + e + "&skey=" + encodeURIComponent(c.getSkey())
}
<div class="picture"
ng-init="imageInit(message,message.MMPreviewSrc || message.MMThumbSrc || getMsgImg(message.MsgId,'slave'))">
<img class="msg-img" ng-style="message.MMImgStyle" ng-click="previewImg(message)"
......
......@@ -247,16 +247,42 @@ return (function(port) {
function glueToAngular() {
var injector = angular.element(document).injector()
var http = injector.get('$http')
var accountFactory = injector.get('accountFactory')
var appFactory = injector.get('appFactory')
var chatFactory = injector.get('chatFactory')
var confFactory = injector.get('confFactory')
var contactFactory = injector.get('contactFactory')
var confFactory = injector.get('confFactory')
var http = injector.get('$http')
var mmHttp = injector.get('mmHttp')
var rootScope = injector.get('$rootScope')
var appScope = angular.element('[ng-controller="appController"]').scope()
var rootScope = injector.get('$rootScope')
var loginScope = angular.element('[ng-controller="loginController"]').scope()
/*
// method 1
appFactory.syncOrig = appFactory.sync
appFactory.syncCheckOrig = appFactory.syncCheck
appFactory.sync = function() { Wechaty.log('appFactory.sync() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); return appFactory.syncOrig(arguments) }
appFactory.syncCheck = function() { Wechaty.log('appFactory.syncCheck() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); return appFactory.syncCheckOrig(arguments) }
// method 2
$.ajaxOrig = $.ajax
$.ajax = function() { Wechaty.log('$.ajax() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); return $.ajaxOrig(arguments) }
$.ajax({
url: "https://wx.qq.com/zh_CN/htmledition/v2/images/webwxgeticon.jpg"
, type: "GET"
}).done(function (response) {
alert("success");
})
// method 3 - mmHttp
mmHttp.getOrig = mmHttp.get
mmHttp.get = function() { Wechaty.log('mmHttp.get() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!'); return mmHttp.getOrig(arguments) }
*/
/**
* generate $scope with a contoller (as it is not assigned in html staticly)
* https://github.com/angular/angular.js/blob/a4e60cb6970d8b6fa9e0af4b9f881ee3ba7fdc99/test/ng/controllerSpec.js#L24
......
......@@ -121,8 +121,8 @@ class PuppetWeb extends Puppet {
this.browser.on('dead', this.onBrowserDead.bind(this))
// fastUrl is used to open in browser for we can set cookies.
const fastUrl = 'https://res.wx.qq.com/zh_CN/htmledition/v2/images/icon/ico_loading28a2f7.gif'
// const fastUrl = 'https://t.qq.com' // domain??? ssl ca name not match
// backup: 'https://res.wx.qq.com/zh_CN/htmledition/v2/images/icon/ico_loading28a2f7.gif'
const fastUrl = 'https://wx.qq.com/zh_CN/htmledition/v2/images/webwxgeticon.jpg'
return co.call(this, function* () {
yield this.browser.init()
......
......@@ -138,7 +138,10 @@ test('Puppet Web watchdog timer', function(t) {
.catch(e => { // Exception
t.fail('co exception: ' + e.message)
})
.then(t.end) // Finally
.then(() => { // Finally
pw.quit()
.then(t.end)
})
return
/////////////////////////////////////////////////////////////////////////////
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册