Why doesn't expect work after a button click?

28 views
Skip to first unread message

Rich Williams

unread,
Jan 20, 2021, 1:35:15 PMJan 20
to Chai.js
I'm completely lost as to why this doesn't work.  If I move the expect before the button click the expect fails as expected, but if the expect is after the click it takes a while for a failure and the error says the button can't be found.  

Not my actual code, but an example that repros what I'm seeing


const { expect } = require('chai');

module.exports = {

functionName: function() {
it('functionName: expect does not work', async function() {

var drawerState = ''

//wait for the credits icon to be displayed the header
const $button = await this.app.client.$(buttonPath)
await $button.waitForExist({timeout:50000})

//expect(true).to.equal(false);    //this tells me true doesn't equal false
await $button.click();

expect(true).to.equal(false);  //this tells me that the button path can't be found

});
},

}
Reply all
Reply to author
Forward
0 new messages