Comments (6)
错误
global leak detected: getInterface
如何重现
- ff 较新版本
- 通过 iframe 打开 runner
demo 见:docs>bugs>firefox-getInterface.html
关联组件
基本所有组件
分析&解决
- iframe 中 ,window.getInterface 一开始是 undefined,在某个时间点/或某些操作触发后才会赋值
- 如果在测试脚本运行前进行一下 dom 操作,或者运行 alert 都可以避免这个问题
- 如果打开过一次firebug,那么在浏览器关闭之前都一直不会出错
getInterface 的官方文档没看懂,暂无最优解决方案。
解决见:https://github.com/fool2fish/mocha/commit/7364e2dfd384134c6e3240e424746dd73082699b
from totoro.
错误
global leak detected: 0
global leak detected: 1
如何重现
- ie6 , 7, 8, opera
- 页面插入 iframe
demo 见 docs>bugs>access-iframe-by-window[iframeIndex].html
关联组件
iframe-shim
分析和解决
所有浏览器都可以通过 window[iframeIndex] 访问页面内的 iframe,但只有 IE678 和 opera 会通过遍历获得键值,所以会报错。
解决见:https://github.com/fool2fish/mocha/commit/7364e2dfd384134c6e3240e424746dd73082699b
from totoro.
错误
- it.skip 会使多个浏览器卡死
- ie9 的测试报告缺失
如何重现
只要包含 skip 的用例都会出现此问题
分析和解决
经过测试发现在遇到 skip 的用例的时候, mocha 会发布 pending 和 test end 事件, 而在 thrill 中的 thrill-mocha-adapter.js 中输出报告的时候并没有订阅 pending 事件,而只是订阅了 test 和 test end . 他在 test 事件中会进行一部分内容初始化,而在 test end 的时候会用到这些信息。这就导致了在进行测试输出 test end 的时候缺少信息, 而报错
from totoro.
问题
配置了 mocha.globals([...]) 之后,测试代码运行会明显变慢,以 ie 和 opera 尤为明显
分析和解决
mocha 中的内存泄露检测代码本身效率不高,配置了 mocha.globals([...]) 之后,还对所有的测试用例都进行了内存泄露检测
解决方案:
- 对 Runner.prototype.checkGlobals() 进行修改,新增 this.prevGloblasLength,记录上一个 test 运行完成后全局变量的个数,再和本次进行对比,如无变化,则认为无需检测全局变量泄露的问题。(唯一的问题是,在本测试中,如果先删除了一个之前的全局变量,再添加了一个新的全局变量,则会检测不出来。但这种情况可以忽略。)
- 效率提升:以前有 n 个测试,就会进行 n 次检查,但现在只会对第一个测试和其他有泄露的测试进行检查
- 对 filterLeaks() 进行了改进,把一些操作从内层循环中放到外层循环,减少循环开销。
- 效率提升:执行时间约为原来的 50%
由于以上操作效果明显,所以对 filterLeaks() 的检测代码不再进行优化(虽然还有优化的空间)
解决见:https://github.com/fool2fish/mocha/commit/4573d1eabb7dd6d88e151ef06158737087750fff
和 @7362e4d 进行 diff 即可查看修改
from totoro.
问题
64位 win7 的 ie8 在运行测试时会内存溢出
分析
及时测试内部没有断言,甚至没有任何代码,在测试个数达到一定数量后就一定会报内存溢出。需要进一步查看 mocha 的实现。
from totoro.
问题
overlay,popup 等组件,在判定dom是否可见时,在ie7下得到的结果总是不可见。
分析和解决
queen 在 iframe 中运行 runner,原 iframe 是 0x0,即不可见,这导致在ie7(如果是其他类型的ui判断,如位置等,其他的ie也可能有问题)中不能准确判断
将iframe的尺寸改为 10x10 即解决
from totoro.
Related Issues (20)
- REAME中的npm install totoro应该加上-g
- 内部gitlab-ci上安装totoro运行后出错,可能和系统有关 HOT 1
- v1.0.0 totoro list 报[undefined/NaN] HOT 1
- 使用上的疑问 HOT 9
- Can not guess which adapter should be used, please choose one of "jasmine,mocha" or apply your own adapter. HOT 2
- node v0.11.x 发布后,socket.io 相关版本应更换为 v1.x
- 日志里能否增加上时间 HOT 3
- totoro --code 参数值的一致性 HOT 5
- Error 'Unknown encoding' HOT 1
- 启动server报错 HOT 4
- Timeout HOT 5
- TypeError: Cannot read property 'forEach' of undefined
- server成功启动后执行测试报服务器错误 HOT 2
- 对于没有设置 proxy,由 totoro 自动将 proxy 设为 false 时,需要给出提示
- totoro 服务是否可以作为 selenium 服务来用 HOT 1
- totorojs和karma的定位以及区别? HOT 5
- http://totorojs.org/ 域名过期 HOT 1
- 阿里巴巴内部还在用totoro来做测试吗? HOT 2
- 请问使用totoro可以生成html格式的测试报告吗? HOT 1
- 请问现在这个项目还有人维护吗?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from totoro.