我正在使用 chai 4.2.0 并且没有按预期工作,这就是示例。
收到这个 TypeError:expect is not a function
并想知道为什么我使用的是全局变量。
var chai = require('chai');
var expect = chai.expect;
describe("Homepage FAQ Accordion", function () {
beforeEach(function() {
console.log(expect.expect);
browser.url('http://127.0.0.1:8303/');
})
it("should show first section on page load", function() {
var firstHeight = browser.getCssProperty(".accordion .accordion-item:first-child .accordion-content", "height");
var firstHeight = browser.getTitle();
console.log(firstHeight);
expect(firstHeight.parsed.value).to.be.greaterThan(0);
})
it("should not show other content", function() {
var secondHeight = browser.getCssProperty(".accordion .accordion-item:nth-of-type(2) .accordion-content", "Display")
console.log(secondDisplay);
expect(secondDisplay.parsed.value).to.equal(none);
})
})