• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • 前端自動化測試解決方案探析(10)

    發表于:2016-11-23來源:ouven作者:ouven點擊數: 標簽:前端
    http://casperjs.org/ Nightmare。 類似的,nightmare也是一個模擬還原瀏覽器上業務操作的強大工具,而且更易于使用。同時可以使用chrome的插件daydreem自動錄制生成

    http://casperjs.org/

    • Nightmare。

      類似的,nightmare也是一個模擬還原瀏覽器上業務操作的強大工具,而且更易于使用。同時可以使用chrome的插件daydreem自動錄制生成用戶行為操作的事件序列,更加方便我們進行實際的測試。

    yield Nightmare()
        .goto('http://yahoo.com')
        .type('input[title="Search"]', 'github nightmare')
        .click('.searchsubmit');
    
    

      Nightmare也支持異步操作,并支持多種斷言庫,這里結合chai.js就可以這樣來使用。

    var Nightmare = require('nightmare');
    var expect = require('chai').expect; // jshint ignore:line
    
    describe('test yahoo search results', function() {
        it('should find the nightmare github link first', function(done) {
        var nightmare = Nightmare()
        nightmare
          .goto('http://yahoo.com')
          .type('form[action*="/search"] [name=p]', 'github nightmare')
          .click('form[action*="/search"] [type=submit]')
          .wait('#main')
          .evaluate(function () {
            return document.querySelector('#main .searchCenterMiddle li a').href
          })
          .end()
          .then(function(link) {
            expect(link).to.equal('https://github.com/segmentio/nightmare');
            done();
          })
      });
    });
    

    原文轉自:http://jixianqianduan.com/frontend-javascript/2016/11/22/front-end-auto-test.html

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>