为什么我继续收到此TypeError:Expect不是函数

时间:2020-02-11 22:23:27

标签: javascript chai wdio-v4

我正在使用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);

    })
})

0 个答案:

没有答案