自动化 UI 测试工具:Viff
Viff 测试框架,它可以不同环境(developing, staging, production)和浏览器下的 Web 页面的视觉差异。
示例
Checkout viff-examples repository for more examples, including:
- Tiny CSS difference
- Chart difference
- Content difference
- Partial difference
- Event Handling
- Responsive
- Multiple browsers
- Multiple Environments
- Browserstack
- Programmable
- Using Viff Server (beta)
示例代码:
var Viff = require('viff');var viff = new Viff('http://localhost:4444/wd/hub'); viff.takeScreenshot('firefox', 'http://localhost:3000', '/path1', function (bufferImg) { /* buffer of images */ }); // partial of web pages viff.takeScreenshot('firefox', 'http://localhost:3000', ['path1', '#css-selecor'], function (bufferPartialImg) {}); // responsive of web pages function size(width) { return function (driver) { driver.setWindowSize(width, 600 /* any height*/); }; } viff.takeScreenshot('firefox', 'http://localhost:3000', ['path', size(1024)], function (bufferImg) {}); // Q promiseviff.takeScreenshot('firefox', 'http://localhost:3000', ['path', size(1024)]) .done(function (bufferImg) { /* generate image here */ }) .catch(function (err) { /* handle err here */ }) // using browser stackviff = new Viff('http://hub.browserstack.com/wd/hub'); viff.takeScreenshot({ 'browserName' : 'iPhone', 'platform' : 'MAC', 'device' : 'iPhone 5', 'browserstack.user': /* your name */, 'browserstack.key': /* your key */}, 'http://www.google.com', 'path1', function (bufferImg) {});
本文由用户 jopen 自行上传分享,仅供网友学习交流。所有权归原作者,若您的权利被侵害,请联系管理员。
转载本站原创文章,请注明出处,并保留原始链接、图片水印。
本站是一个以用户分享为主的开源技术平台,欢迎各类分享!