@@ -68,10 +68,33 @@ beforeAll(async () => {
6868 expect .extend (matchers as Record <string , any >);
6969});
7070```
71- For the soft assertion, it needs to expose the ` createSoftExpect ` first.
7271
72+ For the soft assertion, the ` createSoftExpect ` is currently not correctly exposed but the below works:
73+ ``` ts
74+ // @ts-ignore
75+ import * as createSoftExpect from " expect-webdriverio/lib/softExpect" ;
76+
77+ beforeAll (async () => {
78+ Object .defineProperty (expect , " soft" , {
79+ value : <T = unknown >(actual : T ) => createSoftExpect .default (actual ),
80+ });
81+
82+ // Add soft assertions utility methods
83+ Object .defineProperty (expect , " getSoftFailures" , {
84+ value : (testId ? : string ) => SoftAssertService .getInstance ().getFailures (testId ),
85+ });
86+
87+ Object .defineProperty (expect , " assertSoftFailures" , {
88+ value : (testId ? : string ) => SoftAssertService .getInstance ().assertNoFailures (testId ),
89+ });
90+
91+ Object .defineProperty (expect , " clearSoftFailures" , {
92+ value : (testId ? : string ) => SoftAssertService .getInstance ().clearFailures (testId ),
93+ });
94+ });
95+ ```
7396
74- As shown below, no imports are required and we can use WDIO matchers directly on Jest's ` expect ` :
97+ Then as shown below, no imports are required and we can use WDIO matchers directly on Jest's ` expect ` :
7598``` ts
7699describe (' My tests' , async () => {
77100
0 commit comments