【问题标题】:Webdriver Selenium test passes but should failWebdriver Selenium 测试通过但应该失败
【发布时间】:2018-11-26 16:08:53
【问题描述】:

我正在使用 Nodejs、Webdriverio、wdio.conf.js 和测试。

当我运行我的测试时:

describe('Admin Interface', function() {
  it('should have the correct header title', function *() {

    var header = yield browser.getText('h1');
    header.should.be.equal('blahblah');

   });
 });

..它通过了...即使它不应该(标题错误)

[Chrome 48.0 Windows 10 #0-0] Running: Chrome (v48.0) on Windows 10
[Chrome 48.0 Windows 10 #0-0]
[Chrome 48.0 Windows 10 #0-0] Admin Interface
[Chrome 48.0 Windows 10 #0-0]   √ should have the window title based on user 
settings
[Chrome 48.0 Windows 10 #0-0]   √ should have the correct header title
[Chrome 48.0 Windows 10 #0-0] 2 passing (3s)

这是我的 wdio.conf.js

exports.config = {
  specs: [
    './test/views/admin/**.test.js',
],
 capabilities: [{
    browserName: 'Chrome',
    browser_version: '48.0',
    os: 'Windows',
    os_version: '10',
    resolution: '1024x768',
    'browserstack.local': true,
    'browserstack.debug': true
}],
 baseUrl: 'http://localhost:5000',
 (and some more...)
}

为什么我的测试通过了?什么时候不应该?... 就像我可以写任何东西,它仍然会通过..

【问题讨论】:

    标签: node.js selenium testing selenium-webdriver webdriver


    【解决方案1】:

    当我删除产量和功能时它可以工作 *

    describe('Admin Interface', function() {
     it('should have the correct header title', function () {
    
       var header = browser.getText('h1');
       header.should.be.equal('blahblah');
    
      });
    });
    

    现在测试失败

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-04-29
      • 1970-01-01
      相关资源
      最近更新 更多