lundi 26 novembre 2018

Webdriver Selenium test passes but should fail

I'm working with Nodejs, Webdriverio, wdio.conf.js and tests.

When I'm running my tests like:

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

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

   });
 });

.. it passes... even though it should not (the header is wrong)

[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)

This is my 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...)
}

Why does my test pass? When it should not?.. It's like I can write anything and it will still pass..

Aucun commentaire:

Enregistrer un commentaire