Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions Bunoshfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const { say, yell } = global.bunosh

const documentjsCliArgs = '-f md --shallow --markdown-toc=false --sort-order=alpha'

const helperSlug = name => name.replace(/([A-Z]+)([A-Z][a-z])/g, '$1-$2').replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()
const helperMarkDownFile = name => `docs/helpers/${name}.md`
const pluginMarkDownFile = name => `docs/plugins/${name}.md`

Expand Down Expand Up @@ -128,7 +129,7 @@ export async function docsExternalHelpers() {
await shell`npx documentation build node_modules/@codeceptjs/detox-helper/${helper}.js -o ${helperMarkDownFile(helper)} ${documentjsCliArgs}`

await writeToFile(helperMarkDownFile(helper), line => {
line`---\npermalink: /helpers/${helper}\nsidebar: auto\ntitle: ${helper}\n---\n\n# ${helper}\n\n`
line`---\npermalink: /helpers/${helperSlug(helper)}\nsidebar: auto\ntitle: ${helper}\n---\n\n# ${helper}\n\n`
line.fromFile(helperMarkDownFile(helper))
})

Expand All @@ -146,7 +147,7 @@ export async function docsExternalHelpers() {
await shell`npx documentation build node_modules/@codeceptjs/mock-request/index.js -o ${helperMarkDownFile(helper)} ${documentjsCliArgs}`

await writeToFile(helperMarkDownFile(helper), line => {
line`---\npermalink: /helpers/${helper}\nsidebar: auto\ntitle: ${helper}\n---\n\n# ${helper}\n\n`
line`---\npermalink: /helpers/${helperSlug(helper)}\nsidebar: auto\ntitle: ${helper}\n---\n\n# ${helper}\n\n`
line.fromFile(helperMarkDownFile(helper))
})

Expand Down Expand Up @@ -321,7 +322,7 @@ export async function docsHelpers() {

await writeToFile(helperMarkDownFile(name), line => {
line`---
permalink: /helpers/${name}
permalink: /helpers/${helperSlug(name)}
editLink: false
sidebar: auto
title: ${name}
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently,
- [**Playwright**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Playwright.md) - is a Node library to automate the Chromium, WebKit and Firefox browsers with a single API.
- [**Puppeteer**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing.
- [**WebDriver**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver or Devtools protocol.
- [**Obscura**](https://codecept.io/helpers/Obscura) - drives the lightweight Obscura browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Lightpanda**](https://codecept.io/helpers/Lightpanda) - drives the Lightpanda headless browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Moli**](https://codecept.io/helpers/Moli) - drives the Moli headless browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Obscura**](https://codecept.io/helpers/obscura) - drives the lightweight Obscura browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Lightpanda**](https://codecept.io/helpers/lightpanda) - drives the Lightpanda headless browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Moli**](https://codecept.io/helpers/moli) - drives the Moli headless browser through Chrome DevTools Protocol. See [Alternative Browser Engines](https://codecept.io/alternative-browsers).
- [**Appium**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium
- [**Detox**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Detox.md) - This is a wrapper on top of Detox library, aimed to unify testing experience for CodeceptJS framework. Detox provides a grey box testing for mobile applications, playing especially well for React Native apps.

Expand Down Expand Up @@ -208,7 +208,7 @@ Feature('CodeceptJS Demonstration')
Scenario('test page title', async ({ I }) => {
I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation')
const title = await I.grabTitle()
I.expectEqual(title, 'Example application with SimpleForm and Twitter Bootstrap') // Avaiable with Expect helper. -> https://codecept.io/helpers/Expect/
I.expectEqual(title, 'Example application with SimpleForm and Twitter Bootstrap') // Avaiable with Expect helper. -> https://codecept.io/helpers/expect/
})
```

Expand Down
2 changes: 1 addition & 1 deletion docs/ai.md
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ npx codeceptjs run --ai

## Decision Assertions

Some checks are hard to express with locators: "checkout form has all required fields", "success message is shown". The [Decision helper](/helpers/Decision) asserts them in plain language:
Some checks are hard to express with locators: "checkout form has all required fields", "success message is shown". The [Decision helper](/helpers/decision) asserts them in plain language:

```js
I.decide([
Expand Down
8 changes: 4 additions & 4 deletions docs/alternative-browsers.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Obscura: {
}
```

All options: [Obscura helper reference](/helpers/Obscura).
All options: [Obscura helper reference](/helpers/obscura).

## Lightpanda

Expand Down Expand Up @@ -141,7 +141,7 @@ Lightpanda: {
}
```

All options: [Lightpanda helper reference](/helpers/Lightpanda).
All options: [Lightpanda helper reference](/helpers/lightpanda).

## Moli

Expand Down Expand Up @@ -196,7 +196,7 @@ Moli: {
}
```

All options: [Moli helper reference](/helpers/Moli).
All options: [Moli helper reference](/helpers/moli).

## Kitesurf

Expand Down Expand Up @@ -237,4 +237,4 @@ Every worker opens its own cloud session:
npx codeceptjs run-workers 16
```

All options: [Kitesurf helper reference](/helpers/Kitesurf).
All options: [Kitesurf helper reference](/helpers/kitesurf).
26 changes: 13 additions & 13 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,9 @@ Ensure that inside `codecept.conf.js` in helpers section `REST` or `GraphQL` hel
Originally, REST and GraphQL helpers were not designed for API testing.
They were used to perform API requests for browser tests. As so, they lack assertion methods to API responses.

[`JSONResponse`](/helpers/JSONResponse/) helper adds response assertions.
[`JSONResponse`](/helpers/json-response/) helper adds response assertions.

> 💡 In CodeceptJS assertions start with `see` prefix. Learn more about assertions by [opening reference for JSONResponse](/helpers/JSONResponse/) helper.
> 💡 In CodeceptJS assertions start with `see` prefix. Learn more about assertions by [opening reference for JSONResponse](/helpers/json-response/) helper.

Generate TypeScript definitions to get auto-completions for JSONResponse:

Expand All @@ -98,7 +98,7 @@ After helpers were configured and typings were generated, you can start writing

## Requests

[REST](/helpers/REST/) or [GraphQL](/helpers/GraphQL/) helpers implement methods for making API requests.
[REST](/helpers/rest/) or [GraphQL](/helpers/graph-ql/) helpers implement methods for making API requests.
Both helpers send requests via HTTP protocol from CodeceptJS process.
For most cases, you will need to have authentication. It can be passed via headers, which can be added to helper's configuration in `codecept.conf.js`.

Expand Down Expand Up @@ -143,15 +143,15 @@ export const config = {

REST helper can send GET/POST/PATCH/etc requests to REST API endpoint:

* [`I.sendGetRequest()`](/helpers/REST#sendGetRequest)
* [`I.sendPostRequest()`](/helpers/REST#sendPostRequest)
* [`I.sendPutRequest()`](/helpers/REST#sendPutRequest)
* [`I.sendPatchRequest()`](/helpers/REST#sendPatchRequest)
* [`I.sendDeleteRequest()`](/helpers/REST#sendDeleteRequest)
* [`I.sendDeleteRequestWithPayload()`](/helpers/REST#sendDeleteRequestWithPayload)
* [`I.sendGetRequest()`](/helpers/rest#sendgetrequest)
* [`I.sendPostRequest()`](/helpers/rest#sendpostrequest)
* [`I.sendPutRequest()`](/helpers/rest#sendputrequest)
* [`I.sendPatchRequest()`](/helpers/rest#sendpatchrequest)
* [`I.sendDeleteRequest()`](/helpers/rest#senddeleterequest)
* [`I.sendDeleteRequestWithPayload()`](/helpers/rest#senddeleterequestwithpayload)
* ...

Authentication headers can be set in [helper's config](https://codecept.io/helpers/REST/#configuration) or per test with headers or special methods like `I.amBearerAuthenticated`.
Authentication headers can be set in [helper's config](https://codecept.io/helpers/rest/#configuration) or per test with headers or special methods like `I.amBearerAuthenticated`.

Example:

Expand Down Expand Up @@ -209,8 +209,8 @@ Scenario('get user by query', ({ I }) => {

GraphQL helper has two methods available:

* [`I.sendQuery()`](/helpers/GraphQL#sendQuery)
* [`I.sendMutation()`](/helpers/GraphQL#sendMutation)
* [`I.sendQuery()`](/helpers/graph-ql#sendquery)
* [`I.sendMutation()`](/helpers/graph-ql#sendmutation)

## Assertions

Expand Down Expand Up @@ -257,7 +257,7 @@ I.seeResponseCodeIsServerError();

### Structure

The most basic thing to check in response is existence of keys in JSON object. Use [`I.seeResponseContainsKeys()`](/helpers/JSONResponse#seeResponseContainsKeys) method for it:
The most basic thing to check in response is existence of keys in JSON object. Use [`I.seeResponseContainsKeys()`](/helpers/json-response#seeresponsecontainskeys) method for it:

```js
// response is { "name": "joe", "email": "joe@joe.com" }
Expand Down
10 changes: 5 additions & 5 deletions docs/assertions.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ CodeceptJS ships with **browser assertions built into the `I` object** — `I.se
When the built-ins are not enough — sort order, business math, JSON shapes, domain rules — you have three ways to assert, in order of preference:

1. **Reusable custom assertions** in a helper: `I.seeTableIsOrdered('Price', 'desc')`
2. **Quick assertions with [ExpectHelper](/helpers/ExpectHelper)** on grabbed data: `I.expectDeepEqualExcluding(order, expected, ['id'])`
2. **Quick assertions with [ExpectHelper](/helpers/expect-helper)** on grabbed data: `I.expectDeepEqualExcluding(order, expected, ['id'])`
3. **Bring your own library** — `chai`, `jest`, or Node's `assert`

This page also covers [element assertions via WebElement](/WebElement), [soft assertions](#soft-assertions) for running many checks in one scenario, and [masking secrets](#masking-secrets) in assertion logs.
Expand Down Expand Up @@ -84,7 +84,7 @@ Four options, from least setup to most:

### Quick Assertions with Expect Helper

[`ExpectHelper`](/helpers/ExpectHelper) exposes chai's assertions as methods on the `I` object. Use it for one-off checks on data you have already grabbed — no helper class, no boilerplate.
[`ExpectHelper`](/helpers/expect-helper) exposes chai's assertions as methods on the `I` object. Use it for one-off checks on data you have already grabbed — no helper class, no boilerplate.

**Install separately:**

Expand Down Expand Up @@ -145,7 +145,7 @@ Common methods:
| `expectHasProperty` / `expectEmpty` | Object shape |
| `expectJsonSchema` / `expectJsonSchemaUsingAJV` | Full schema validation |

ExpectHelper calls appear in the step log next to browser steps, so failures read in order with the rest of the scenario. See the [full reference](/helpers/ExpectHelper).
ExpectHelper calls appear in the step log next to browser steps, so failures read in order with the rest of the scenario. See the [full reference](/helpers/expect-helper).

### Built-in Assertion Library

Expand Down Expand Up @@ -399,7 +399,7 @@ expected soft assertions '[expected web application to include "You must accept

## Decision Assertions

Some checks are hard to express with locators: "checkout form has all required fields", "success message is shown", "sidebar is shown". The [Decision helper](/helpers/Decision) asserts such statements in plain language with a decision model.
Some checks are hard to express with locators: "checkout form has all required fields", "success message is shown", "sidebar is shown". The [Decision helper](/helpers/decision) asserts such statements in plain language with a decision model.

A [decision model](https://openrouter.ai/models?output_modalities=decisions), like [Jev](https://openrouter.ai/typesafe/jev-1.13), does not generate text. It reads the page and returns the probability that a statement is true. This makes it a good fit for assertions:

Expand Down Expand Up @@ -479,7 +479,7 @@ Use decision assertions for what a page means, and built-in assertions for exact
| A form field's current value | `I.seeInField` / `I.seeCheckboxIsChecked` |
| URL or page title | `I.seeInCurrentUrl` / `I.seeInTitle` |
| A count of matching elements | `I.seeNumberOfElements` |
| Business logic / JSON shape on grabbed data | [ExpectHelper](/helpers/ExpectHelper) — `expectEqual`, `expectDeepEqualExcluding`, `expectJsonSchema` |
| Business logic / JSON shape on grabbed data | [ExpectHelper](/helpers/expect-helper) — `expectEqual`, `expectDeepEqualExcluding`, `expectJsonSchema` |
| A lightweight, dependency-free assertion in a scenario | `equals`, `includes`, `empty`, `truth` from `codeceptjs/assertions` |
| Per-element state in a loop | `grabWebElements` + [WebElement API](/WebElement) |
| A matcher the above do not cover | `grab*` + `chai` / `jest` / `node:assert` |
Expand Down
2 changes: 1 addition & 1 deletion docs/bootstrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ First, `bootstrapAll` is called. Then two `bootstrap` runs in each of workers. T

The `bootstrapAll` and `teardownAll` hooks are preferred to use for setting up common logic of tested project: to start the application server or database or to start webdriver's grid.

The `bootstrap` and `teardown` hooks are used for setting up each testing browser: to create unique [cloud testing server](/helpers/WebDriver#cloud-providers) connection or to create specific browser-related test data in database (like users with names with browsername in it).
The `bootstrap` and `teardown` hooks are used for setting up each testing browser: to create unique [cloud testing server](/helpers/web-driver#cloud-providers) connection or to create specific browser-related test data in database (like users with names with browsername in it).

### Example: BootstrapAll & TeardownAll Inside Config

Expand Down
16 changes: 8 additions & 8 deletions docs/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Data Objects can use any helper methods available via `I`, including `sendGetReq

## REST

[REST helper](https://codecept.io/helpers/REST/) allows sending raw HTTP requests to application.
[REST helper](https://codecept.io/helpers/rest/) allows sending raw HTTP requests to application.
This is a tool to make shortcuts and create your data pragmatically via API. However, it doesn't provide tools for testing APIs, so it should be paired with Playwright or WebDriver helper for browser testing.

Enable REST helper in the config. It is recommended to set `endpoint`, a base URL for all API requests. If you need some authorization you can optionally set default headers too.
Expand Down Expand Up @@ -175,11 +175,11 @@ This can also be used to emulate Ajax requests:
I.sendPostRequest('/update-status', {}, { http_x_requested_with: 'xmlhttprequest' })
```

> See complete reference on [REST](https://codecept.io/helpers/REST) helper
> See complete reference on [REST](https://codecept.io/helpers/rest) helper

## GraphQL

[GraphQL helper](https://codecept.io/helpers/GraphQL/) allows sending GraphQL queries and mutations to application, over Http.
[GraphQL helper](https://codecept.io/helpers/graph-ql/) allows sending GraphQL queries and mutations to application, over Http.

This tool allows you to create shortcuts and manage your data pragmatically via a GraphQL endpoint. However, it does not include tools for testing the endpoint, so it should be used in conjunction with WebDriver helpers for browser testing.

Expand Down Expand Up @@ -243,14 +243,14 @@ After(({ I }) => {
})
```

> See complete reference on [GraphQL](https://codecept.io/helpers/GraphQL) helper
> See complete reference on [GraphQL](https://codecept.io/helpers/graph-ql) helper

## Data Generation with Factories

This concept is extended by:

- [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory/) helper, and,
- [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory/) helper.
- [ApiDataFactory](https://codecept.io/helpers/api-data-factory/) helper, and,
- [GraphQLDataFactory](https://codecept.io/helpers/graph-ql-data-factory/) helper.

These helpers build data according to defined rules and use REST API or GraphQL mutations to store them and automatically clean them up after a test.

Expand Down Expand Up @@ -320,7 +320,7 @@ At the end of a test ApiDataFactory will clean up created record for you. This i
ids from crated records and running `DELETE /api/users/{id}` requests at the end of a test.
This rules can be customized in helper configuration.

> See complete reference on [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory) helper
> See complete reference on [ApiDataFactory](https://codecept.io/helpers/api-data-factory) helper

### GraphQL Data Factory

Expand Down Expand Up @@ -383,7 +383,7 @@ data from crated records, creating deletion mutation objects by passing the data
This behavior is according the `revert` function be customized in helper configuration.
The revert function returns an object, that contains the query for deletion, and the variables object to go along with it.

> See complete reference on [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory) helper
> See complete reference on [GraphQLDataFactory](https://codecept.io/helpers/graph-ql-data-factory) helper

## Requests Using Browser Session

Expand Down
4 changes: 2 additions & 2 deletions docs/helpers/ApiDataFactory.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/ApiDataFactory
permalink: /helpers/api-data-factory
editLink: false
sidebar: auto
title: ApiDataFactory
Expand Down Expand Up @@ -260,7 +260,7 @@ Can be replaced from a custom helper.

[2]: https://www.npmjs.com/package/faker

[3]: http://codecept.io/helpers/REST/
[3]: http://codecept.io/helpers/rest/

[4]: https://github.com/axios/axios#request-config

Expand Down
4 changes: 2 additions & 2 deletions docs/helpers/Appium.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/Appium
permalink: /helpers/appium
editLink: false
sidebar: auto
title: Appium
Expand Down Expand Up @@ -2315,7 +2315,7 @@ Smart Wait to locate an element

* `locator` **[object][6]** 

[1]: http://codecept.io/helpers/WebDriver/
[1]: http://codecept.io/helpers/web-driver/

[2]: https://appium.io/docs/en/2.1/

Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Decision.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/Decision
permalink: /helpers/decision
editLink: false
sidebar: auto
title: Decision
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Detox.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/Detox
permalink: /helpers/detox
sidebar: auto
title: Detox
---
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/ExpectHelper.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/ExpectHelper
permalink: /helpers/expect-helper
editLink: false
sidebar: auto
title: ExpectHelper
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/FileSystem.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/FileSystem
permalink: /helpers/file-system
editLink: false
sidebar: auto
title: FileSystem
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/GraphQL.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/GraphQL
permalink: /helpers/graph-ql
editLink: false
sidebar: auto
title: GraphQL
Expand Down
4 changes: 2 additions & 2 deletions docs/helpers/GraphQLDataFactory.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/GraphQLDataFactory
permalink: /helpers/graph-ql-data-factory
editLink: false
sidebar: auto
title: GraphQLDataFactory
Expand Down Expand Up @@ -219,7 +219,7 @@ Can be replaced from a custom helper.

[2]: https://www.npmjs.com/package/faker

[3]: http://codecept.io/helpers/GraphQL/
[3]: http://codecept.io/helpers/graph-ql/

[4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String

Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/JSONResponse.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/JSONResponse
permalink: /helpers/json-response
editLink: false
sidebar: auto
title: JSONResponse
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Kitesurf.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/Kitesurf
permalink: /helpers/kitesurf
editLink: false
sidebar: auto
title: Kitesurf
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Lightpanda.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/Lightpanda
permalink: /helpers/lightpanda
editLink: false
sidebar: auto
title: Lightpanda
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/MockRequest.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/MockRequest
permalink: /helpers/mock-request
sidebar: auto
title: MockRequest
---
Expand Down
2 changes: 1 addition & 1 deletion docs/helpers/Moli.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
permalink: /helpers/Moli
permalink: /helpers/moli
editLink: false
sidebar: auto
title: Moli
Expand Down
Loading
Loading