目前在 Mocha、Chai 和 Chai-as-Promised 中使用 Webdriver.io 但是我在尝试验证 CSS 属性时很难获得验证的承诺:
编码:
'use strict';
var chai = require('chai'),
chaiAsPromised = require('chai-as-promised');
chai.use(chaiAsPromised);
chai.should();
chaiAsPromised.transferPromiseness = browser.transferPromiseness;
describe('Buttons', function() {
var buttonSelector = '.button';
browser.url('http://localhost/buttons.html');
it('should have square corners by default', function (done) {
browser
.getCssProperty(buttonSelector, 'border-top-left-radius').should.eventually.become('0px')
.call(done);
});
});
但是我收到此错误:
默认按钮:小尺寸 1) 默认情况下应该有方角 1 失败
1)默认按钮:Tiny Size 默认应该有方角:Uncaught AssertionError: expected { Object (property, value, ...) } to deep equal '0px' 0 pass (2s) at assertEqual (/node_modules/chai/lib /chai/core/assertions.js:393:19)
at ctx.(anonymous function) (/node_modules/chai/lib/chai/utils/addMethod.js:40:25) at WebdriverIO.<anonymous> (/node_modules/chai-as-promised/lib/chai-as-promised.js:302:26) at /node_modules/webdriverio/lib/utils/PromiseHandler.js:85:52 at process._tickCallback (node.js:419:13)