-
-
Notifications
You must be signed in to change notification settings - Fork 728
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
eba9a39
commit edafb9e
Showing
7 changed files
with
1,164 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Expect Helper Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- 3.x | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
env: | ||
CI: true | ||
# Force terminal colors. @see https://www.npmjs.com/package/colors | ||
FORCE_COLOR: 1 | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-22.04 | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: npm install | ||
run: npm i --legacy-peer-deps | ||
- name: run unit tests | ||
run: ./node_modules/.bin/mocha test/helper/Expect_test.js --timeout 5000 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,275 @@ | ||
--- | ||
permalink: /helpers/Expect | ||
editLink: false | ||
sidebar: auto | ||
title: Expect | ||
--- | ||
|
||
<!-- Generated by documentation.js. Update this documentation by updating the source code. --> | ||
|
||
## ExpectHelper | ||
|
||
This helper allows performing assertions based on Chai. | ||
|
||
### Examples | ||
|
||
Zero-configuration when paired with other helpers like REST, Playwright: | ||
|
||
```js | ||
// inside codecept.conf.js | ||
{ | ||
helpers: { | ||
Playwright: {...}, | ||
ExpectHelper: {}, | ||
} | ||
} | ||
``` | ||
|
||
## Methods | ||
|
||
### expectAbove | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `aboveThan` **any** number | Date | ||
- `customErrorMsg` **any** | ||
|
||
### expectBelow | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `belowThan` **any** number | Date | ||
- `customErrorMsg` **any** | ||
|
||
### expectContain | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValueToContain` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectDeepEqual | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectDeepEqualExcluding | ||
|
||
expects members of two JSON objects are deeply equal excluding some properties | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `fieldsToExclude` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectDeepIncludeMembers | ||
|
||
expects an array to be a superset of another array | ||
|
||
#### Parameters | ||
|
||
- `superset` **any** | ||
- `set` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectDeepMembers | ||
|
||
expects members of two arrays are deeply equal | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectEmpty | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectEndsWith | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValueToEndWith` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectEqual | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectEqualIgnoreCase | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectFalse | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectHasAProperty | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `propertyName` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectHasProperty | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `propertyName` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectJsonSchema | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `jsonSchema` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectJsonSchemaUsingAJV | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `jsonSchema` **any** | ||
- `customErrorMsg` **any** | ||
- `ajvOptions` **any** Pass AJV options | ||
|
||
### expectLengthAboveThan | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `lengthAboveThan` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectLengthBelowThan | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `lengthBelowThan` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectLengthOf | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `length` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectMatchesPattern | ||
|
||
expects a JSON object matches a provided pattern | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedPattern` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectMatchRegex | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `regex` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectNotContain | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValueToNotContain` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectNotDeepEqual | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectNotEndsWith | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValueToNotEndWith` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectNotEqual | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValue` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectNotStartsWith | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValueToNotStartWith` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectStartsWith | ||
|
||
#### Parameters | ||
|
||
- `actualValue` **any** | ||
- `expectedValueToStartWith` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectToBeA | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `type` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectToBeAn | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `type` **any** | ||
- `customErrorMsg` **any** | ||
|
||
### expectTrue | ||
|
||
#### Parameters | ||
|
||
- `targetData` **any** | ||
- `customErrorMsg` **any** |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.