@@ -68,10 +68,33 @@ beforeAll(async () => {
68
68
expect .extend (matchers as Record <string , any >);
69
69
});
70
70
```
71
- For the soft assertion, it needs to expose the ` createSoftExpect ` first.
72
71
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
+ ```
73
96
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 ` :
75
98
``` ts
76
99
describe (' My tests' , async () => {
77
100
0 commit comments