|
| 1 | +--- |
| 2 | +permalink: /helpers/Expect |
| 3 | +editLink: false |
| 4 | +sidebar: auto |
| 5 | +title: Expect |
| 6 | +--- |
| 7 | + |
| 8 | +<!-- Generated by documentation.js. Update this documentation by updating the source code. --> |
| 9 | + |
| 10 | +## ExpectHelper |
| 11 | + |
| 12 | +This helper allows performing assertions based on Chai. |
| 13 | + |
| 14 | +### Examples |
| 15 | + |
| 16 | +Zero-configuration when paired with other helpers like REST, Playwright: |
| 17 | + |
| 18 | +```js |
| 19 | +// inside codecept.conf.js |
| 20 | +{ |
| 21 | + helpers: { |
| 22 | + Playwright: {...}, |
| 23 | + ExpectHelper: {}, |
| 24 | + } |
| 25 | +} |
| 26 | +``` |
| 27 | + |
| 28 | +## Methods |
| 29 | + |
| 30 | +### expectAbove |
| 31 | + |
| 32 | +#### Parameters |
| 33 | + |
| 34 | +- `targetData` **any** |
| 35 | +- `aboveThan` **any** number | Date |
| 36 | +- `customErrorMsg` **any** |
| 37 | + |
| 38 | +### expectBelow |
| 39 | + |
| 40 | +#### Parameters |
| 41 | + |
| 42 | +- `targetData` **any** |
| 43 | +- `belowThan` **any** number | Date |
| 44 | +- `customErrorMsg` **any** |
| 45 | + |
| 46 | +### expectContain |
| 47 | + |
| 48 | +#### Parameters |
| 49 | + |
| 50 | +- `actualValue` **any** |
| 51 | +- `expectedValueToContain` **any** |
| 52 | +- `customErrorMsg` **any** |
| 53 | + |
| 54 | +### expectDeepEqual |
| 55 | + |
| 56 | +#### Parameters |
| 57 | + |
| 58 | +- `actualValue` **any** |
| 59 | +- `expectedValue` **any** |
| 60 | +- `customErrorMsg` **any** |
| 61 | + |
| 62 | +### expectDeepEqualExcluding |
| 63 | + |
| 64 | +expects members of two JSON objects are deeply equal excluding some properties |
| 65 | + |
| 66 | +#### Parameters |
| 67 | + |
| 68 | +- `actualValue` **any** |
| 69 | +- `expectedValue` **any** |
| 70 | +- `fieldsToExclude` **any** |
| 71 | +- `customErrorMsg` **any** |
| 72 | + |
| 73 | +### expectDeepIncludeMembers |
| 74 | + |
| 75 | +expects an array to be a superset of another array |
| 76 | + |
| 77 | +#### Parameters |
| 78 | + |
| 79 | +- `superset` **any** |
| 80 | +- `set` **any** |
| 81 | +- `customErrorMsg` **any** |
| 82 | + |
| 83 | +### expectDeepMembers |
| 84 | + |
| 85 | +expects members of two arrays are deeply equal |
| 86 | + |
| 87 | +#### Parameters |
| 88 | + |
| 89 | +- `actualValue` **any** |
| 90 | +- `expectedValue` **any** |
| 91 | +- `customErrorMsg` **any** |
| 92 | + |
| 93 | +### expectEmpty |
| 94 | + |
| 95 | +#### Parameters |
| 96 | + |
| 97 | +- `targetData` **any** |
| 98 | +- `customErrorMsg` **any** |
| 99 | + |
| 100 | +### expectEndsWith |
| 101 | + |
| 102 | +#### Parameters |
| 103 | + |
| 104 | +- `actualValue` **any** |
| 105 | +- `expectedValueToEndWith` **any** |
| 106 | +- `customErrorMsg` **any** |
| 107 | + |
| 108 | +### expectEqual |
| 109 | + |
| 110 | +#### Parameters |
| 111 | + |
| 112 | +- `actualValue` **any** |
| 113 | +- `expectedValue` **any** |
| 114 | +- `customErrorMsg` **any** |
| 115 | + |
| 116 | +### expectEqualIgnoreCase |
| 117 | + |
| 118 | +#### Parameters |
| 119 | + |
| 120 | +- `actualValue` **any** |
| 121 | +- `expectedValue` **any** |
| 122 | +- `customErrorMsg` **any** |
| 123 | + |
| 124 | +### expectFalse |
| 125 | + |
| 126 | +#### Parameters |
| 127 | + |
| 128 | +- `targetData` **any** |
| 129 | +- `customErrorMsg` **any** |
| 130 | + |
| 131 | +### expectHasAProperty |
| 132 | + |
| 133 | +#### Parameters |
| 134 | + |
| 135 | +- `targetData` **any** |
| 136 | +- `propertyName` **any** |
| 137 | +- `customErrorMsg` **any** |
| 138 | + |
| 139 | +### expectHasProperty |
| 140 | + |
| 141 | +#### Parameters |
| 142 | + |
| 143 | +- `targetData` **any** |
| 144 | +- `propertyName` **any** |
| 145 | +- `customErrorMsg` **any** |
| 146 | + |
| 147 | +### expectJsonSchema |
| 148 | + |
| 149 | +#### Parameters |
| 150 | + |
| 151 | +- `targetData` **any** |
| 152 | +- `jsonSchema` **any** |
| 153 | +- `customErrorMsg` **any** |
| 154 | + |
| 155 | +### expectJsonSchemaUsingAJV |
| 156 | + |
| 157 | +#### Parameters |
| 158 | + |
| 159 | +- `targetData` **any** |
| 160 | +- `jsonSchema` **any** |
| 161 | +- `customErrorMsg` **any** |
| 162 | +- `ajvOptions` **any** Pass AJV options |
| 163 | + |
| 164 | +### expectLengthAboveThan |
| 165 | + |
| 166 | +#### Parameters |
| 167 | + |
| 168 | +- `targetData` **any** |
| 169 | +- `lengthAboveThan` **any** |
| 170 | +- `customErrorMsg` **any** |
| 171 | + |
| 172 | +### expectLengthBelowThan |
| 173 | + |
| 174 | +#### Parameters |
| 175 | + |
| 176 | +- `targetData` **any** |
| 177 | +- `lengthBelowThan` **any** |
| 178 | +- `customErrorMsg` **any** |
| 179 | + |
| 180 | +### expectLengthOf |
| 181 | + |
| 182 | +#### Parameters |
| 183 | + |
| 184 | +- `targetData` **any** |
| 185 | +- `length` **any** |
| 186 | +- `customErrorMsg` **any** |
| 187 | + |
| 188 | +### expectMatchesPattern |
| 189 | + |
| 190 | +expects a JSON object matches a provided pattern |
| 191 | + |
| 192 | +#### Parameters |
| 193 | + |
| 194 | +- `actualValue` **any** |
| 195 | +- `expectedPattern` **any** |
| 196 | +- `customErrorMsg` **any** |
| 197 | + |
| 198 | +### expectMatchRegex |
| 199 | + |
| 200 | +#### Parameters |
| 201 | + |
| 202 | +- `targetData` **any** |
| 203 | +- `regex` **any** |
| 204 | +- `customErrorMsg` **any** |
| 205 | + |
| 206 | +### expectNotContain |
| 207 | + |
| 208 | +#### Parameters |
| 209 | + |
| 210 | +- `actualValue` **any** |
| 211 | +- `expectedValueToNotContain` **any** |
| 212 | +- `customErrorMsg` **any** |
| 213 | + |
| 214 | +### expectNotDeepEqual |
| 215 | + |
| 216 | +#### Parameters |
| 217 | + |
| 218 | +- `actualValue` **any** |
| 219 | +- `expectedValue` **any** |
| 220 | +- `customErrorMsg` **any** |
| 221 | + |
| 222 | +### expectNotEndsWith |
| 223 | + |
| 224 | +#### Parameters |
| 225 | + |
| 226 | +- `actualValue` **any** |
| 227 | +- `expectedValueToNotEndWith` **any** |
| 228 | +- `customErrorMsg` **any** |
| 229 | + |
| 230 | +### expectNotEqual |
| 231 | + |
| 232 | +#### Parameters |
| 233 | + |
| 234 | +- `actualValue` **any** |
| 235 | +- `expectedValue` **any** |
| 236 | +- `customErrorMsg` **any** |
| 237 | + |
| 238 | +### expectNotStartsWith |
| 239 | + |
| 240 | +#### Parameters |
| 241 | + |
| 242 | +- `actualValue` **any** |
| 243 | +- `expectedValueToNotStartWith` **any** |
| 244 | +- `customErrorMsg` **any** |
| 245 | + |
| 246 | +### expectStartsWith |
| 247 | + |
| 248 | +#### Parameters |
| 249 | + |
| 250 | +- `actualValue` **any** |
| 251 | +- `expectedValueToStartWith` **any** |
| 252 | +- `customErrorMsg` **any** |
| 253 | + |
| 254 | +### expectToBeA |
| 255 | + |
| 256 | +#### Parameters |
| 257 | + |
| 258 | +- `targetData` **any** |
| 259 | +- `type` **any** |
| 260 | +- `customErrorMsg` **any** |
| 261 | + |
| 262 | +### expectToBeAn |
| 263 | + |
| 264 | +#### Parameters |
| 265 | + |
| 266 | +- `targetData` **any** |
| 267 | +- `type` **any** |
| 268 | +- `customErrorMsg` **any** |
| 269 | + |
| 270 | +### expectTrue |
| 271 | + |
| 272 | +#### Parameters |
| 273 | + |
| 274 | +- `targetData` **any** |
| 275 | +- `customErrorMsg` **any** |
0 commit comments