How to use Soft assertion

I would like to use soft assertion in CodeceptJS as like in TestNG. Because currently I am using I.dontSeeInTitle(“Page missing”) and I.dontSee("") Whenever my page encounters issue my execution stopped in the middle, but I need to continue my execution until the end even though it encounters the assertion but it should record the report.

@ShyamN CodeceptJS currently does not support soft assertions, sorry.

well, you can try I.grabNumberOfVisibleElements to see if element is there. That won’t stop the tests.

Thanks for your reply @paulb and @peterngtr. let me try to verify the assertion through conditional statements, I need to try how to write the customized message with snapshots in allure report

@ShyamN keep us updated :slight_smile:

Hi @ShyamN, You can try using chai assertion library and assert the values. By that way you can catch the assertion error and implement your soft assert codes that you have to attach to your report.

Soft assertion in e2e is a flawed concept, imo. The better solution is simply using a full fledged test (scenario) to check what you would want with this assertion. But that’s also not an option because Codecepjs won’t allow you do to several tests in one go (in the same window), as far as I know =(.

You can try using soft-assert library

@ ShyamN After version 3.0.0 you may use tryTo.