From db00cab6ad24cb3e0029695ebf9317f512ef6edd Mon Sep 17 00:00:00 2001 From: kobenguyent Date: Tue, 10 Dec 2024 13:51:39 +0100 Subject: [PATCH] synchronized with docs --- docs/ai.md | 2 +- docs/api.md | 1 + docs/build/AI.js | 4 +- docs/build/ApiDataFactory.js | 2 +- docs/build/Appium.js | 19 +- docs/build/ExpectHelper.js | 2 +- docs/build/FileSystem.js | 2 +- docs/build/GraphQLDataFactory.js | 2 +- docs/build/Mochawesome.js | 2 +- docs/build/Nightmare.js | 403 ++++++------ docs/build/Playwright.js | 638 +++++++++---------- docs/build/Protractor.js | 494 ++++++++------- docs/build/Puppeteer.js | 645 ++++++++++---------- docs/build/REST.js | 26 +- docs/build/TestCafe.js | 380 ++++++------ docs/build/WebDriver.js | 944 ++++++++++------------------- docs/changelog.md | 50 ++ docs/data.md | 5 +- docs/email.md | 4 +- docs/helpers/AI.md | 26 +- docs/helpers/ApiDataFactory.md | 55 +- docs/helpers/Appium.md | 340 +++++------ docs/helpers/Detox.md | 136 +++-- docs/helpers/ExpectHelper.md | 178 +++--- docs/helpers/FileSystem.md | 36 +- docs/helpers/GraphQL.md | 37 +- docs/helpers/GraphQLDataFactory.md | 46 +- docs/helpers/JSONResponse.md | 26 +- docs/helpers/MockRequest.md | 42 +- docs/helpers/Nightmare.md | 279 ++++----- docs/helpers/Playwright.md | 670 ++++++++++---------- docs/helpers/Protractor.md | 364 +++++------ docs/helpers/Puppeteer.md | 561 ++++++++--------- docs/helpers/REST.md | 89 +-- docs/helpers/SoftExpectHelper.md | 178 +++--- docs/helpers/TestCafe.md | 256 ++++---- docs/helpers/WebDriver.md | 735 +++++++++------------- docs/plugins.md | 239 ++++---- 38 files changed, 3785 insertions(+), 4133 deletions(-) diff --git a/docs/ai.md b/docs/ai.md index b3b1ea5..9d1776b 100644 --- a/docs/ai.md +++ b/docs/ai.md @@ -533,7 +533,7 @@ ai: { * `maxLength`: the size of HTML to cut to not reach the token limit. 50K is the current default but you may try to increase it or even set it to null. * `simplify`: should we process HTML before sending to GPT. This will remove all non-interactive elements from HTML. -* `minify`: shold HTML be additionally minified. This removed empty attributes, shortens notations, etc. +* `minify`: should HTML be additionally minified. This removed empty attributes, shortens notations, etc. * `interactiveElements`: explicit list of all elements that are considered interactive. * `textElements`: elements that contain text which can be used for test automation. * `allowedAttrs`: explicit list of attributes that may be used to construct locators. If you use special `data-` attributes to enable locators, add them to the list. diff --git a/docs/api.md b/docs/api.md index a2bb24c..80bc146 100644 --- a/docs/api.md +++ b/docs/api.md @@ -148,6 +148,7 @@ REST helper can send GET/POST/PATCH/etc requests to REST API endpoint: * [`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`. diff --git a/docs/build/AI.js b/docs/build/AI.js index 3d4cf6f..4b2d759 100644 --- a/docs/build/AI.js +++ b/docs/build/AI.js @@ -6,8 +6,8 @@ const ai = require('../ai') const standardActingHelpers = require('../plugin/standardActingHelpers') const Container = require('../container') const { splitByChunks, minifyHtml } = require('../html') -const { beautify } = require('../utils.js') -const output = require('../output.js') +const { beautify } = require('../utils') +const output = require('../output') const { registerVariable } = require('../pause') const gtpRole = { diff --git a/docs/build/ApiDataFactory.js b/docs/build/ApiDataFactory.js index ece5656..7026a6c 100644 --- a/docs/build/ApiDataFactory.js +++ b/docs/build/ApiDataFactory.js @@ -51,7 +51,7 @@ const REST = require('./REST') * * module.exports = new Factory() * // no need to set id, it will be set by REST API - * .attr('author', () => faker.name.findName()) + * .attr('author', () => faker.person.findName()) * .attr('title', () => faker.lorem.sentence()) * .attr('body', () => faker.lorem.paragraph()); * ``` diff --git a/docs/build/Appium.js b/docs/build/Appium.js index bf0a9a7..3251b25 100644 --- a/docs/build/Appium.js +++ b/docs/build/Appium.js @@ -434,8 +434,8 @@ class Appium extends Webdriver { async runOnIOS(caps, fn) { if (this.platform !== 'ios') return recorder.session.start('iOS-only actions') - await this._runWithCaps(caps, fn) - await recorder.add('restore from iOS session', () => recorder.session.restore()) + this._runWithCaps(caps, fn) + recorder.add('restore from iOS session', () => recorder.session.restore()) return recorder.promise() } @@ -476,8 +476,8 @@ class Appium extends Webdriver { async runOnAndroid(caps, fn) { if (this.platform !== 'android') return recorder.session.start('Android-only actions') - await this._runWithCaps(caps, fn) - await recorder.add('restore from Android session', () => recorder.session.restore()) + this._runWithCaps(caps, fn) + recorder.add('restore from Android session', () => recorder.session.restore()) return recorder.promise() } @@ -491,19 +491,17 @@ class Appium extends Webdriver { * }); * ``` * - * @param {*} fn */ - /* eslint-disable */ - async runInWeb(fn) { + + async runInWeb() { if (!this.isWeb) return recorder.session.start('Web-only actions') recorder.add('restore from Web session', () => recorder.session.restore(), true) return recorder.promise() } - /* eslint-enable */ - async _runWithCaps(caps, fn) { + _runWithCaps(caps, fn) { if (typeof caps === 'object') { for (const key in caps) { // skip if capabilities do not match @@ -1077,7 +1075,7 @@ class Appium extends Webdriver { * * Appium: support Android and iOS */ - /* eslint-disable */ + async swipe(locator, xoffset, yoffset, speed = 1000) { onlyForApps.call(this) const res = await this.browser.$(parseLocator.call(this, locator)) @@ -1087,7 +1085,6 @@ class Appium extends Webdriver { y: (await res.getLocation()).y + yoffset, }) } - /* eslint-enable */ /** * Perform a swipe on the screen. diff --git a/docs/build/ExpectHelper.js b/docs/build/ExpectHelper.js index 7359bea..8d891e0 100644 --- a/docs/build/ExpectHelper.js +++ b/docs/build/ExpectHelper.js @@ -1,4 +1,4 @@ -const output = require('../output.js') +const output = require('../output') let expect diff --git a/docs/build/FileSystem.js b/docs/build/FileSystem.js index 0d4349d..68d6d64 100644 --- a/docs/build/FileSystem.js +++ b/docs/build/FileSystem.js @@ -3,7 +3,7 @@ const path = require('path') const fs = require('fs') const Helper = require('@codeceptjs/helper') -const { fileExists } = require('../utils.js') +const { fileExists } = require('../utils') const { fileIncludes } = require('../assert/include') const { fileEquals } = require('../assert/equal') diff --git a/docs/build/GraphQLDataFactory.js b/docs/build/GraphQLDataFactory.js index e45f7fe..d6453b7 100644 --- a/docs/build/GraphQLDataFactory.js +++ b/docs/build/GraphQLDataFactory.js @@ -55,7 +55,7 @@ const GraphQL = require('./GraphQL') * input: { ...buildObj }, * })) * // 'attr'-id can be left out depending on the GraphQl resolvers - * .attr('name', () => faker.name.findName()) + * .attr('name', () => faker.person.findName()) * .attr('email', () => faker.interact.email()) * ``` * For more options see [rosie documentation](https://github.com/rosiejs/rosie). diff --git a/docs/build/Mochawesome.js b/docs/build/Mochawesome.js index 3241261..abc143a 100644 --- a/docs/build/Mochawesome.js +++ b/docs/build/Mochawesome.js @@ -3,7 +3,7 @@ let currentTest let currentSuite const Helper = require('@codeceptjs/helper') -const { clearString } = require('../utils.js') +const { clearString } = require('../utils') class Mochawesome extends Helper { constructor(config) { diff --git a/docs/build/Nightmare.js b/docs/build/Nightmare.js index b559027..2d3216c 100644 --- a/docs/build/Nightmare.js +++ b/docs/build/Nightmare.js @@ -10,7 +10,7 @@ const { empty } = require('../assert/empty') const { truth } = require('../assert/truth') const Locator = require('../locator') const ElementNotFound = require('./errors/ElementNotFound') -const { xpathLocator, fileExists, screenshotOutputFolder, toCamelCase } = require('../utils.js') +const { xpathLocator, fileExists, screenshotOutputFolder, toCamelCase } = require('../utils') const specialKeys = { Backspace: '\u0008', @@ -434,16 +434,16 @@ class Nightmare extends Helper { /** * Opens a web page in a browser. Requires relative or absolute url. * If url starts with `/`, opens a web page of a site defined in `url` config parameter. - * + * * ```js * I.amOnPage('/'); // opens main page of website * I.amOnPage('https://github.com'); // opens github * I.amOnPage('/login'); // opens a login page * ``` - * + * * @param {string} url url path or global url. * @returns {void} automatically synchronized promise through #recorder - * + * * @param {?object} headers list of request headers can be passed * */ @@ -465,14 +465,14 @@ class Nightmare extends Helper { /** * Checks that title contains text. - * + * * ```js * I.seeInTitle('Home Page'); * ``` - * + * * @param {string} text text value to check. * @returns {void} automatically synchronized promise through #recorder - * + * */ async seeInTitle(text) { const title = await this.browser.title() @@ -481,14 +481,14 @@ class Nightmare extends Helper { /** * Checks that title does not contain text. - * + * * ```js * I.dontSeeInTitle('Error'); * ``` - * + * * @param {string} text value to check. * @returns {void} automatically synchronized promise through #recorder - * + * */ async dontSeeInTitle(text) { const title = await this.browser.title() @@ -498,11 +498,11 @@ class Nightmare extends Helper { /** * Retrieves a page title and returns it to test. * Resumes test execution, so **should be used inside async with `await`** operator. - * + * * ```js * let title = await I.grabTitle(); * ``` - * + * * @returns {Promise} title */ async grabTitle() { @@ -512,12 +512,12 @@ class Nightmare extends Helper { /** * Get current URL from browser. * Resumes test execution, so should be used inside an async function. - * + * * ```js * let url = await I.grabCurrentUrl(); * console.log(`Current URL is [${url}]`); * ``` - * + * * @returns {Promise} current URL */ async grabCurrentUrl() { @@ -526,14 +526,14 @@ class Nightmare extends Helper { /** * Checks that current url contains a provided fragment. - * + * * ```js * I.seeInCurrentUrl('/register'); // we are on registration page * ``` - * + * * @param {string} url a fragment to check * @returns {void} automatically synchronized promise through #recorder - * + * */ async seeInCurrentUrl(url) { const currentUrl = await this.browser.url() @@ -542,10 +542,10 @@ class Nightmare extends Helper { /** * Checks that current url does not contain a provided fragment. - * + * * @param {string} url value to check. * @returns {void} automatically synchronized promise through #recorder - * + * */ async dontSeeInCurrentUrl(url) { const currentUrl = await this.browser.url() @@ -556,15 +556,15 @@ class Nightmare extends Helper { * Checks that current url is equal to provided one. * If a relative url provided, a configured url will be prepended to it. * So both examples will work: - * + * * ```js * I.seeCurrentUrlEquals('/register'); * I.seeCurrentUrlEquals('http://my.site.com/register'); * ``` - * + * * @param {string} url value to check. * @returns {void} automatically synchronized promise through #recorder - * + * */ async seeCurrentUrlEquals(url) { const currentUrl = await this.browser.url() @@ -574,15 +574,15 @@ class Nightmare extends Helper { /** * Checks that current url is not equal to provided one. * If a relative url provided, a configured url will be prepended to it. - * + * * ```js * I.dontSeeCurrentUrlEquals('/login'); // relative url are ok * I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also ok * ``` - * + * * @param {string} url value to check. * @returns {void} automatically synchronized promise through #recorder - * + * */ async dontSeeCurrentUrlEquals(url) { const currentUrl = await this.browser.url() @@ -592,7 +592,7 @@ class Nightmare extends Helper { /** * Checks that a page contains a visible text. * Use context parameter to narrow down the search. - * + * * ```js * I.see('Welcome'); // text welcome on a page * I.see('Welcome', '.content'); // text inside .content div @@ -601,7 +601,7 @@ class Nightmare extends Helper { * @param {string} text expected on page. * @param {?CodeceptJS.LocatorOrString} [context=null] (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text. * @returns {void} automatically synchronized promise through #recorder - * + * */ async see(text, context = null) { return proceedSee.call(this, 'assert', text, context) @@ -610,16 +610,16 @@ class Nightmare extends Helper { /** * Opposite to `see`. Checks that a text is not present on a page. * Use context parameter to narrow down the search. - * + * * ```js * I.dontSee('Login'); // assume we are already logged in. * I.dontSee('Login', '.nav'); // no login inside .nav element * ``` - * + * * @param {string} text which is not present. * @param {CodeceptJS.LocatorOrString} [context] (optional) element located by CSS|XPath|strict locator in which to perfrom search. * @returns {void} automatically synchronized promise through #recorder - * + * */ dontSee(text, context = null) { return proceedSee.call(this, 'negate', text, context) @@ -628,13 +628,13 @@ class Nightmare extends Helper { /** * Checks that a given Element is visible * Element is located by CSS or XPath. - * + * * ```js * I.seeElement('#modal'); * ``` * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|strict locator. * @returns {void} automatically synchronized promise through #recorder - * + * */ async seeElement(locator) { locator = new Locator(locator, 'css') @@ -650,14 +650,14 @@ class Nightmare extends Helper { /** * Opposite to `seeElement`. Checks that element is not visible (or in DOM) - * + * * ```js * I.dontSeeElement('.modal'); // modal is not shown * ``` - * + * * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator. * @returns {void} automatically synchronized promise through #recorder - * + * */ async dontSeeElement(locator) { locator = new Locator(locator, 'css') @@ -675,13 +675,13 @@ class Nightmare extends Helper { /** * Checks that a given Element is present in the DOM * Element is located by CSS or XPath. - * + * * ```js * I.seeElementInDOM('#modal'); * ``` * @param {CodeceptJS.LocatorOrString} locator element located by CSS|XPath|strict locator. * @returns {void} automatically synchronized promise through #recorder - * + * */ async seeElementInDOM(locator) { locator = new Locator(locator, 'css') @@ -691,14 +691,14 @@ class Nightmare extends Helper { /** * Opposite to `seeElementInDOM`. Checks that element is not on page. - * + * * ```js * I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or not * ``` - * + * * @param {CodeceptJS.LocatorOrString} locator located by CSS|XPath|Strict locator. * @returns {void} automatically synchronized promise through #recorder - * + * */ async dontSeeElementInDOM(locator) { locator = new Locator(locator, 'css') @@ -708,13 +708,13 @@ class Nightmare extends Helper { /** * Checks that the current page contains the given string in its raw source code. - * + * * ```js * I.seeInSource('

Green eggs & ham

'); * ``` * @param {string} text value to check. * @returns {void} automatically synchronized promise through #recorder - * + * */ async seeInSource(text) { const source = await this.browser.evaluate(() => document.documentElement.outerHTML) @@ -723,14 +723,14 @@ class Nightmare extends Helper { /** * Checks that the current page does not contains the given string in its raw source code. - * + * * ```js * I.dontSeeInSource(' npm i @codeceptjs/detox-helper --save @@ -73,21 +74,22 @@ helpers: { configuration: '', } } + ``` It's important to specify a package name under `require` section and current detox configuration taken from `package.json`. Options: -- `configuration` - a detox configuration name. Required. -- `reloadReactNative` - should be enabled for React Native applications. -- `reuse` - reuse application for tests. By default, Detox reinstalls and relaunches app. -- `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally. -- `url` - URL to open via deep-link each time the app is launched (android) or immediately afterwards (iOS). Useful for opening a bundle URL at the beginning of tests when working with Expo. +* `configuration` - a detox configuration name. Required. +* `reloadReactNative` - should be enabled for React Native applications. +* `reuse` - reuse application for tests. By default, Detox reinstalls and relaunches app. +* `registerGlobals` - (default: true) Register Detox helper functions `by`, `element`, `expect`, `waitFor` globally. +* `url` - URL to open via deep-link each time the app is launched (android) or immediately afterwards (iOS). Useful for opening a bundle URL at the beginning of tests when working with Expo. ### Parameters -- `config` +* `config` ### appendField @@ -100,8 +102,8 @@ I.appendField('name', 'davert'); #### Parameters -- `field` **([string][5] \| [object][6])** -- `value` **[string][5]** +* `field` **([string][5] | [object][6])** +* `value` **[string][5]** ### checkIfElementExists @@ -114,8 +116,8 @@ I.checkIfElementExists('~edit', '#menu'); // element inside #menu #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `context` **([string][5] \| [object][6] | null)** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `context` **([string][5] | [object][6] | null)** context element (optional, default `null`) ### clearField @@ -128,7 +130,7 @@ I.clearField('~name'); #### Parameters -- `field` **([string][5] \| [object][6])** an input element to clear +* `field` **([string][5] | [object][6])** an input element to clear ### click @@ -149,8 +151,8 @@ I.click({ ios: 'Save', android: 'SAVE' }, '#main'); // different texts on iOS an #### Parameters -- `locator` **([string][5] \| [object][6])** -- `context` **([string][5] \| [object][6] | null)** (optional, default `null`) +* `locator` **([string][5] | [object][6])** +* `context` **([string][5] | [object][6] | null)** (optional, default `null`) ### clickAtPoint @@ -164,9 +166,9 @@ I.clickAtPoint('~save', 10, 10); // locate by accessibility id #### Parameters -- `locator` **([string][5] \| [object][6])** -- `x` **[number][8]** horizontal offset (optional, default `0`) -- `y` **[number][8]** vertical offset (optional, default `0`) +* `locator` **([string][5] | [object][6])** +* `x` **[number][8]** horizontal offset (optional, default `0`) +* `y` **[number][8]** vertical offset (optional, default `0`) ### dontSee @@ -181,8 +183,8 @@ I.dontSee('Record deleted', '~message'); #### Parameters -- `text` **[string][5]** to check invisibility -- `context` **([string][5] \| [object][6] | null)** element in which to search for text (optional, default `null`) +* `text` **[string][5]** to check invisibility +* `context` **([string][5] | [object][6] | null)** element in which to search for text (optional, default `null`) ### dontSeeElement @@ -196,8 +198,8 @@ I.dontSeeElement('~edit', '#menu'); // element inside #menu #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `context` **([string][5] \| [object][6] | null)** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `context` **([string][5] | [object][6] | null)** context element (optional, default `null`) ### dontSeeElementExists @@ -211,8 +213,8 @@ I.dontSeeElementExist('~edit', '#menu'); // element inside #menu #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `context` **([string][5] \| [object][6])** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `context` **([string][5] | [object][6])** context element (optional, default `null`) ### fillField @@ -227,8 +229,8 @@ I.fillField({ android: 'NAME', ios: 'name' }, 'davert'); #### Parameters -- `field` **([string][5] \| [object][6])** an input element to fill in -- `value` **[string][5]** value to fill +* `field` **([string][5] | [object][6])** an input element to fill in +* `value` **[string][5]** value to fill ### goBack @@ -275,9 +277,9 @@ I.longPress('Update', 2, '#menu'); // locate by text inside #menu, hold for 2 se #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `sec` **[number][8]** number of seconds to hold tap -- `context` **([string][5] \| [object][6] | null)** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `sec` **[number][8]** number of seconds to hold tap +* `context` **([string][5] | [object][6] | null)** context element (optional, default `null`) ### multiTap @@ -296,9 +298,9 @@ I.multiTap('Update', 2, '#menu'); // locate by id #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `num` **[number][8]** number of taps -- `context` **([string][5] \| [object][6] | null)** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `num` **[number][8]** number of taps +* `context` **([string][5] | [object][6] | null)** context element (optional, default `null`) ### relaunchApp @@ -321,7 +323,7 @@ I.runOnAndroid(() => { #### Parameters -- `fn` **[Function][10]** a function which will be executed on android +* `fn` **[Function][10]** a function which will be executed on android ### runOnIOS @@ -336,7 +338,7 @@ I.runOnIOS(() => { #### Parameters -- `fn` **[Function][10]** a function which will be executed on iOS +* `fn` **[Function][10]** a function which will be executed on iOS ### saveScreenshot @@ -348,7 +350,7 @@ I.saveScreenshot('main-window.png'); #### Parameters -- `name` **[string][5]** +* `name` **[string][5]** ### scrollDown @@ -360,7 +362,7 @@ I.scrollDown('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** +* `locator` **([string][5] | [object][6])** ### scrollLeft @@ -372,7 +374,7 @@ I.scrollLeft('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** +* `locator` **([string][5] | [object][6])** ### scrollRight @@ -384,7 +386,7 @@ I.scrollRight('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** +* `locator` **([string][5] | [object][6])** ### scrollToElement @@ -392,10 +394,10 @@ Scrolls within a scrollable container to an element. #### Parameters -- `targetLocator` **([string][5] \| [object][6])** Locator of the element to scroll to -- `containerLocator` **([string][5] \| [object][6])** Locator of the scrollable container -- `direction` **[string][5]** 'up' or 'down' (optional, default `'down'`) -- `offset` **[number][8]** Offset for scroll, can be adjusted based on need (optional, default `100`) +* `targetLocator` **([string][5] | [object][6])** Locator of the element to scroll to +* `containerLocator` **([string][5] | [object][6])** Locator of the scrollable container +* `direction` **[string][5]** 'up' or 'down' (optional, default `'down'`) +* `offset` **[number][8]** Offset for scroll, can be adjusted based on need (optional, default `100`) ### scrollUp @@ -407,7 +409,7 @@ I.scrollUp('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** +* `locator` **([string][5] | [object][6])** ### see @@ -422,8 +424,8 @@ I.see('Record deleted', '~message'); #### Parameters -- `text` **[string][5]** to check visibility -- `context` **([string][5] \| [object][6] | null)** element inside which to search for text (optional, default `null`) +* `text` **[string][5]** to check visibility +* `context` **([string][5] | [object][6] | null)** element inside which to search for text (optional, default `null`) ### seeElement @@ -437,8 +439,8 @@ I.seeElement('~edit', '#menu'); // element inside #menu #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `context` **([string][5] \| [object][6] | null)** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `context` **([string][5] | [object][6] | null)** context element (optional, default `null`) ### seeElementExists @@ -452,8 +454,8 @@ I.seeElementExists('~edit', '#menu'); // element inside #menu #### Parameters -- `locator` **([string][5] \| [object][6])** element to locate -- `context` **([string][5] \| [object][6])** context element (optional, default `null`) +* `locator` **([string][5] | [object][6])** element to locate +* `context` **([string][5] | [object][6])** context element (optional, default `null`) ### setLandscapeOrientation @@ -490,8 +492,8 @@ I.swipeUp('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** an element on which to perform swipe -- `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) +* `locator` **([string][5] | [object][6])** an element on which to perform swipe +* `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) ### swipeLeft @@ -504,8 +506,8 @@ I.swipeUp('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** an element on which to perform swipe -- `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) +* `locator` **([string][5] | [object][6])** an element on which to perform swipe +* `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) ### swipeRight @@ -518,8 +520,8 @@ I.swipeUp('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** an element on which to perform swipe -- `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) +* `locator` **([string][5] | [object][6])** an element on which to perform swipe +* `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) ### swipeUp @@ -532,8 +534,8 @@ I.swipeUp('#container'); #### Parameters -- `locator` **([string][5] \| [object][6])** an element on which to perform swipe -- `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) +* `locator` **([string][5] | [object][6])** an element on which to perform swipe +* `speed` **[string][5]** a speed to perform: `slow` or `fast`. (optional, default `'slow'`) ### tap @@ -554,8 +556,8 @@ I.tap({ ios: 'Save', android: 'SAVE' }, '#main'); // different texts on iOS and #### Parameters -- `locator` **([string][5] \| [object][6])** -- `context` **([string][5] \| [object][6] | null)** (optional, default `null`) +* `locator` **([string][5] | [object][6])** +* `context` **([string][5] | [object][6] | null)** (optional, default `null`) ### tapByLabel @@ -571,8 +573,8 @@ I.tapByLabel('Login', '#nav'); // locate by text inside #nav #### Parameters -- `locator` **([string][5] \| [object][6])** -- `context` **([string][5] \| [object][6] | null)** (optional, default `null`) +* `locator` **([string][5] | [object][6])** +* `context` **([string][5] | [object][6] | null)** (optional, default `null`) ### tapReturnKey @@ -587,7 +589,7 @@ I.tapReturnKey({ android: 'NAME', ios: 'name' }); #### Parameters -- `field` **([string][5] \| [object][6])** an input element to fill in +* `field` **([string][5] | [object][6])** an input element to fill in ### wait @@ -599,7 +601,7 @@ I.wait(2); // waits for 2 seconds #### Parameters -- `sec` **[number][8]** number of seconds to wait +* `sec` **[number][8]** number of seconds to wait ### waitForElement @@ -611,8 +613,8 @@ I.waitForElement('#message', 1); // wait for 1 second #### Parameters -- `locator` **([string][5] \| [object][6])** an element to wait for -- `sec` **[number][8]** number of seconds to wait, 5 by default (optional, default `5`) +* `locator` **([string][5] | [object][6])** an element to wait for +* `sec` **[number][8]** number of seconds to wait, 5 by default (optional, default `5`) ### waitForElementVisible @@ -624,8 +626,8 @@ I.waitForElementVisible('#message', 1); // wait for 1 second #### Parameters -- `locator` **([string][5] \| [object][6])** an element to wait for -- `sec` **[number][8]** number of seconds to wait (optional, default `5`) +* `locator` **([string][5] | [object][6])** an element to wait for +* `sec` **[number][8]** number of seconds to wait (optional, default `5`) ### waitToHide @@ -637,8 +639,8 @@ I.waitToHide('#message', 2); // wait for 2 seconds #### Parameters -- `locator` **([string][5] \| [object][6])** an element to wait for -- `sec` **[number][8]** number of seconds to wait (optional, default `5`) +* `locator` **([string][5] | [object][6])** an element to wait for +* `sec` **[number][8]** number of seconds to wait (optional, default `5`) [1]: https://github.com/wix/Detox diff --git a/docs/helpers/ExpectHelper.md b/docs/helpers/ExpectHelper.md index 7ffe415..3a0659b 100644 --- a/docs/helpers/ExpectHelper.md +++ b/docs/helpers/ExpectHelper.md @@ -31,33 +31,33 @@ Zero-configuration when paired with other helpers like REST, Playwright: #### Parameters -- `targetData` **any** -- `aboveThan` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `aboveThan` **any** +* `customErrorMsg` **any?** ### expectBelow #### Parameters -- `targetData` **any** -- `belowThan` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `belowThan` **any** +* `customErrorMsg` **any?** ### expectContain #### Parameters -- `actualValue` **any** -- `expectedValueToContain` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValueToContain` **any** +* `customErrorMsg` **any?** ### expectDeepEqual #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `customErrorMsg` **any?** ### expectDeepEqualExcluding @@ -65,10 +65,10 @@ expects members of two JSON objects are deeply equal excluding some properties #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `fieldsToExclude` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `fieldsToExclude` **any** +* `customErrorMsg` **any?** ### expectDeepIncludeMembers @@ -76,9 +76,9 @@ expects an array to be a superset of another array #### Parameters -- `superset` **any** -- `set` **any** -- `customErrorMsg` **any?** +* `superset` **any** +* `set` **any** +* `customErrorMsg` **any?** ### expectDeepMembers @@ -86,104 +86,104 @@ expects members of two arrays are deeply equal #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `customErrorMsg` **any?** ### expectEmpty #### Parameters -- `targetData` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `customErrorMsg` **any?** ### expectEndsWith #### Parameters -- `actualValue` **any** -- `expectedValueToEndWith` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValueToEndWith` **any** +* `customErrorMsg` **any?** ### expectEqual #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `customErrorMsg` **any?** ### expectEqualIgnoreCase #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `customErrorMsg` **any?** ### expectFalse #### Parameters -- `targetData` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `customErrorMsg` **any?** ### expectHasAProperty #### Parameters -- `targetData` **any** -- `propertyName` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `propertyName` **any** +* `customErrorMsg` **any?** ### expectHasProperty #### Parameters -- `targetData` **any** -- `propertyName` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `propertyName` **any** +* `customErrorMsg` **any?** ### expectJsonSchema #### Parameters -- `targetData` **any** -- `jsonSchema` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `jsonSchema` **any** +* `customErrorMsg` **any?** ### expectJsonSchemaUsingAJV #### Parameters -- `targetData` **any** -- `jsonSchema` **any** -- `customErrorMsg` **any?** -- `ajvOptions` **any?** Pass AJV options +* `targetData` **any** +* `jsonSchema` **any** +* `customErrorMsg` **any?** +* `ajvOptions` **any?** Pass AJV options ### expectLengthAboveThan #### Parameters -- `targetData` **any** -- `lengthAboveThan` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `lengthAboveThan` **any** +* `customErrorMsg` **any?** ### expectLengthBelowThan #### Parameters -- `targetData` **any** -- `lengthBelowThan` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `lengthBelowThan` **any** +* `customErrorMsg` **any?** ### expectLengthOf #### Parameters -- `targetData` **any** -- `length` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `length` **any** +* `customErrorMsg` **any?** ### expectMatchesPattern @@ -191,85 +191,85 @@ expects a JSON object matches a provided pattern #### Parameters -- `actualValue` **any** -- `expectedPattern` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedPattern` **any** +* `customErrorMsg` **any?** ### expectMatchRegex #### Parameters -- `targetData` **any** -- `regex` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `regex` **any** +* `customErrorMsg` **any?** ### expectNotContain #### Parameters -- `actualValue` **any** -- `expectedValueToNotContain` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValueToNotContain` **any** +* `customErrorMsg` **any?** ### expectNotDeepEqual #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `customErrorMsg` **any?** ### expectNotEndsWith #### Parameters -- `actualValue` **any** -- `expectedValueToNotEndWith` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValueToNotEndWith` **any** +* `customErrorMsg` **any?** ### expectNotEqual #### Parameters -- `actualValue` **any** -- `expectedValue` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValue` **any** +* `customErrorMsg` **any?** ### expectNotStartsWith #### Parameters -- `actualValue` **any** -- `expectedValueToNotStartWith` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValueToNotStartWith` **any** +* `customErrorMsg` **any?** ### expectStartsWith #### Parameters -- `actualValue` **any** -- `expectedValueToStartWith` **any** -- `customErrorMsg` **any?** +* `actualValue` **any** +* `expectedValueToStartWith` **any** +* `customErrorMsg` **any?** ### expectToBeA #### Parameters -- `targetData` **any** -- `type` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `type` **any** +* `customErrorMsg` **any?** ### expectToBeAn #### Parameters -- `targetData` **any** -- `type` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `type` **any** +* `customErrorMsg` **any?** ### expectTrue #### Parameters -- `targetData` **any** -- `customErrorMsg` **any?** +* `targetData` **any** +* `customErrorMsg` **any?** diff --git a/docs/helpers/FileSystem.md b/docs/helpers/FileSystem.md index 0af9843..cd3d135 100644 --- a/docs/helpers/FileSystem.md +++ b/docs/helpers/FileSystem.md @@ -40,7 +40,7 @@ Starts from a current directory #### Parameters -- `openPath` **[string][1]** +* `openPath` **[string][1]** ### dontSeeFileContentsEqual @@ -48,8 +48,8 @@ Checks that contents of file found by `seeFile` doesn't equal to text. #### Parameters -- `text` **[string][1]** -- `encoding` **[string][1]** +* `text` **[string][1]** +* `encoding` **[string][1]** ### dontSeeInThisFile @@ -57,8 +57,8 @@ Checks that file found by `seeFile` doesn't include text. #### Parameters -- `text` **[string][1]** -- `encoding` **[string][1]** +* `text` **[string][1]** +* `encoding` **[string][1]** ### grabFileNames @@ -77,7 +77,7 @@ Checks that file exists #### Parameters -- `name` **[string][1]** +* `name` **[string][1]** ### seeFileContentsEqual @@ -85,8 +85,8 @@ Checks that contents of file found by `seeFile` equal to text. #### Parameters -- `text` **[string][1]** -- `encoding` **[string][1]** +* `text` **[string][1]** +* `encoding` **[string][1]** ### seeFileContentsEqualReferenceFile @@ -94,9 +94,9 @@ Checks that contents of the file found by `seeFile` equal to contents of the fil #### Parameters -- `pathToReferenceFile` **[string][1]** -- `encoding` **[string][1]** -- `encodingReference` **[string][1]** +* `pathToReferenceFile` **[string][1]** +* `encoding` **[string][1]** +* `encodingReference` **[string][1]** ### seeFileNameMatching @@ -111,7 +111,7 @@ I.seeFileNameMatching('.pdf'); #### Parameters -- `text` **[string][1]** +* `text` **[string][1]** ### seeInThisFile @@ -119,8 +119,8 @@ Checks that file found by `seeFile` includes a text. #### Parameters -- `text` **[string][1]** -- `encoding` **[string][1]** +* `text` **[string][1]** +* `encoding` **[string][1]** ### waitForFile @@ -135,8 +135,8 @@ I.waitForFile('largeFilesName.txt', 10); // wait 10 seconds for file #### Parameters -- `name` **[string][1]** -- `sec` **[number][2]** seconds to wait +* `name` **[string][1]** +* `sec` **[number][2]** seconds to wait ### writeToFile @@ -144,8 +144,8 @@ Writes text to file #### Parameters -- `name` **[string][1]** -- `text` **[string][1]** +* `name` **[string][1]** +* `text` **[string][1]** [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String diff --git a/docs/helpers/GraphQL.md b/docs/helpers/GraphQL.md index 82d7bbf..7aa35c6 100644 --- a/docs/helpers/GraphQL.md +++ b/docs/helpers/GraphQL.md @@ -16,10 +16,10 @@ GraphQL helper allows to send additional requests to a GraphQl endpoint during a ## Configuration -- endpoint: GraphQL base URL -- timeout: timeout for requests in milliseconds. 10000ms by default -- defaultHeaders: a list of default headers -- onRequest: a async function which can update request object. +* endpoint: GraphQL base URL +* timeout: timeout for requests in milliseconds. 10000ms by default +* defaultHeaders: a list of default headers +* onRequest: a async function which can update request object. ## Example @@ -47,7 +47,7 @@ this.helpers['GraphQL']._executeQuery({ ### Parameters -- `config` +* `config` ### _executeQuery @@ -55,7 +55,7 @@ Executes query via axios call #### Parameters -- `request` **[object][2]** +* `request` **[object][2]** ### _prepareGraphQLRequest @@ -63,8 +63,8 @@ Prepares request for axios call #### Parameters -- `operation` **[object][2]** -- `headers` **[object][2]** +* `operation` **[object][2]** +* `headers` **[object][2]** Returns **[object][2]** graphQLRequest @@ -79,7 +79,7 @@ I.amBearerAuthenticated(secret('heregoestoken')) #### Parameters -- `accessToken` **([string][3] | CodeceptJS.Secret)** Bearer access token +* `accessToken` **([string][3] | CodeceptJS.Secret)** Bearer access token ### haveRequestHeaders @@ -87,7 +87,7 @@ Sets request headers for all requests of this test #### Parameters -- `headers` **[object][2]** headers list +* `headers` **[object][2]** headers list ### sendMutation @@ -113,10 +113,10 @@ I.sendMutation(` #### Parameters -- `mutation` **[String][3]** -- `variables` **[object][2]?** that may go along with the mutation -- `options` **[object][2]?** are additional query options -- `headers` **[object][2]?** +* `mutation` **[String][3]** +* `variables` **[object][2]?** that may go along with the mutation +* `options` **[object][2]?** are additional query options +* `headers` **[object][2]?** Returns **any** Promise @@ -126,6 +126,7 @@ Send query to GraphQL endpoint over http. Returns a response as a promise. ```js + const response = await I.sendQuery('{ users { name email }}'); // with variables const response = await I.sendQuery( @@ -137,10 +138,10 @@ const user = response.data.data; #### Parameters -- `query` **[String][3]** -- `variables` **[object][2]?** that may go along with the query -- `options` **[object][2]?** are additional query options -- `headers` **[object][2]?** +* `query` **[String][3]** +* `variables` **[object][2]?** that may go along with the query +* `options` **[object][2]?** are additional query options +* `headers` **[object][2]?** Returns **any** Promise diff --git a/docs/helpers/GraphQLDataFactory.md b/docs/helpers/GraphQLDataFactory.md index d7795e7..277cf2c 100644 --- a/docs/helpers/GraphQLDataFactory.md +++ b/docs/helpers/GraphQLDataFactory.md @@ -62,7 +62,7 @@ module.exports = new Factory((buildObj) => ({ input: { ...buildObj }, })) // 'attr'-id can be left out depending on the GraphQl resolvers - .attr('name', () => faker.name.findName()) + .attr('name', () => faker.person.findName()) .attr('email', () => faker.interact.email()) ``` @@ -74,11 +74,11 @@ Then configure GraphQLDataHelper to match factories and GraphQL schema: GraphQLDataFactory has following config options: -- `endpoint`: URL for the GraphQL server. -- `cleanup` (default: true): should inserted records be deleted up after tests -- `factories`: list of defined factories -- `headers`: list of headers -- `GraphQL`: configuration for GraphQL requests. +* `endpoint`: URL for the GraphQL server. +* `cleanup` (default: true): should inserted records be deleted up after tests +* `factories`: list of defined factories +* `headers`: list of headers +* `GraphQL`: configuration for GraphQL requests. See the example: @@ -121,16 +121,16 @@ For instance, to set timeout you should add: Factory contains operations - -- `operation`: The operation/mutation that needs to be performed for creating a record in the backend. +* `operation`: The operation/mutation that needs to be performed for creating a record in the backend. Each operation must have the following: -- `query`: The mutation(query) string. It is expected to use variables to send data with the query. -- `factory`: The path to factory file. The object built by the factory in this file will be passed - as the 'variables' object to go along with the mutation. -- `revert`: A function called with the data returned when an item is created. The object returned by - this function is will be used to later delete the items created. So, make sure RELEVANT DATA IS RETURNED - when a record is created by a mutation. +* `query`: The mutation(query) string. It is expected to use variables to send data with the query. +* `factory`: The path to factory file. The object built by the factory in this file will be passed + as the 'variables' object to go along with the mutation. +* `revert`: A function called with the data returned when an item is created. The object returned by + this function is will be used to later delete the items created. So, make sure RELEVANT DATA IS RETURNED + when a record is created by a mutation. ### Requests @@ -158,7 +158,7 @@ Data of created records are collected and used in the end of a test for the clea ### Parameters -- `config` +* `config` ### _requestCreate @@ -167,8 +167,8 @@ Can be replaced from a custom helper. #### Parameters -- `operation` **[string][4]** -- `variables` **any** to be sent along with the query +* `operation` **[string][4]** +* `variables` **any** to be sent along with the query ### _requestDelete @@ -177,8 +177,8 @@ Can be replaced from a custom helper. #### Parameters -- `operation` **[string][4]** -- `data` **any** of the record to be deleted. +* `operation` **[string][4]** +* `data` **any** of the record to be deleted. ### mutateData @@ -194,8 +194,8 @@ const user = await I.mutateData('createUser', { email: 'user@user.com'}); #### Parameters -- `operation` **[string][4]** to be performed -- `params` **any** predefined parameters +* `operation` **[string][4]** to be performed +* `params` **any** predefined parameters ### mutateMultiple @@ -211,9 +211,9 @@ I.mutateMultiple('createUser', 3, { age: 25 }); #### Parameters -- `operation` **[string][4]** -- `times` **[number][5]** -- `params` **any** +* `operation` **[string][4]** +* `times` **[number][5]** +* `params` **any** [1]: https://github.com/rosiejs/rosie diff --git a/docs/helpers/JSONResponse.md b/docs/helpers/JSONResponse.md index 1126ce1..8cc350f 100644 --- a/docs/helpers/JSONResponse.md +++ b/docs/helpers/JSONResponse.md @@ -13,15 +13,15 @@ title: JSONResponse This helper allows performing assertions on JSON responses paired with following helpers: -- REST -- GraphQL -- Playwright +* REST +* GraphQL +* Playwright It can check status codes, response data, response structure. ## Configuration -- `requestHelper` - a helper which will perform requests. `REST` by default, also `Playwright` or `GraphQL` can be used. Custom helpers must have `onResponse` hook in their config, which will be executed when request is performed. +* `requestHelper` - a helper which will perform requests. `REST` by default, also `Playwright` or `GraphQL` can be used. Custom helpers must have `onResponse` hook in their config, which will be executed when request is performed. ### Examples @@ -68,7 +68,7 @@ const response = this.helpers.JSONResponse.response; ### Parameters -- `config` +* `config` ### dontSeeResponseCodeIs @@ -80,7 +80,7 @@ I.dontSeeResponseCodeIs(500); #### Parameters -- `code` **[number][1]** +* `code` **[number][1]** ### dontSeeResponseContainsJson @@ -102,7 +102,7 @@ I.dontSeeResponseContainsJson({ user: 2 }); #### Parameters -- `json` **[object][2]** +* `json` **[object][2]** ### seeResponseCodeIs @@ -114,7 +114,7 @@ I.seeResponseCodeIs(200); #### Parameters -- `code` **[number][1]** +* `code` **[number][1]** ### seeResponseCodeIsClientError @@ -157,7 +157,7 @@ I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }); #### Parameters -- `json` **[object][2]** +* `json` **[object][2]** ### seeResponseContainsKeys @@ -179,7 +179,7 @@ I.seeResponseContainsKeys(['user']); #### Parameters -- `keys` **[array][3]** +* `keys` **[array][3]** ### seeResponseEquals @@ -193,7 +193,7 @@ I.seeResponseEquals({ error: 'Not allowed' }) #### Parameters -- `resp` **[object][2]** +* `resp` **[object][2]** ### seeResponseMatchesJsonSchema @@ -223,7 +223,7 @@ I.seeResponseMatchesJsonSchema(joi.object({ #### Parameters -- `fnOrSchema` **any** +* `fnOrSchema` **any** ### seeResponseValidByCallback @@ -239,7 +239,7 @@ I.seeResponseValidByCallback(({ data, status, expect }) => { #### Parameters -- `fn` **[function][6]** +* `fn` **[function][6]** [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number diff --git a/docs/helpers/MockRequest.md b/docs/helpers/MockRequest.md index 9ca18d1..3fd1799 100644 --- a/docs/helpers/MockRequest.md +++ b/docs/helpers/MockRequest.md @@ -17,11 +17,11 @@ Another way of using is to emulate requests from server by passing prepared data MockRequest helper works in these [modes][1]: -- passthrough (default) - mock prefefined HTTP requests -- record - record all requests into a file -- replay - replay all recorded requests from a file +* passthrough (default) - mock prefefined HTTP requests +* record - record all requests into a file +* replay - replay all recorded requests from a file -Combining record/replay modes allows testing websites with large datasets. +Combining record/replay modes allows testing websites with large datasets. To use in passthrough mode set rules to mock requests and they will be automatically intercepted and replaced: @@ -83,9 +83,9 @@ helpers: { } ``` -* * * +*** -**TROUBLESHOOTING**: Puppeteer does not mock requests in headless mode: +**TROUBLESHOOTING**: Puppeteer does not mock requests in headless mode: Problem: request mocking does not work and in debug mode you see this in output: @@ -104,7 +104,7 @@ Solution: update Puppeteer config to include `--disable-web-security` arguments: }, ``` -* * * +*** #### With WebDriver @@ -129,10 +129,10 @@ helpers: { To intercept API requests and mock them use following API -- [startMocking()][4] - to enable request interception -- [mockRequest()][5] - to define mock in a simple way -- [mockServer()][6] - to use PollyJS server API to define complex mocks -- [stopMocking()][7] - to stop intercepting requests and disable mocks. +* [startMocking()][4] - to enable request interception +* [mockRequest()][5] - to define mock in a simple way +* [mockServer()][6] - to use PollyJS server API to define complex mocks +* [stopMocking()][7] - to stop intercepting requests and disable mocks. Calling `mockRequest` or `mockServer` will start mocking, if it was not enabled yet. @@ -156,7 +156,7 @@ I.stopMocking(); > At this moment works only with Puppeteer Record & Replay mode allows you to record all xhr & fetch requests and save them to file. -On next runs those requests can be replayed. +On next runs those requests can be replayed. By default, it stores all passed requests, but this behavior can be customized with `I.mockServer` Set mode via enironment variable, `replay` mode by default: @@ -195,7 +195,7 @@ I.mockServer((server) => { To stop request recording/replaying use `I.stopMocking()`. -🎥 To record HTTP interactions execute tests with MOCK_MODE environment variable set as "record": +🎥 To record HTTP interactions execute tests with MOCK\_MODE environment variable set as "record": MOCK_MODE=record npx codeceptjs run --debug @@ -205,7 +205,7 @@ To stop request recording/replaying use `I.stopMocking()`. ### Parameters -- `config` +* `config` ### flushMocking @@ -234,10 +234,10 @@ I.mockRequest('GET', ['/secrets', '/v2/secrets'], 403); #### Parameters -- `method` **[string][8]** request method. Can be `GET`, `POST`, `PUT`, etc or `ANY`. -- `oneOrMoreUrls` **([string][8] \| [Array][9]<[string][8]>)** url(s) to mock. Can be exact URL, a pattern, or an array of URLs. -- `dataOrStatusCode` **([number][10] \| [string][8] \| [object][11])** status code when number provided. A response body otherwise -- `additionalData` **([string][8] \| [object][11])** response body when a status code is set by previous parameter. (optional, default `null`) +* `method` **[string][8]** request method. Can be `GET`, `POST`, `PUT`, etc or `ANY`. +* `oneOrMoreUrls` **([string][8] | [Array][9]<[string][8]>)** url(s) to mock. Can be exact URL, a pattern, or an array of URLs. +* `dataOrStatusCode` **([number][10] | [string][8] | [object][11])** status code when number provided. A response body otherwise +* `additionalData` **([string][8] | [object][11])** response body when a status code is set by previous parameter. (optional, default `null`) ### mockServer @@ -274,7 +274,7 @@ I.mockServer((server) => { #### Parameters -- `configFn` +* `configFn` ### passthroughMocking @@ -336,8 +336,8 @@ I.startMocking('users-loaded', { #### Parameters -- `title` **any** (optional, default `'Test'`) -- `config` (optional, default `{}`) +* `title` **any** (optional, default `'Test'`) +* `config` (optional, default `{}`) ### stopMocking diff --git a/docs/helpers/Nightmare.md b/docs/helpers/Nightmare.md index 0a6e8a3..ce1deb3 100644 --- a/docs/helpers/Nightmare.md +++ b/docs/helpers/Nightmare.md @@ -22,25 +22,26 @@ Requires `nightmare` package to be installed. This helper should be configured in codecept.conf.ts or codecept.conf.js -- `url` - base url of website to be tested -- `restart` - restart browser between tests. -- `disableScreenshots` - don't save screenshot on failure. -- `uniqueScreenshotNames` - option to prevent screenshot override if you have scenarios with the same name in different suites. -- `fullPageScreenshots` - make full page screenshots on failure. -- `keepBrowserState` - keep browser state between tests when `restart` set to false. -- `keepCookies` - keep cookies between tests when `restart` set to false. -- `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 500. -- `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000. -- `windowSize`: (optional) default window size. Set a dimension like `640x480`. +* `url` - base url of website to be tested +* `restart` - restart browser between tests. +* `disableScreenshots` - don't save screenshot on failure. +* `uniqueScreenshotNames` - option to prevent screenshot override if you have scenarios with the same name in different suites. +* `fullPageScreenshots` - make full page screenshots on failure. +* `keepBrowserState` - keep browser state between tests when `restart` set to false. +* `keepCookies` - keep cookies between tests when `restart` set to false. +* `waitForAction`: (optional) how long to wait after click, doubleClick or PressKey actions in ms. Default: 500. +* `waitForTimeout`: (optional) default wait* timeout in ms. Default: 1000. +* `windowSize`: (optional) default window size. Set a dimension like `640x480`. + -- options from [Nightmare configuration][2] +* options from [Nightmare configuration][2] ## Methods ### Parameters -- `config` +* `config` ### _locate @@ -64,7 +65,7 @@ let value = this.helpers['Nightmare']._locate({name: 'password'}).then(function( #### Parameters -- `locator` +* `locator` ### amOnPage @@ -79,8 +80,8 @@ I.amOnPage('/login'); // opens a login page #### Parameters -- `url` **[string][3]** url path or global url. -- `headers` **[object][4]?** list of request headers can be passed +* `url` **[string][3]** url path or global url. +* `headers` **[object][4]?** list of request headers can be passed Returns **void** automatically synchronized promise through #recorder @@ -97,8 +98,8 @@ I.appendField('password', secret('123456')); #### Parameters -- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator -- `value` **[string][3]** text value to append. +* `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator +* `value` **[string][3]** text value to append. Returns **void** automatically synchronized promise through #recorder @@ -115,8 +116,8 @@ I.attachFile('form input[name=avatar]', 'data/avatar.jpg'); #### Parameters -- `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator. -- `pathToFile` **[string][3]** local file path relative to codecept.conf.ts or codecept.conf.js config file. +* `locator` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator. +* `pathToFile` **[string][3]** local file path relative to codecept.conf.ts or codecept.conf.js config file. Returns **void** automatically synchronized promise through #recorderDoesn't work if the Chromium DevTools panel is open (as Chromium allows only one attachment to the debugger at a time. [See more][5]) @@ -135,8 +136,8 @@ I.checkOption('agree', '//form'); #### Parameters -- `field` **([string][3] | [object][4])** checkbox located by label | name | CSS | XPath | strict locator. -- `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator. +* `field` **([string][3] | [object][4])** checkbox located by label | name | CSS | XPath | strict locator. +* `context` **([string][3]? | [object][4])** (optional, `null` by default) element located by CSS | XPath | strict locator. Returns **void** automatically synchronized promise through #recorder @@ -152,7 +153,7 @@ I.clearCookie('test'); // Playwright currently doesn't support clear a particula #### Parameters -- `cookie` **[string][3]?** (optional, `null` by default) cookie name +* `cookie` **[string][3]?** (optional, `null` by default) cookie name ### clearField @@ -166,8 +167,8 @@ I.clearField('#email'); #### Parameters -- `field` -- `editable` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator. +* `field` +* `editable` **([string][3] | [object][4])** field located by label|name|CSS|XPath|strict locator. Returns **void** automatically synchronized promise through #recorder. @@ -197,8 +198,8 @@ I.click({css: 'nav a.login'}); #### Parameters -- `locator` **([string][3] | [object][4])** clickable link or button located by text, or any element located by CSS|XPath|strict locator. -- `context` **([string][3]? | [object][4] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator. +* `locator` **([string][3] | [object][4])** clickable link or button located by text, or any element located by CSS|XPath|strict locator. +* `context` **([string][3]? | [object][4] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator. Returns **void** automatically synchronized promise through #recorder @@ -214,8 +215,8 @@ I.dontSee('Login', '.nav'); // no login inside .nav element #### Parameters -- `text` **[string][3]** which is not present. -- `context` **([string][3] | [object][4])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search. +* `text` **[string][3]** which is not present. +* `context` **([string][3] | [object][4])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search. Returns **void** automatically synchronized promise through #recorder @@ -231,7 +232,7 @@ I.dontSeeCheckboxIsChecked('agree'); // located by name #### Parameters -- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator. +* `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator. Returns **void** automatically synchronized promise through #recorder @@ -245,7 +246,7 @@ I.dontSeeCookie('auth'); // no auth cookie #### Parameters -- `name` **[string][3]** cookie name. +* `name` **[string][3]** cookie name. Returns **void** automatically synchronized promise through #recorder @@ -261,7 +262,7 @@ I.dontSeeCurrentUrlEquals('http://mysite.com/login'); // absolute urls are also #### Parameters -- `url` **[string][3]** value to check. +* `url` **[string][3]** value to check. Returns **void** automatically synchronized promise through #recorder @@ -275,7 +276,7 @@ I.dontSeeElement('.modal'); // modal is not shown #### Parameters -- `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator. +* `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator. Returns **void** automatically synchronized promise through #recorder @@ -289,7 +290,7 @@ I.dontSeeElementInDOM('.nav'); // checks that element is not on page visible or #### Parameters -- `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator. +* `locator` **([string][3] | [object][4])** located by CSS|XPath|Strict locator. Returns **void** automatically synchronized promise through #recorder @@ -299,7 +300,7 @@ Checks that current url does not contain a provided fragment. #### Parameters -- `url` **[string][3]** value to check. +* `url` **[string][3]** value to check. Returns **void** automatically synchronized promise through #recorder @@ -315,8 +316,8 @@ I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS #### Parameters -- `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator. -- `value` **([string][3] | [object][4])** value to check. +* `field` **([string][3] | [object][4])** located by label|name|CSS|XPath|strict locator. +* `value` **([string][3] | [object][4])** value to check. Returns **void** automatically synchronized promise through #recorder @@ -330,8 +331,8 @@ I.dontSeeInSource(' + yarn add -D @faker-js/faker Add this plugin to config file: @@ -646,7 +647,7 @@ Scenario Outline: ... ### Parameters -- `config` +* `config` ## heal @@ -664,11 +665,11 @@ plugins: { More config options are available: -- `healLimit` - how many steps can be healed in a single test (default: 2) +* `healLimit` - how many steps can be healed in a single test (default: 2) ### Parameters -- `config` (optional, default `{}`) +* `config` (optional, default `{}`) ## pauseOnFail @@ -708,20 +709,20 @@ Run tests with plugin enabled: #### Configuration: -- `retries` - number of retries (by default 3), -- `when` - function, when to perform a retry (accepts error as parameter) -- `factor` - The exponential factor to use. Default is 1.5. -- `minTimeout` - The number of milliseconds before starting the first retry. Default is 1000. -- `maxTimeout` - The maximum number of milliseconds between two retries. Default is Infinity. -- `randomize` - Randomizes the timeouts by multiplying with a factor from 1 to 2. Default is false. -- `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes: - - `amOnPage` - - `wait*` - - `send*` - - `execute*` - - `run*` - - `have*` -- `ignoredSteps` - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list. +* `retries` - number of retries (by default 3), +* `when` - function, when to perform a retry (accepts error as parameter) +* `factor` - The exponential factor to use. Default is 1.5. +* `minTimeout` - The number of milliseconds before starting the first retry. Default is 1000. +* `maxTimeout` - The maximum number of milliseconds between two retries. Default is Infinity. +* `randomize` - Randomizes the timeouts by multiplying with a factor from 1 to 2. Default is false. +* `defaultIgnoredSteps` - an array of steps to be ignored for retry. Includes: + * `amOnPage` + * `wait*` + * `send*` + * `execute*` + * `run*` + * `have*` +* `ignoredSteps` - an array for custom steps to ignore on retry. Use it to append custom steps to ignored list. You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`. To append your own steps to ignore list - copy and paste a default steps list. Regexp values are accepted as well. @@ -753,7 +754,7 @@ Scenario('scenario tite', () => { ### Parameters -- `config` +* `config` ## retryTo @@ -806,13 +807,13 @@ Disables retryFailedStep plugin for steps inside a block; Use this plugin if: -- you need repeat a set of actions in flaky tests -- iframe was not rendered and you need to retry switching to it +* you need repeat a set of actions in flaky tests +* iframe was not rendered and you need to retry switching to it #### Configuration -- `pollInterval` - default interval between retries in ms. 200 by default. -- `registerGlobal` - to register `retryTo` function globally, true by default +* `pollInterval` - default interval between retries in ms. 200 by default. +* `registerGlobal` - to register `retryTo` function globally, true by default If `registerGlobal` is false you can use retryTo from the plugin: @@ -822,7 +823,7 @@ const retryTo = codeceptjs.container.plugins('retryTo'); ### Parameters -- `config` +* `config` ## screenshotOnFail @@ -846,12 +847,12 @@ plugins: { Possible config options: -- `uniqueScreenshotNames`: use unique names for screenshot. Default: false. -- `fullPageScreenshots`: make full page screenshots. Default: false. +* `uniqueScreenshotNames`: use unique names for screenshot. Default: false. +* `fullPageScreenshots`: make full page screenshots. Default: false. ### Parameters -- `config` +* `config` ## selenoid @@ -908,7 +909,7 @@ This is especially useful for Continous Integration server as you can configure 1. Create `browsers.json` file in the same directory `codecept.conf.js` is located [Refer to Selenoid documentation][15] to know more about browsers.json. -_Sample browsers.json_ +*Sample browsers.json* ```js { @@ -968,7 +969,7 @@ When `allure` plugin is enabled a video is attached to report automatically. ### Parameters -- `config` +* `config` ## stepByStepReport @@ -994,17 +995,17 @@ Run tests with plugin enabled: Possible config options: -- `deleteSuccessful`: do not save screenshots for successfully executed tests. Default: true. -- `animateSlides`: should animation for slides to be used. Default: true. -- `ignoreSteps`: steps to ignore in report. Array of RegExps is expected. Recommended to skip `grab*` and `wait*` steps. -- `fullPageScreenshots`: should full page screenshots be used. Default: false. -- `output`: a directory where reports should be stored. Default: `output`. -- `screenshotsForAllureReport`: If Allure plugin is enabled this plugin attaches each saved screenshot to allure report. Default: false. -- \`disableScreenshotOnFail : Disables the capturing of screeshots after the failed step. Default: true. +* `deleteSuccessful`: do not save screenshots for successfully executed tests. Default: true. +* `animateSlides`: should animation for slides to be used. Default: true. +* `ignoreSteps`: steps to ignore in report. Array of RegExps is expected. Recommended to skip `grab*` and `wait*` steps. +* `fullPageScreenshots`: should full page screenshots be used. Default: false. +* `output`: a directory where reports should be stored. Default: `output`. +* `screenshotsForAllureReport`: If Allure plugin is enabled this plugin attaches each saved screenshot to allure report. Default: false. +* \`disableScreenshotOnFail : Disables the capturing of screeshots after the failed step. Default: true. ### Parameters -- `config` **any** +* `config` **any** ## stepTimeout @@ -1026,16 +1027,18 @@ Run tests with plugin enabled: #### Configuration: -- `timeout` - global step timeout, default 150 seconds -- `overrideStepLimits` - whether to use timeouts set in plugin config to override step timeouts set in code with I.limitTime(x).action(...), default false -- `noTimeoutSteps` - an array of steps with no timeout. Default: +* `timeout` - global step timeout, default 150 seconds + +* `overrideStepLimits` - whether to use timeouts set in plugin config to override step timeouts set in code with I.limitTime(x).action(...), default false - - `amOnPage` - - `wait*` +* `noTimeoutSteps` - an array of steps with no timeout. Default: + + * `amOnPage` + * `wait*` you could set your own noTimeoutSteps which would replace the default one. -- `customTimeoutSteps` - an array of step actions with custom timeout. Use it to override or extend noTimeoutSteps. +* `customTimeoutSteps` - an array of step actions with custom timeout. Use it to override or extend noTimeoutSteps. You can use step names or step prefixes ending with `*`. As such, `wait*` will match all steps starting with `wait`. #### Example @@ -1059,7 +1062,7 @@ plugins: { ### Parameters -- `config` +* `config` ## subtitles @@ -1102,15 +1105,16 @@ Disables retryFailedStep plugin for steps inside a block; Use this plugin if: -- you need to perform multiple assertions inside a test -- there is A/B testing on a website you test -- there is "Accept Cookie" banner which may surprisingly appear on a page. +* you need to perform multiple assertions inside a test +* there is A/B testing on a website you test +* there is "Accept Cookie" banner which may surprisingly appear on a page. #### Usage #### Multiple Conditional Assertions ````js + Add assert requires first: ```js const assert = require('assert'); @@ -1121,15 +1125,18 @@ const result1 = await tryTo(() => I.see('Hello, user')); const result2 = await tryTo(() => I.seeElement('.welcome')); assert.ok(result1 && result2, 'Assertions were not succesful'); - ##### Optional click +```` + +##### Optional click - ```js - I.amOnPage('/'); - tryTo(() => I.click('Agree', '.cookies')); +```js +I.amOnPage('/'); +tryTo(() => I.click('Agree', '.cookies')); +```` #### Configuration -- `registerGlobal` - to register `tryTo` function globally, true by default +* `registerGlobal` - to register `tryTo` function globally, true by default If `registerGlobal` is false you can use tryTo from the plugin: @@ -1139,7 +1146,7 @@ const tryTo = codeceptjs.container.plugins('tryTo'); ### Parameters -- `config` +* `config` ## wdio @@ -1147,11 +1154,11 @@ Webdriverio services runner. This plugin allows to run webdriverio services like: -- selenium-standalone -- sauce -- testingbot -- browserstack -- appium +* selenium-standalone +* sauce +* testingbot +* browserstack +* appium A complete list of all available services can be found on [webdriverio website][19]. @@ -1165,7 +1172,7 @@ See examples below: #### Selenium Standalone Service -Install `@wdio/selenium-standalone-service` package, as [described here][20]. +Install ` @wdio/selenium-standalone-service` package, as [described here][20]. It is important to make sure it is compatible with current webdriverio version. Enable `wdio` plugin in plugins list and add `selenium-standalone` service: @@ -1199,18 +1206,18 @@ plugins: { } ``` -* * * +*** In the same manner additional services from webdriverio can be installed, enabled, and configured. #### Configuration -- `services` - list of enabled services -- ... - additional configuration passed into services. +* `services` - list of enabled services +* ... - additional configuration passed into services. ### Parameters -- `config` +* `config` [1]: https://github.com/cenfun/monocart-coverage-reports?tab=readme-ov-file#default-options