Glad you enjoyed the content. We have created multiple courses that takes our students from ground level. If you want to become a full stack Automation engineer, Please check out the academy at: sdetunicorns.com/courses/
@playandfun7446
4 жыл бұрын
Hi, I made this changes in my wdio.conf.js so that chai assertion can be assessed from anywhere without importing it. May be it can help others. ----------- beforeTest: function () { const chai = require("chai"); const chaiWebdriver = require("chai-webdriverio").default; chai.use(chaiWebdriver(browser)); global.chaiAssert = chai.assert; global.chaiShould = chai.should; global.chaiExpect = chai.expect; }, ------------------------
@sdetunicorns
4 жыл бұрын
Yes, this takes away the pain of importing it everywhere. Thanks for commenting!
@atuljadhav5566
2 жыл бұрын
Hi Dilpreet, I am still facing an issue with script run. I have setup the configuration and chai assertation and babel. I have also added require: ['@babel/register'] in config file but I am getting below error. Could you please suggest the possible root cause of this? import { expect as chaiExpect } from 'chai'; [0-0] ^^^^^^ [0-0] [0-0] SyntaxError: Cannot use import statement outside a module
@sdetunicorns
2 жыл бұрын
You will need to install all the babel packages as well. Take a look at this - webdriver.io/docs/babel/
@ushad2263
4 жыл бұрын
Hi , How do I continue tests execution after assertion fails. Do we have something like soft assertion ( Selenium webdriver) in webdriverio?
@sdetunicorns
4 жыл бұрын
No, WebdriverIO does not support soft assertions and is also not recommended. If you still need it, you can wrap the code around try/catch.
@pankajpatil9232
3 жыл бұрын
If I want to print my own error message if assertion fails.. then is there any way.. something like assert(expected, actual, error message) ?
@sdetunicorns
3 жыл бұрын
Most of the default assertions with WebdriverIO has options to add your own error message. You can take a look at an example here - webdriver.io/docs/api/expect-webdriverio#tohaveelementclass
Пікірлер: 12