diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bbbcf4c35..0c6b96faf 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,17 +1,17 @@ version: 2 updates: # github-actions - - package-ecosystem: "github-actions" - directory: "/" + - package-ecosystem: 'github-actions' + directory: '/' schedule: - interval: "weekly" - target-branch: "3.x" + interval: 'weekly' + target-branch: '3.x' # npm - - package-ecosystem: "npm" - directory: "/" + - package-ecosystem: 'npm' + directory: '/' schedule: - interval: "weekly" - target-branch: "3.x" + interval: 'weekly' + target-branch: '3.x' ignore: - - dependency-name: "escape-string-regexp" - versions: [">=5.0"] + - dependency-name: 'escape-string-regexp' + versions: ['>=5.0'] diff --git a/.github/workflows/acceptance-tests.yml b/.github/workflows/acceptance-tests.yml index ed1cc7135..63107de63 100644 --- a/.github/workflows/acceptance-tests.yml +++ b/.github/workflows/acceptance-tests.yml @@ -15,7 +15,6 @@ env: jobs: build: - runs-on: ubuntu-latest strategy: diff --git a/.github/workflows/expectHelper.yml b/.github/workflows/expectHelper.yml deleted file mode 100644 index 8f9a6ee11..000000000 --- a/.github/workflows/expectHelper.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Expect Helper Tests - -on: - push: - branches: - - 3.x - pull_request: - branches: - - '**' - -env: - CI: true - # Force terminal colors. @see https://www.npmjs.com/package/colors - FORCE_COLOR: 1 - -jobs: - build: - - runs-on: ubuntu-22.04 - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: npm install - run: npm i --force - - name: run unit tests - run: ./node_modules/.bin/mocha test/helper/Expect_test.js --timeout 5000 diff --git a/.github/workflows/softExpectHelper.yml b/.github/workflows/softExpectHelper.yml deleted file mode 100644 index 141c056b8..000000000 --- a/.github/workflows/softExpectHelper.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Soft Expect Helper Tests - -on: - push: - branches: - - 3.x - pull_request: - branches: - - '**' - -env: - CI: true - # Force terminal colors. @see https://www.npmjs.com/package/colors - FORCE_COLOR: 1 - -jobs: - build: - - runs-on: ubuntu-22.04 - - strategy: - matrix: - node-version: [20.x] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - name: npm install - run: npm i --force - - name: run unit tests - run: ./node_modules/.bin/mocha test/helper/SoftExpect_test.js --timeout 5000 diff --git a/.husky/pre-commit b/.husky/pre-commit index 635d81b70..3f4f6f4eb 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -1,4 +1,4 @@ -#!/usr/bin/env sh -. "$(dirname -- "$0")/_/husky.sh" - -npm run prettier && npm run lint && npm run dtslint +prettier $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') --write --ignore-unknown +git update-index --again +npx eslint $(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g') +npm run dtslint diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fc27f979..91ef4e214 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,22 +2,24 @@ ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ› *Bug Fixes* +πŸ› _Bug Fixes_ fix(cli): missing failure counts when there is failedHooks (#4633) - by @kobenguyent ## 3.6.9 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ› *Hot Fixes* +πŸ› _Hot Fixes_ fix: could not run tests due to missing `invisi-data` lib - by @kobenguyent ## 3.6.8 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat(cli): mask sensitive data in logs (#4630) - by @kobenguyent +πŸ›©οΈ _Features_ + +- feat(cli): mask sensitive data in logs (#4630) - by @kobenguyent + ``` export const config: CodeceptJS.MainConfig = { tests: '**/*.e2e.test.ts', @@ -33,43 +35,50 @@ export const config: CodeceptJS.MainConfig = { β€Ί [Response] {"access-token": "****"} ``` -* feat(REST): DELETE request supports payload (#4493) - by @schaudhary111 +- feat(REST): DELETE request supports payload (#4493) - by @schaudhary111 ```js -I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' }); +I.sendDeleteRequestWithPayload('/api/users/1', { author: 'john' }) ``` -πŸ› *Bug Fixes* -* fix(playwright): Different behavior of see* and waitFor* when used in within (#4557) - by @kobenguyent -* fix(cli): dry run returns no tests when using a regex grep (#4608) - by @kobenguyent +πŸ› _Bug Fixes_ + +- fix(playwright): Different behavior of see* and waitFor* when used in within (#4557) - by @kobenguyent +- fix(cli): dry run returns no tests when using a regex grep (#4608) - by @kobenguyent + ```bash > codeceptjs dry-run --steps --grep "(?=.*Checkout process)" ``` -* fix: Replace deprecated faker.name with faker.person (#4581) - by @thomashohn -* fix(wdio): Remove dependency to devtools (#4563) - by @thomashohn -* fix(typings): wrong defineParameterType (#4548) - by @kobenguyent -* fix(typing): `Locator.build` complains the empty locator (#4543) - by @kobenguyent -* fix: add hint to `I.seeEmailAttachment` treats parameter as regular expression (#4629) - by @ngraf + +- fix: Replace deprecated faker.name with faker.person (#4581) - by @thomashohn +- fix(wdio): Remove dependency to devtools (#4563) - by @thomashohn +- fix(typings): wrong defineParameterType (#4548) - by @kobenguyent +- fix(typing): `Locator.build` complains the empty locator (#4543) - by @kobenguyent +- fix: add hint to `I.seeEmailAttachment` treats parameter as regular expression (#4629) - by @ngraf + ``` -Add hint to "I.seeEmailAttachment" that under the hood parameter is treated as RegExp. +Add hint to "I.seeEmailAttachment" that under the hood parameter is treated as RegExp. When you don't know it, it can cause a lot of pain, wondering why your test fails with I.seeEmailAttachment('Attachment(1).pdf') although it looks just fine, but actually I.seeEmailAttachment('Attachment\\(1\\).pdf is required to make the test green, in case the attachment is called "Attachment(1).pdf" with special character in it. ``` -* fix(playwright): waitForText fails when text contains double quotes (#4528) - by @DavertMik -* fix(mock-server-helper): move to stand-alone package: https://www.npmjs.com/package/@codeceptjs/mock-server-helper (#4536) - by @kobenguyent -* fix(appium): issue with async on runOnIos and runOnAndroid (#4525) - by @kobenguyent -* fix: push ws messages to array (#4513) - by @kobenguyent -πŸ“– *Documentation* -* fix(docs): typo in ai.md (#4501) - by @tomaculum +- fix(playwright): waitForText fails when text contains double quotes (#4528) - by @DavertMik +- fix(mock-server-helper): move to stand-alone package: https://www.npmjs.com/package/@codeceptjs/mock-server-helper (#4536) - by @kobenguyent +- fix(appium): issue with async on runOnIos and runOnAndroid (#4525) - by @kobenguyent +- fix: push ws messages to array (#4513) - by @kobenguyent + +πŸ“– _Documentation_ + +- fix(docs): typo in ai.md (#4501) - by @tomaculum ## 3.6.6 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat(locator): add withAttrEndsWith, withAttrStartsWith, withAttrContains (#4334) - by @Maksym-Artemenko -* feat: soft assert (#4473) - by @kobenguyent - * Soft assert +πŸ›©οΈ _Features_ + +- feat(locator): add withAttrEndsWith, withAttrStartsWith, withAttrContains (#4334) - by @Maksym-Artemenko +- feat: soft assert (#4473) - by @kobenguyent + - Soft assert Zero-configuration when paired with other helpers like REST, Playwright: @@ -88,21 +97,23 @@ Zero-configuration when paired with other helpers like REST, Playwright: I.softExpectEqual('a', 'b') I.flushSoftAssertions() // Throws an error if any soft assertions have failed. The error message contains all the accumulated failures. ``` -* feat(cli): print failed hooks (#4476) - by @kobenguyent - * run command - ![Screenshot 2024-09-02 at 15 25 20](https://github.com/user-attachments/assets/625c6b54-03f6-41c6-9d0c-cd699582404a) - * run workers command -![Screenshot 2024-09-02 at 15 24 53](https://github.com/user-attachments/assets/efff0312-1229-44b6-a94f-c9b9370b9a64) +- feat(cli): print failed hooks (#4476) - by @kobenguyent -πŸ› *Bug Fixes* -* fix(AI): minor AI improvements - by @DavertMik -* fix(AI): add missing await in AI.js (#4486) - by @tomaculum -* fix(playwright): no async save video page (#4472) - by @kobenguyent -* fix(rest): httpAgent condition (#4484) - by @kobenguyent -* fix: DataCloneError error when `I.executeScript` command is used with `run-workers` (#4483) - by @code4muktesh -* fix: no error thrown from rerun script (#4494) - by @lin-brian-l + - run command + ![Screenshot 2024-09-02 at 15 25 20](https://github.com/user-attachments/assets/625c6b54-03f6-41c6-9d0c-cd699582404a) + - run workers command + ![Screenshot 2024-09-02 at 15 24 53](https://github.com/user-attachments/assets/efff0312-1229-44b6-a94f-c9b9370b9a64) + +πŸ› _Bug Fixes_ + +- fix(AI): minor AI improvements - by @DavertMik +- fix(AI): add missing await in AI.js (#4486) - by @tomaculum +- fix(playwright): no async save video page (#4472) - by @kobenguyent +- fix(rest): httpAgent condition (#4484) - by @kobenguyent +- fix: DataCloneError error when `I.executeScript` command is used with `run-workers` (#4483) - by @code4muktesh +- fix: no error thrown from rerun script (#4494) - by @lin-brian-l ```js // fix the validation of httpAgent config. we could now pass ca, instead of key/cert. @@ -121,15 +132,18 @@ I.flushSoftAssertions() // Throws an error if any soft assertions have failed. T } ``` -πŸ“– *Documentation* -* doc(AI): minor AI improvements - by @DavertMik +πŸ“– _Documentation_ + +- doc(AI): minor AI improvements - by @DavertMik ## 3.6.5 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat(helper): playwright > wait for disabled (#4412) - by @kobenguyent +πŸ›©οΈ _Features_ + +- feat(helper): playwright > wait for disabled (#4412) - by @kobenguyent + ``` it('should wait for input text field to be disabled', () => I.amOnPage('/form/wait_disabled').then(() => I.waitForDisabled('#text', 1))) @@ -148,20 +162,23 @@ Element can be located by CSS or XPath. @returns {void} automatically synchronized promise through #recorder ``` -πŸ› *Bug Fixes* -* fix(AI): AI is not triggered (#4422) - by @kobenguyent -* fix(plugin): stepByStep > report doesn't sync properly (#4413) - by @kobenguyent -* fix: Locator > Unsupported pseudo selector 'has' (#4448) - by @anils92 +πŸ› _Bug Fixes_ + +- fix(AI): AI is not triggered (#4422) - by @kobenguyent +- fix(plugin): stepByStep > report doesn't sync properly (#4413) - by @kobenguyent +- fix: Locator > Unsupported pseudo selector 'has' (#4448) - by @anils92 -πŸ“– *Documentation* -* docs: setup azure open ai using bearer token (#4434) - by @kobenguyent +πŸ“– _Documentation_ + +- docs: setup azure open ai using bearer token (#4434) - by @kobenguyent ## 3.6.4 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat(rest): print curl (#4396) - by @kobenguyent +πŸ›©οΈ _Features_ + +- feat(rest): print curl (#4396) - by @kobenguyent ``` Config: @@ -172,49 +189,55 @@ REST: { printCurl: true, ... } -... +... β€Ί [CURL Request] curl --location --request POST https://httpbin.org/post -H ... ``` -* feat(AI): Generate PageObject, added types, shell improvement (#4319) - by @DavertMik - * added `askForPageObject` method to generate PageObjects on the fly - * improved AI types - * interactive shell improved to restore history +- feat(AI): Generate PageObject, added types, shell improvement (#4319) - by @DavertMik + - added `askForPageObject` method to generate PageObjects on the fly + - improved AI types + - interactive shell improved to restore history ![Screenshot from 2024-06-17 02-47-37](https://github.com/codeceptjs/CodeceptJS/assets/220264/12acd2c7-18d1-4105-a24b-84070ec4d393) -πŸ› *Bug Fixes* -* fix(heal): wrong priority (#4394) - by @kobenguyent +πŸ› _Bug Fixes_ + +- fix(heal): wrong priority (#4394) - by @kobenguyent + +πŸ“– _Documentation_ -πŸ“– *Documentation* -* AI docs improvements by @DavertMik +- AI docs improvements by @DavertMik ## 3.6.3 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat(plugin): coverage with WebDriver - devtools (#4349) - by @KobeNguyent +πŸ›©οΈ _Features_ + +- feat(plugin): coverage with WebDriver - devtools (#4349) - by @KobeNguyent ![Screenshot 2024-05-16 at 16 49 20](https://github.com/codeceptjs/CodeceptJS/assets/7845001/a02f0f99-ac78-4d3f-9774-2cb51c688025) -πŸ› *Bug Fixes* -* fix(cli): stale process (#4367) - by @Horsty80 @kobenguyent -* fix(runner): screenshot error in beforeSuite/AfterSuite (#4385) - by @kobenguyent -* fix(cli): gherkin command init with TypeScript (#4366) - by @andonary -* fix(webApi): error message of dontSeeCookie (#4357) - by @a-stankevich +πŸ› _Bug Fixes_ + +- fix(cli): stale process (#4367) - by @Horsty80 @kobenguyent +- fix(runner): screenshot error in beforeSuite/AfterSuite (#4385) - by @kobenguyent +- fix(cli): gherkin command init with TypeScript (#4366) - by @andonary +- fix(webApi): error message of dontSeeCookie (#4357) - by @a-stankevich -πŸ“– *Documentation* -* fix(doc): Expect helper is not described correctly (#4370) - by @kobenguyent -* fix(docs): some strange characters (#4387) - by @kobenguyent -* fix: Puppeteer helper doc typo (#4369) - by @yoannfleurydev +πŸ“– _Documentation_ + +- fix(doc): Expect helper is not described correctly (#4370) - by @kobenguyent +- fix(docs): some strange characters (#4387) - by @kobenguyent +- fix: Puppeteer helper doc typo (#4369) - by @yoannfleurydev ## 3.6.2 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat(REST): support httpAgent conf (#4328) - by @KobeNguyent +πŸ›©οΈ _Features_ + +- feat(REST): support httpAgent conf (#4328) - by @KobeNguyent Support the httpAgent conf to create the TSL connection via REST helper @@ -235,7 +258,7 @@ Support the httpAgent conf to create the TSL connection via REST helper } ``` -* feat(wd): screenshots for sessions (#4322) - by @KobeNguyent +- feat(wd): screenshots for sessions (#4322) - by @KobeNguyent Currently only screenshot of the active session is saved, this PR aims to save the screenshot of every session for easy debugging @@ -267,20 +290,21 @@ Scenario('should save screenshot for sessions @WebDriverIO @Puppeteer @Playwrigh await I.expectNotEqual(main_original, session_failed); }); ``` -![Screenshot 2024-04-29 at 11 07 47](https://github.com/codeceptjs/CodeceptJS/assets/7845001/5dddf85a-ed77-474b-adfd-2f208d3c16a8) +![Screenshot 2024-04-29 at 11 07 47](https://github.com/codeceptjs/CodeceptJS/assets/7845001/5dddf85a-ed77-474b-adfd-2f208d3c16a8) -* feat: locate element with withClassAttr (#4321) - by @KobeNguyent +- feat: locate element with withClassAttr (#4321) - by @KobeNguyent Find an element with class attribute ```js // find div with class contains 'form' -locate('div').withClassAttr('text'); +locate('div').withClassAttr('text') ``` -* fix(playwright): set the record video resolution (#4311) - by @KobeNguyent -You could now set the recording video resolution +- fix(playwright): set the record video resolution (#4311) - by @KobeNguyent + You could now set the recording video resolution + ``` url: siteUrl, windowSize: '300x500', @@ -297,68 +321,70 @@ You could now set the recording video resolution }, ``` -πŸ› *Bug Fixes* -* fix: several issues of stepByStep report (#4331) - by @KobeNguyent +πŸ› _Bug Fixes_ + +- fix: several issues of stepByStep report (#4331) - by @KobeNguyent -πŸ“– *Documentation* -* fix: wrong format docs (#4330) - by @KobeNguyent -* fix(docs): wrong method is mentioned (#4320) - by @KobeNguyent -* fix: ChatGPT docs - by @davert +πŸ“– _Documentation_ + +- fix: wrong format docs (#4330) - by @KobeNguyent +- fix(docs): wrong method is mentioned (#4320) - by @KobeNguyent +- fix: ChatGPT docs - by @davert ## 3.6.1 -* Fixed regression in interactive pause. +- Fixed regression in interactive pause. ## 3.6.0 -πŸ›©οΈ *Features* +πŸ›©οΈ _Features_ -* Introduced [healers](./heal) to improve stability of failed tests. Write functions that can perform actions to fix a failing test: +- Introduced [healers](./heal) to improve stability of failed tests. Write functions that can perform actions to fix a failing test: ```js heal.addRecipe('reloadPageIfModalIsNotVisisble', { - steps: [ - 'click', - ], + steps: ['click'], fn: async ({ error, step }) => { // this function will be executed only if test failed with // "model is not visible" message - if (error.message.include('modal is not visible')) return; + if (error.message.include('modal is not visible')) return // we return a function that will refresh a page // and tries to perform last step again return async ({ I }) => { - I.reloadPage(); - I.wait(1); - await step.run(); - }; + I.reloadPage() + I.wait(1) + await step.run() + } // if a function succeeds, test continues without an error }, -}); +}) ``` -* **Breaking Change** **AI** features refactored. Read updated [AI guide](./ai): - * **removed dependency on `openai`** - * added support for **Azure OpenAI**, **Claude**, **Mistal**, or any AI via custom request function - * `--ai` option added to explicitly enable AI features - * heal plugin decoupled from AI to run custom heal recipes - * improved healing for async/await scenarios - * token limits added - * token calculation introduced - * `OpenAI` helper renamed to `AI` +- **Breaking Change** **AI** features refactored. Read updated [AI guide](./ai): + - **removed dependency on `openai`** + - added support for **Azure OpenAI**, **Claude**, **Mistal**, or any AI via custom request function + - `--ai` option added to explicitly enable AI features + - heal plugin decoupled from AI to run custom heal recipes + - improved healing for async/await scenarios + - token limits added + - token calculation introduced + - `OpenAI` helper renamed to `AI` -* feat(puppeteer): network traffic manipulation. See #4263 by @KobeNguyenT - * `startRecordingTraffic` - * `grabRecordedNetworkTraffics` - * `flushNetworkTraffics` - * `stopRecordingTraffic` - * `seeTraffic` - * `dontSeeTraffic` +- feat(puppeteer): network traffic manipulation. See #4263 by @KobeNguyenT -* feat(Puppeteer): recording WS messages. See #4264 by @KobeNguyenT + - `startRecordingTraffic` + - `grabRecordedNetworkTraffics` + - `flushNetworkTraffics` + - `stopRecordingTraffic` + - `seeTraffic` + - `dontSeeTraffic` + +- feat(Puppeteer): recording WS messages. See #4264 by @KobeNguyenT Recording WS messages: + ``` I.startRecordingWebSocketMessages(); I.amOnPage('https://websocketstest.com/'); @@ -368,6 +394,7 @@ Recording WS messages: ``` flushing WS messages: + ``` I.startRecordingWebSocketMessages(); I.amOnPage('https://websocketstest.com/'); @@ -381,26 +408,26 @@ Examples: ```js // recording traffics and verify the traffic - I.startRecordingTraffic(); - I.amOnPage('https://codecept.io/'); - I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' }); +I.startRecordingTraffic() +I.amOnPage('https://codecept.io/') +I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' }) ``` ```js // check the traffic with advanced params - I.amOnPage('https://openai.com/blog/chatgpt'); - I.startRecordingTraffic(); - I.seeTraffic({ - name: 'sentry event', - url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600', - parameters: { - width: '1919', - height: '1138', - }, - }); +I.amOnPage('https://openai.com/blog/chatgpt') +I.startRecordingTraffic() +I.seeTraffic({ + name: 'sentry event', + url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600', + parameters: { + width: '1919', + height: '1138', + }, +}) ``` -* Introduce the playwright locator: `_react`, `_vue`, `data-testid` attribute. See #4255 by @KobeNguyenT +- Introduce the playwright locator: `_react`, `_vue`, `data-testid` attribute. See #4255 by @KobeNguyenT ``` Scenario('using playwright locator @Playwright', () => { @@ -424,7 +451,7 @@ Scenario('using playwright data-testid attribute @Playwright', () => { }); ``` -* feat(puppeteer): mockRoute support. See #4262 by @KobeNguyenT +- feat(puppeteer): mockRoute support. See #4262 by @KobeNguyenT Network requests & responses can be mocked and modified. Use `mockRoute` which strictly follows [Puppeteer's setRequestInterception API](https://pptr.dev/next/api/puppeteer.page.setrequestinterception). @@ -438,6 +465,7 @@ I.mockRoute('https://reqres.in/api/comments/1', request => { }); }) ``` + ``` I.mockRoute('**/*.{png,jpg,jpeg}', route => route.abort()); @@ -445,24 +473,26 @@ I.mockRoute('**/*.{png,jpg,jpeg}', route => route.abort()); // for previously mocked URL I.stopMockingRoute('**/*.{png,jpg,jpeg}'); ``` + To master request intercepting [use HTTPRequest object](https://pptr.dev/next/api/puppeteer.httprequest) passed into mock request handler. -πŸ› *Bug Fixes* +πŸ› _Bug Fixes_ -* Fixed double help message #4278 by @masiuchi -* waitNumberOfVisibleElements always failed when passing num as 0. See #4274 by @KobeNguyenT +- Fixed double help message #4278 by @masiuchi +- waitNumberOfVisibleElements always failed when passing num as 0. See #4274 by @KobeNguyenT ## 3.5.15 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat: improve code coverage plugin (#4252) - by @KobeNguyenT +πŸ›©οΈ _Features_ + +- feat: improve code coverage plugin (#4252) - by @KobeNguyenT We revamp the coverage plugin to make it easier to use Once all the tests are completed, `codecept` will create and store coverage in `output/coverage` folder, as shown below. -![]((https://github.com/codeceptjs/CodeceptJS/assets/7845001/3b8b81a3-7c85-470c-992d-ecdc7d5b4a1e)) +![](<(https://github.com/codeceptjs/CodeceptJS/assets/7845001/3b8b81a3-7c85-470c-992d-ecdc7d5b4a1e)>) Open `index.html` in your browser to view the full interactive coverage report. @@ -470,9 +500,10 @@ Open `index.html` in your browser to view the full interactive coverage report. ![](https://github.com/codeceptjs/CodeceptJS/assets/7845001/c821ce45-6590-4ace-b7ae-2cafb3a4e532) -πŸ› *Bug Fixes* -* fix: bump puppeteer to v22.x (#4249) - by @KobeNguyenT -* fix: improve dry-run command (#4225) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- fix: bump puppeteer to v22.x (#4249) - by @KobeNguyenT +- fix: improve dry-run command (#4225) - by @KobeNguyenT dry-run command now supports test level grep. @@ -486,10 +517,10 @@ PUT tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/PUT_test.ts -- 4 ☐ Verify creating new user @Jaja - Total: 2 suites | 3 tests + Total: 2 suites | 3 tests --- DRY MODE: No tests were executed --- -➜ codeceptjs-rest-demo git:(master) βœ— npx codeceptjs dry-run +➜ codeceptjs-rest-demo git:(master) βœ— npx codeceptjs dry-run Tests from /Users/t/Desktop/projects/codeceptjs-rest-demo: DELETE tests -- /Users/t/Desktop/projects/codeceptjs-rest-demo/src/DELETE_test.ts -- 4 tests @@ -506,92 +537,99 @@ PUT tests -- /Users/tDesktop/projects/codeceptjs-rest-demo/src/PUT_test.ts -- 4 ☐ Verify creating new user @Jaja - Total: 4 suites | 8 tests + Total: 4 suites | 8 tests --- DRY MODE: No tests were executed --- ``` -* Several internal fixes and improvements for github workflows +- Several internal fixes and improvements for github workflows ## 3.5.14 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ› *Bug Fixes* -* **Hotfix** Fixed missing `joi` package - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- **Hotfix** Fixed missing `joi` package - by @KobeNguyenT ## 3.5.13 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat: mock server helper (#4155) - by @KobeNguyenT +πŸ›©οΈ _Features_ + +- feat: mock server helper (#4155) - by @KobeNguyenT ![Screenshot 2024-01-25 at 13 47 59](https://github.com/codeceptjs/CodeceptJS/assets/7845001/8fe7aacf-f1c9-4d7e-89a6-3748b3ccb26c) -* feat(webdriver): network traffics manipulation (#4166) - by @KobeNguyenT - [Webdriver] Added commands to check network traffics - supported only with devtoolsProtocol - * `startRecordingTraffic` - * `grabRecordedNetworkTraffics` - * `flushNetworkTraffics` - * `stopRecordingTraffic` - * `seeTraffic` - * `dontSeeTraffic` +- feat(webdriver): network traffics manipulation (#4166) - by @KobeNguyenT + [Webdriver] Added commands to check network traffics - supported only with devtoolsProtocol + - `startRecordingTraffic` + - `grabRecordedNetworkTraffics` + - `flushNetworkTraffics` + - `stopRecordingTraffic` + - `seeTraffic` + - `dontSeeTraffic` Examples: ```js // recording traffics and verify the traffic - I.startRecordingTraffic(); - I.amOnPage('https://codecept.io/'); - I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' }); +I.startRecordingTraffic() +I.amOnPage('https://codecept.io/') +I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' }) ``` ```js // check the traffic with advanced params - I.amOnPage('https://openai.com/blog/chatgpt'); - I.startRecordingTraffic(); - I.seeTraffic({ - name: 'sentry event', - url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600', - parameters: { - width: '1919', - height: '1138', - }, - }); +I.amOnPage('https://openai.com/blog/chatgpt') +I.startRecordingTraffic() +I.seeTraffic({ + name: 'sentry event', + url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600', + parameters: { + width: '1919', + height: '1138', + }, +}) ``` -* feat(webapi): add waitForCookie (#4169) - by @KobeNguyenT + +- feat(webapi): add waitForCookie (#4169) - by @KobeNguyenT Waits for the specified cookie in the cookies. ```js -I.waitForCookie("token"); +I.waitForCookie('token') ``` -πŸ› *Bug Fixes* -* fix(appium): update performSwipe with w3c protocol v2 (#4181) - by @MykaLev -* fix(webapi): selectOption method (#4157) - by @dyaroman -* fix: waitForText doesnt throw error when text doesnt exist (#4195) - by @KobeNguyenT -* fix: use this.options instead of this.config (#4186) - by @KobeNguyenT -* fix: config path without selenium (#4184) - by @KobeNguyenT -* fix: bring to front condition in _setPage (#4173) - by @KobeNguyenT -* fix: complicated locator (#4170) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- fix(appium): update performSwipe with w3c protocol v2 (#4181) - by @MykaLev +- fix(webapi): selectOption method (#4157) - by @dyaroman +- fix: waitForText doesnt throw error when text doesnt exist (#4195) - by @KobeNguyenT +- fix: use this.options instead of this.config (#4186) - by @KobeNguyenT +- fix: config path without selenium (#4184) - by @KobeNguyenT +- fix: bring to front condition in \_setPage (#4173) - by @KobeNguyenT +- fix: complicated locator (#4170) - by @KobeNguyenT Adding of `':nth-child'` into the array -` const limitation = [':nth-of-type', ':first-of-type', ':last-of-type', ':nth-last-child', ':nth-last-of-type', ':checked', ':disabled', ':enabled', ':required', ':lang']; ` fixes the issue. Then an old conversion way over `css-to-xpath` is used. +`const limitation = [':nth-of-type', ':first-of-type', ':last-of-type', ':nth-last-child', ':nth-last-of-type', ':checked', ':disabled', ':enabled', ':required', ':lang'];` fixes the issue. Then an old conversion way over `css-to-xpath` is used. -πŸ“– *Documentation* -* fix(docs): missing docs for codecept UI (#4175) - by @KobeNguyenT -* fix(docs): Appium documentation sidebar menu links (#4188) - by @mirao +πŸ“– _Documentation_ -πŸ›©οΈ **Several bugfixes and improvements for Codecept-UI** -* Several internal improvements -* fix: title is not showing when visiting a test -* fix: handle erros nicely +- fix(docs): missing docs for codecept UI (#4175) - by @KobeNguyenT +- fix(docs): Appium documentation sidebar menu links (#4188) - by @mirao + +πŸ›©οΈ **Several bugfixes and improvements for Codecept-UI** + +- Several internal improvements +- fix: title is not showing when visiting a test +- fix: handle erros nicely ## 3.5.12 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat: upgrade wdio (#4123) - by @KobeNguyenT +πŸ›©οΈ _Features_ + +- feat: upgrade wdio (#4123) - by @KobeNguyenT πŸ›©οΈ With the release of WebdriverIO version `v8.14.0`, and onwards, all driver management hassles are now a thing of the past πŸ™Œ. Read more [here](https://webdriver.io/blog/2023/07/31/driver-management/). One of the significant advantages of this update is that you can now get rid of any driver services you previously had to manage, such as @@ -639,7 +677,8 @@ For example: } } ``` -* feat: wdio with devtools protocol (#4105) - by @KobeNguyenT + +- feat: wdio with devtools protocol (#4105) - by @KobeNguyenT Running with devtools protocol @@ -659,29 +698,34 @@ Running with devtools protocol } } ``` -* feat: add a locator builder method withTextEquals() (#4100) - by @mirao + +- feat: add a locator builder method withTextEquals() (#4100) - by @mirao Find an element with exact text + ```js -locate('button').withTextEquals('Add'); +locate('button').withTextEquals('Add') ``` -* feat: waitForNumberOfTabs (#4124) - by @KobeNguyenT + +- feat: waitForNumberOfTabs (#4124) - by @KobeNguyenT Waits for number of tabs. ```js -I.waitForNumberOfTabs(2); +I.waitForNumberOfTabs(2) ``` -* feat: I.say would be added to Test.steps array (#4145) - by @KobeNguyenT + +- feat: I.say would be added to Test.steps array (#4145) - by @KobeNguyenT Currently `I.say` is not added into the `Test.steps` array. This PR aims to add this to steps array so that we could use it to print steps in ReportPortal for instance. ![Screenshot 2024-01-19 at 15 41 34](https://github.com/codeceptjs/CodeceptJS/assets/7845001/82af552a-aeb3-487e-ac10-b5bb7e42470f) -πŸ› *Bug Fixes* -* fix: reduce the package size to 2MB (#4138) - by @KobeNguyenT -* fix(webapi): see attributes on elements (#4147) - by @KobeNguyenT -* fix: some assertion methods (#4144) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- fix: reduce the package size to 2MB (#4138) - by @KobeNguyenT +- fix(webapi): see attributes on elements (#4147) - by @KobeNguyenT +- fix: some assertion methods (#4144) - by @KobeNguyenT Improve the error message for `seeElement`, `dontSeeElement`, `seeElementInDOM`, `dontSeeElementInDOM` @@ -707,29 +751,29 @@ Updated at Playwright.dontSeeElement (lib/helper/Playwright.js:1472:7) ``` -* fix: css to xpath backward compatibility (#4141) - by @KobeNguyenT +- fix: css to xpath backward compatibility (#4141) - by @KobeNguyenT -- [css-to-xpath](https://www.npmjs.com/package/css-to-xpath): old lib, which works perfectly unless you have hyphen in locator. (https://github.com/codeceptjs/CodeceptJS/issues/3563) -- [csstoxpath](https://www.npmjs.com/package/csstoxpath): new lib, to solve the issue locator with hyphen but also have some [limitations](https://www.npmjs.com/package/csstoxpath#limitations) +* [css-to-xpath](https://www.npmjs.com/package/css-to-xpath): old lib, which works perfectly unless you have hyphen in locator. (https://github.com/codeceptjs/CodeceptJS/issues/3563) +* [csstoxpath](https://www.npmjs.com/package/csstoxpath): new lib, to solve the issue locator with hyphen but also have some [limitations](https://www.npmjs.com/package/csstoxpath#limitations) -* fix: grabRecordedNetworkTraffics throws error when being called twice (#4143) - by @KobeNguyenT -* fix: missing steps of test when running with workers (#4127) - by @KobeNguyenT +- fix: grabRecordedNetworkTraffics throws error when being called twice (#4143) - by @KobeNguyenT +- fix: missing steps of test when running with workers (#4127) - by @KobeNguyenT ```js Scenario('Verify getting list of users', async () => { -let res = await I.getUserPerPage(2); -res.data = []; // this line causes the issue -await I.expectEqual(res.data.data[0].id, 7); -}); + let res = await I.getUserPerPage(2) + res.data = [] // this line causes the issue + await I.expectEqual(res.data.data[0].id, 7) +}) ``` + at this time, res.data.data[0].id would throw undefined error and somehow the test is missing all its steps. -* fix: process.env.profile when --profile isn't set in run-multiple mode (#4131) - by @mirao +- fix: process.env.profile when --profile isn't set in run-multiple mode (#4131) - by @mirao `process.env.profile` is the string "undefined" instead of type undefined when no --profile is specified in the mode "run-multiple" - -* fix: session doesn't respect the context options (#4111) - by @KobeNguyenT +- fix: session doesn't respect the context options (#4111) - by @KobeNguyenT ```js Helpers: Playwright @@ -754,18 +798,18 @@ sessionScreen is {"width":375,"height":667} OK | 1 passed // 4s ``` -* fix(plugin): retryTo issue (#4117) - by @KobeNguyenT +- fix(plugin): retryTo issue (#4117) - by @KobeNguyenT ![Screenshot 2024-01-08 at 17 36 54](https://github.com/codeceptjs/CodeceptJS/assets/7845001/39c97073-e2e9-4c4c-86ee-62540bc95015) -* fix(types): CustomLocator typing broken for custom strict locators (#4120) - by @KobeNguyenT -* fix: wrong output for skipped tests - by @KobeNguyenT -* fix: no retry failed step after tryto block (#4103) - by @KobeNguyenT -* fix: deprecate some JSON Wire Protocol commands (#4104) - by @KobeNguyenT +- fix(types): CustomLocator typing broken for custom strict locators (#4120) - by @KobeNguyenT +- fix: wrong output for skipped tests - by @KobeNguyenT +- fix: no retry failed step after tryto block (#4103) - by @KobeNguyenT +- fix: deprecate some JSON Wire Protocol commands (#4104) - by @KobeNguyenT deprecate some JSON Wire Protocol commands: `grabGeoLocation`, `setGeoLocation` -* fix: cannot locate complicated locator (#4101) - by @KobeNguyenT - +- fix: cannot locate complicated locator (#4101) - by @KobeNguyenT + Locator issue due to the lib changes ``` @@ -778,34 +822,39 @@ The locator locate(".ps-menu-button").withText("Authoring").inside(".ps-submenu- ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat: other locators from playwright (#4090) - by @KobeNguyenT - * CodeceptJS - Playwright now supports other locators like - * React (https://playwright.dev/docs/other-locators#react-locator), - * Vue (https://playwright.dev/docs/other-locators#vue-locator) +πŸ›©οΈ _Features_ + +- feat: other locators from playwright (#4090) - by @KobeNguyenT + - CodeceptJS - Playwright now supports other locators like + - React (https://playwright.dev/docs/other-locators#react-locator), + - Vue (https://playwright.dev/docs/other-locators#vue-locator) ![Vue Locators](https://github.com/codeceptjs/CodeceptJS/assets/7845001/841e9e54-847b-4326-b95f-f9406955a3ce) ![Example](https://github.com/codeceptjs/CodeceptJS/assets/7845001/763e6788-143b-4a00-a249-d9ca5f0b2a09) -πŸ› *Bug Fixes* -* fix: step object is broken when step arg is a function (#4092) - by @KobeNguyenT -* fix: step object is broken when step arg contains joi object (#4084) - by @KobeNguyenT -* fix(expect helper): custom error message as optional param (#4082) - by @KobeNguyenT -* fix(puppeteer): hide deprecation info (#4075) - by @KobeNguyenT -* fix: seeattributesonelements throws error when attribute doesn't exist (#4073) - by @KobeNguyenT -* fix: typo in agrs (#4077) - by @KobeNguyenT -* fix: retryFailedStep is disabled for non tryTo steps (#4069) - by @KobeNguyenT -* fix(typings): scrollintoview complains scrollintoviewoptions (#4067) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- fix: step object is broken when step arg is a function (#4092) - by @KobeNguyenT +- fix: step object is broken when step arg contains joi object (#4084) - by @KobeNguyenT +- fix(expect helper): custom error message as optional param (#4082) - by @KobeNguyenT +- fix(puppeteer): hide deprecation info (#4075) - by @KobeNguyenT +- fix: seeattributesonelements throws error when attribute doesn't exist (#4073) - by @KobeNguyenT +- fix: typo in agrs (#4077) - by @KobeNguyenT +- fix: retryFailedStep is disabled for non tryTo steps (#4069) - by @KobeNguyenT +- fix(typings): scrollintoview complains scrollintoviewoptions (#4067) - by @KobeNguyenT -πŸ“– *Documentation* -* fix(docs): some doc blocks are broken (#4076) - by @KobeNguyenT -* fix(docs): expect docs (#4058) - by @KobeNguyenT +πŸ“– _Documentation_ + +- fix(docs): some doc blocks are broken (#4076) - by @KobeNguyenT +- fix(docs): expect docs (#4058) - by @KobeNguyenT ## 3.5.10 ❀️ Thanks all to those who contributed to make this release! ❀️ -πŸ›©οΈ *Features* -* feat: expose WebElement (#4043) - by @KobeNguyenT +πŸ›©οΈ _Features_ + +- feat: expose WebElement (#4043) - by @KobeNguyenT + ``` Now we expose the WebElements that are returned by the WebHelper and you could make the subsequence actions on them. @@ -815,7 +864,9 @@ I.amOnPage('/form/focus_blur_elements'); const webElements = await I.grabWebElements('#button'); webElements[0].click(); ``` -* feat(playwright): support HAR replaying (#3990) - by @KobeNguyenT + +- feat(playwright): support HAR replaying (#3990) - by @KobeNguyenT + ``` Replaying from HAR @@ -829,11 +880,13 @@ Replaying from HAR harFilePath [string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String) Path to recorded HAR file opts [object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object)? [Options for replaying from HAR](https://playwright.dev/docs/api/class-page#page-route-from-har) ``` -* feat(playwright): support HAR recording (#3986) - by @KobeNguyenT + +- feat(playwright): support HAR recording (#3986) - by @KobeNguyenT + ``` -A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded. -It contains information about the request and response headers, cookies, content, timings, and more. -You can use HAR files to mock network requests in your tests. HAR will be saved to output/har. +A HAR file is an HTTP Archive file that contains a record of all the network requests that are made when a page is loaded. +It contains information about the request and response headers, cookies, content, timings, and more. +You can use HAR files to mock network requests in your tests. HAR will be saved to output/har. More info could be found here https://playwright.dev/docs/api/class-browser#browser-new-context-option-record-har. ... @@ -843,16 +896,20 @@ recordHar: { } ... ``` -* improvement(playwright): support partial string for option (#4016) - by @KobeNguyenT + +- improvement(playwright): support partial string for option (#4016) - by @KobeNguyenT + ``` await I.amOnPage('/form/select'); await I.selectOption('Select your age', '21-'); ``` -πŸ› *Bug Fixes* -* fix(playwright): proceedSee could not find the element (#4006) - by @hatufacci -* fix(appium): remove the vendor prefix of 'bstack:options' (#4053) - by @mojtabaalavi -* fix(workers): event improvements (#3953) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- fix(playwright): proceedSee could not find the element (#4006) - by @hatufacci +- fix(appium): remove the vendor prefix of 'bstack:options' (#4053) - by @mojtabaalavi +- fix(workers): event improvements (#3953) - by @KobeNguyenT + ``` Emit the new event: event.workers.result. @@ -865,7 +922,7 @@ module.exports = function() { event.dispatcher.on(event.workers.result, async () => { await _publishResultsToTestrail(); }); - + // this event would not trigger the `_publishResultsToTestrail` multiple times when running `run-workers` command event.dispatcher.on(event.all.result, async () => { // when running `run` command, this env var is undefined @@ -873,7 +930,9 @@ module.exports = function() { }); } ``` -* fix: ai html updates (#3962) - by @DavertMik + +- fix: ai html updates (#3962) - by @DavertMik + ``` replaced minify library with a modern and more secure fork. Fixes html-minifier@4.0.0 Regular Expression Denial of Service vulnerability #3829 AI class is implemented as singleton @@ -882,18 +941,22 @@ add configuration params on number of fixes performed by ay heal improved recorder class to add more verbose log improved recorder class to ignore some of errors ``` -* fix(appium): closeApp supports both Android/iOS (#4046) - by @KobeNguyenT -* fix: some security vulnerability of some packages (#4045) - by @KobeNguyenT -* fix: seeAttributesOnElements check condition (#4029) - by @KobeNguyenT -* fix: waitForText locator issue (#4039) - by @KobeNguyenT + +- fix(appium): closeApp supports both Android/iOS (#4046) - by @KobeNguyenT +- fix: some security vulnerability of some packages (#4045) - by @KobeNguyenT +- fix: seeAttributesOnElements check condition (#4029) - by @KobeNguyenT +- fix: waitForText locator issue (#4039) - by @KobeNguyenT + ``` Fixed this error: locator.isVisible: Unexpected token "s" while parsing selector ":has-text('Were you able to resolve the resident's issue?') >> nth=0" at Playwright.waitForText (node_modules\codeceptjs\lib\helper\Playwright.js:2584:79) ``` -* fix: move to sha256 (#4038) - by @KobeNguyenT -* fix: respect retries from retryfailedstep plugin in helpers (#4028) - by @KobeNguyenT + +- fix: move to sha256 (#4038) - by @KobeNguyenT +- fix: respect retries from retryfailedstep plugin in helpers (#4028) - by @KobeNguyenT + ``` Currently inside the _before() of helpers for example Playwright, the retries is set there, however, when retryFailedStep plugin is enabled, the retries of recorder is still using the value from _before() not the value from retryFailedStep plugin. @@ -902,7 +965,9 @@ Fix: - introduce the process.env.FAILED_STEP_RETIRES which could be access everywhere as the helper won't know anything about the plugin. - set default retries of Playwright to 3 to be on the same page with Puppeteer. ``` -* fix: examples in test title (#4030) - by @KobeNguyenT + +- fix: examples in test title (#4030) - by @KobeNguyenT + ``` When test title doesn't have the data in examples: @@ -916,7 +981,7 @@ Feature: Faker examples Faker examples -- [1] Starting recording promises - Timeouts: + Timeouts: Below are the users {"user":"John","role":"admin"} βœ” OK in 4ms @@ -937,33 +1002,35 @@ Feature: Faker examples Faker examples -- [1] Starting recording promises - Timeouts: - Below are the users - John - admin + Timeouts: + Below are the users - John - admin βœ” OK in 4ms - Below are the users - Tim - client + Below are the users - Tim - client βœ” OK in 1ms ``` -* fix: disable retryFailedStep when using with tryTo (#4022) - by @KobeNguyenT -* fix: locator builder returns error when class name contains hyphen (#4024) - by @KobeNguyenT -* fix: seeCssPropertiesOnElements failed when font-weight is a number (#4026) - by @KobeNguyenT -* fix(appium): missing await on some steps of runOnIOS and runOnAndroid (#4018) - by @KobeNguyenT -* fix(cli): no error of failed tests when using retry with scenario only (#4020) - by @KobeNguyenT -* fix: set getPageTimeout to 30s (#4031) - by @KobeNguyenT -* fix(appium): expose switchToContext (#4015) - by @KobeNguyenT -* fix: promise issue (#4013) - by @KobeNguyenT -* fix: seeCssPropertiesOnElements issue with improper condition (#4057) - by @KobeNguyenT - -πŸ“– *Documentation* -* docs: Update clearCookie documentation for Playwright helper (#4005) - by @Hellosager -* docs: improve the example code for autoLogin (#4019) - by @KobeNguyenT + +- fix: disable retryFailedStep when using with tryTo (#4022) - by @KobeNguyenT +- fix: locator builder returns error when class name contains hyphen (#4024) - by @KobeNguyenT +- fix: seeCssPropertiesOnElements failed when font-weight is a number (#4026) - by @KobeNguyenT +- fix(appium): missing await on some steps of runOnIOS and runOnAndroid (#4018) - by @KobeNguyenT +- fix(cli): no error of failed tests when using retry with scenario only (#4020) - by @KobeNguyenT +- fix: set getPageTimeout to 30s (#4031) - by @KobeNguyenT +- fix(appium): expose switchToContext (#4015) - by @KobeNguyenT +- fix: promise issue (#4013) - by @KobeNguyenT +- fix: seeCssPropertiesOnElements issue with improper condition (#4057) - by @KobeNguyenT + +πŸ“– _Documentation_ + +- docs: Update clearCookie documentation for Playwright helper (#4005) - by @Hellosager +- docs: improve the example code for autoLogin (#4019) - by @KobeNguyenT ![Screenshot 2023-11-22 at 14 40 11](https://github.com/codeceptjs/CodeceptJS/assets/7845001/c05ac436-efd0-4bc0-a46c-386f915c0f17) ## 3.5.8 Thanks all to those who contributed to make this release! -πŸ› *Bug Fixes* +πŸ› _Bug Fixes_ fix(appium): type of setNetworkConnection() (#3994) - by @mirao fix: improve the way to show deprecated appium v1 message (#3992) - by @KobeNguyenT fix: missing exit condition of some wait functions - by @KobeNguyenT @@ -972,14 +1039,16 @@ fix: missing exit condition of some wait functions - by @KobeNguyenT Thanks all to those who contributed to make this release! -πŸ› *Bug Fixes* -* Bump playwright to 1.39.0 - run `npx playwright install` to install the browsers as starting from 1.39.0 browsers are not installed automatically (#3924) - by @KobeNguyenT -* fix(playwright): some wait functions draw error due to switchTo iframe (#3918) - by @KobeNguyenT -* fix(appium): AppiumTestDistribution/appium-device-farm requires 'platformName' (#3950) - by @rock-tran -* fix: autologin with empty fetch (#3947) - by @andonary -* fix(cli): customLocator draws error in dry-mode (#3940) - by @KobeNguyenT -* fix: ensure docs include @returns Promise where appropriate (#3954) - by @fwouts -* fix: long text in data table cuts off (#3936) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- Bump playwright to 1.39.0 - run `npx playwright install` to install the browsers as starting from 1.39.0 browsers are not installed automatically (#3924) - by @KobeNguyenT +- fix(playwright): some wait functions draw error due to switchTo iframe (#3918) - by @KobeNguyenT +- fix(appium): AppiumTestDistribution/appium-device-farm requires 'platformName' (#3950) - by @rock-tran +- fix: autologin with empty fetch (#3947) - by @andonary +- fix(cli): customLocator draws error in dry-mode (#3940) - by @KobeNguyenT +- fix: ensure docs include @returns Promise where appropriate (#3954) - by @fwouts +- fix: long text in data table cuts off (#3936) - by @KobeNguyenT + ``` #language: de FunktionalitΓ€t: Faker examples @@ -988,51 +1057,58 @@ FunktionalitΓ€t: Faker examples Angenommen que estou logado via REST com o usuΓ‘rio "" | protocol | https: | | hostname | https://cucumber.io/docs/gherkin/languages/ | - + Faker examples -- Atualizar senha do usuΓ‘rio {"product":"{{vehicle.vehicle}}","customer":"Dr. {{name.findName}}","price":"{{commerce.price}}","cashier":"cashier 2"} - On Angenommen: que estou logado via rest com o usuΓ‘rio "dr. {{name.find name}}" - protocol | https: + On Angenommen: que estou logado via rest com o usuΓ‘rio "dr. {{name.find name}}" + protocol | https: hostname | https://cucumber.io/docs/gherkin/languages/ - + Dr. {{name.findName}} βœ” OK in 13ms ``` -* fix(playwright): move to waitFor (#3933) - by @KobeNguyenT -* fix: relax grabCookie type (#3919) - by @KobeNguyenT -* fix: proceedSee error when being called inside within (#3939) - by @KobeNguyenT -* fix: rename haveRequestHeaders of ppt and pw helpers (#3937) - by @KobeNguyenT + +- fix(playwright): move to waitFor (#3933) - by @KobeNguyenT +- fix: relax grabCookie type (#3919) - by @KobeNguyenT +- fix: proceedSee error when being called inside within (#3939) - by @KobeNguyenT +- fix: rename haveRequestHeaders of ppt and pw helpers (#3937) - by @KobeNguyenT + ``` Renamed haveRequestHeaders of Puppeteer, Playwright helper so that it would not confuse the REST helper. Puppeteer: setPuppeteerRequestHeaders Playwright: setPlaywrightRequestHeaders ``` -* improvement: handle the way to load apifactory nicely (#3941) - by @KobeNguyenT + +- improvement: handle the way to load apifactory nicely (#3941) - by @KobeNguyenT + ``` With this fix, we could now use the following syntax: export = new Factory() .attr('name', () => faker.name.findName()) .attr('job', () => 'leader'); - + export default new Factory() .attr('name', () => faker.name.findName()) .attr('job', () => 'leader'); - + modules.export = new Factory() .attr('name', () => faker.name.findName()) .attr('job', () => 'leader'); ``` -πŸ“– *Documentation* -* docs(appium): update to v2 (#3932) - by @KobeNguyenT -* docs: improve BDD Gherkin docs (#3938) - by @KobeNguyenT -* Other docs improvements +πŸ“– _Documentation_ + +- docs(appium): update to v2 (#3932) - by @KobeNguyenT +- docs: improve BDD Gherkin docs (#3938) - by @KobeNguyenT +- Other docs improvements + +πŸ›©οΈ _Features_ + +- feat(puppeteer): support trace recording - by @KobeNguyenT -πŸ›©οΈ *Features* -* feat(puppeteer): support trace recording - by @KobeNguyenT ``` [Trace Recording Customization] Trace recording provides complete information on test execution and includes screenshots, and network requests logged during run. Traces will be saved to output/trace @@ -1040,8 +1116,10 @@ Trace recording provides complete information on test execution and includes scr trace: enables trace recording for failed tests; trace are saved into output/trace folder keepTraceForPassedTests: - save trace for passed tests ``` -* feat: expect helper (#3923) - by @KobeNguyenT -``` + +- feat: expect helper (#3923) - by @KobeNguyenT + +```` * This helper allows performing assertions based on Chai. * * ### Examples @@ -1055,7 +1133,7 @@ keepTraceForPassedTests: - save trace for passed tests * Playwright: {...}, * ExpectHelper: {}, * } - + Expect Helper #expectEqual #expectNotEqual @@ -1084,16 +1162,22 @@ keepTraceForPassedTests: - save trace for passed tests #expectDeepIncludeMembers #expectDeepEqualExcluding #expectLengthBelowThan -``` -* feat: run-workers with multiple browsers output folders - by @KobeNguyenT -- ![Screenshot 2023-11-04 at 10 49 56](https://github.com/codeceptjs/CodeceptJS/assets/7845001/8eaecc54-de14-4597-b148-1e087bec3c76) -- ![Screenshot 2023-11-03 at 15 56 38](https://github.com/codeceptjs/CodeceptJS/assets/7845001/715aed17-3535-48df-80dd-84f7024f08e3) -* feat: introduce new Playwright methods - by @hatufacci +```` + +- feat: run-workers with multiple browsers output folders - by @KobeNguyenT + +* ![Screenshot 2023-11-04 at 10 49 56](https://github.com/codeceptjs/CodeceptJS/assets/7845001/8eaecc54-de14-4597-b148-1e087bec3c76) +* ![Screenshot 2023-11-03 at 15 56 38](https://github.com/codeceptjs/CodeceptJS/assets/7845001/715aed17-3535-48df-80dd-84f7024f08e3) + +- feat: introduce new Playwright methods - by @hatufacci + ``` - grabCheckedElementStatus - grabDisabledElementStatus ``` -* feat: gherkin supports i18n (#3934) - by @KobeNguyenT + +- feat: gherkin supports i18n (#3934) - by @KobeNguyenT + ``` #language: de FunktionalitΓ€t: Checkout-Prozess @@ -1112,7 +1196,9 @@ FunktionalitΓ€t: Checkout-Prozess | price | total | | 10 | 10.0 | ``` -* feat(autoLogin): improve the check method (#3935) - by @KobeNguyenT + +- feat(autoLogin): improve the check method (#3935) - by @KobeNguyenT + ``` Instead of asserting on page elements for the current user in check, you can use the session you saved in fetch @@ -1146,16 +1232,20 @@ Scenario('login', async ( {I, login} ) => { Thanks all to those who contributed to make this release! -πŸ› *Bug Fixes* -* fix: switchTo/within block doesn't switch to expected iframe (#3892) - by @KobeNguyenT -* fix: highlight element doesn't work as expected (#3896) - by @KobeNguyenT +πŸ› _Bug Fixes_ + +- fix: switchTo/within block doesn't switch to expected iframe (#3892) - by @KobeNguyenT +- fix: highlight element doesn't work as expected (#3896) - by @KobeNguyenT + ``` verbose/ highlight TRUE TRUE -> highlight element verbose/ highlight TRUE FALSE -> no highlight element verbose/ highlight FALSE TRUE -> no highlight element verbose/ highlight FALSE FALSE -> no highlight element - ``` -* fix: masked value issue in data table (#3885) - by @KobeNguyenT +``` + +- fix: masked value issue in data table (#3885) - by @KobeNguyenT + ``` const accounts = new DataTable(['role', 'username', 'password']); accounts.add([ @@ -1177,8 +1267,8 @@ Data(accounts) I.amOnPage('/'); loginPage.**sendForm**(current.username, current.password); ) - - + + // output The test feature -- The scenario | {"username":"Username","password": ***} @@ -1192,14 +1282,17 @@ Data(accounts) βœ” OK in 1ms ``` -* fix: debug info causes error (#3882) - by @KobeNguyenT +- fix: debug info causes error (#3882) - by @KobeNguyenT + +πŸ“– _Documentation_ + +- fix: get rid of complaining when using session without await and returning nothing. (#3899) - by @KobeNguyenT +- fix(FileSystem): a typo in writeToFile() (#3897) - by @mirao -πŸ“– *Documentation* -* fix: get rid of complaining when using session without await and returning nothing. (#3899) - by @KobeNguyenT -* fix(FileSystem): a typo in writeToFile() (#3897) - by @mirao +πŸ›©οΈ _Features_ + +- feat(translation): add more french keywords and fix deprecated waitForClickable (#3906) - by @andonary -πŸ›©οΈ *Features* -* feat(translation): add more french keywords and fix deprecated waitForClickable (#3906) - by @andonary ``` - Add some french keywords for translation - I.waitForClickable has the same "attends" than I.wait. Using "attends" leads to use the deprecated waitForClickable. Fix it by using different words. @@ -1208,7 +1301,9 @@ Data(accounts) ## 3.5.5 πŸ› Bug Fixes -* fix(browserstack): issue with vendor prefix (#3845) - by @KobeNguyenT + +- fix(browserstack): issue with vendor prefix (#3845) - by @KobeNguyenT + ``` export const caps = { androidCaps: { @@ -1242,7 +1337,7 @@ export const caps = { } ``` -* switchTo/within now supports strict locator (#3847) - by @KobeNguyenT +- switchTo/within now supports strict locator (#3847) - by @KobeNguyenT ``` I.switchTo({ css: 'iframe[id^=number-frame]' }) // support the strict locator @@ -1258,24 +1353,28 @@ within({ }); ``` -* Improve the IntelliSense when using other languages (#3848) - by @andonary +- Improve the IntelliSense when using other languages (#3848) - by @andonary + ``` include: { Je: './steps_file.js' } ``` -* bypassCSP support for Playwright helper (#3865) - by @sammeel +- bypassCSP support for Playwright helper (#3865) - by @sammeel + ``` helpers: { Playwright: { bypassCSP: true } ``` -* fix: missing requests when recording network (#3834) - by @KobeNguyenT + +- fix: missing requests when recording network (#3834) - by @KobeNguyenT πŸ›©οΈ Features and Improvements -* Show environment info in verbose mode (#3858) - by @KobeNguyenT + +- Show environment info in verbose mode (#3858) - by @KobeNguyenT ``` Environment information:- @@ -1341,9 +1440,9 @@ Please copy environment info when you report issues on GitHub: https://github.co CodeceptJS v3.5.4 #StandWithUkraine ``` -* some typings improvements (#3855) - by @nikzupancic -* support the puppeteer 21.1.1 (#3856) - by @KobeNguyenT -* fix: support secret value for some methods (#3837) - by @KobeNguyenT +- some typings improvements (#3855) - by @nikzupancic +- support the puppeteer 21.1.1 (#3856) - by @KobeNguyenT +- fix: support secret value for some methods (#3837) - by @KobeNguyenT ``` await I.amOnPage('/form/field_values'); @@ -1355,18 +1454,21 @@ await I.dontSeeInField('checkbox[]', secret('not seen three')); await I.seeInField('checkbox[]', secret('see test three')); ``` -πŸ›©οΈ **Several bugfixes and improvements for Codecept-UI** -* Mask the secret value in UI -* Improve UX/UI -* PageObjects are now showing in UI +πŸ›©οΈ **Several bugfixes and improvements for Codecept-UI** + +- Mask the secret value in UI +- Improve UX/UI +- PageObjects are now showing in UI ## 3.5.4 πŸ› Bug Fixes: - * [Playwright] When passing `userDataDir`, it throws error after test execution (#3814) - by @KobeNguyenT - * [CodeceptJS-CLI] Improve command to generate types (#3788) - by @KobeNguyenT - * Heal plugin fix (#3820) - by @davert - * Fix for error in using `all` with `run-workers` (#3805) - by @KobeNguyenT + +- [Playwright] When passing `userDataDir`, it throws error after test execution (#3814) - by @KobeNguyenT +- [CodeceptJS-CLI] Improve command to generate types (#3788) - by @KobeNguyenT +- Heal plugin fix (#3820) - by @davert +- Fix for error in using `all` with `run-workers` (#3805) - by @KobeNguyenT + ```js helpers: { Playwright: { @@ -1389,29 +1491,33 @@ await I.seeInField('checkbox[]', secret('see test three')); }, }, ``` - * Highlight elements issues (#3779) (#3778) - by @philkas - * Support ` ` symbol in `I.see` method (#3815) - by @KobeNguyenT + +- Highlight elements issues (#3779) (#3778) - by @philkas +- Support ` ` symbol in `I.see` method (#3815) - by @KobeNguyenT ```js // HTML code uses   instead of space -
My Text!
+;
+ My Text! +
-I.see("My Text!") // this test would work with both   and space +I.see('My Text!') // this test would work with both   and space ``` πŸ“– Documentation - * Improve the configuration of electron testing when the app is build with electron-forge (#3802) - by @KobeNguyenT + +- Improve the configuration of electron testing when the app is build with electron-forge (#3802) - by @KobeNguyenT ```js -const path = require("path"); +const path = require('path') exports.config = { helpers: { Playwright: { - browser: "electron", + browser: 'electron', electron: { - executablePath: require("electron"), - args: [path.join(__dirname, ".webpack/main/index.js")], + executablePath: require('electron'), + args: [path.join(__dirname, '.webpack/main/index.js')], }, }, }, @@ -1422,26 +1528,28 @@ exports.config = { πŸ›©οΈ Features #### [Playwright] new features and improvements - * Parse the response in recording network steps (#3771) - by @KobeNguyenT + +- Parse the response in recording network steps (#3771) - by @KobeNguyenT ```js - const traffics = await I.grabRecordedNetworkTraffics(); - expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1'); - expect(traffics[0].response.status).to.equal(200); - expect(traffics[0].response.body).to.contain({ name: 'this was mocked' }); +const traffics = await I.grabRecordedNetworkTraffics() +expect(traffics[0].url).to.equal('https://reqres.in/api/comments/1') +expect(traffics[0].response.status).to.equal(200) +expect(traffics[0].response.body).to.contain({ name: 'this was mocked' }) - expect(traffics[1].url).to.equal('https://reqres.in/api/comments/1'); - expect(traffics[1].response.status).to.equal(200); - expect(traffics[1].response.body).to.contain({ name: 'this was another mocked' }); +expect(traffics[1].url).to.equal('https://reqres.in/api/comments/1') +expect(traffics[1].response.status).to.equal(200) +expect(traffics[1].response.body).to.contain({ name: 'this was another mocked' }) ``` - * Grab metrics (#3809) - by @KobeNguyenT + +- Grab metrics (#3809) - by @KobeNguyenT ```js -const metrics = await I.grabMetrics(); +const metrics = await I.grabMetrics() // returned metrics -[ +;[ { name: 'Timestamp', value: 1584904.203473 }, { name: 'AudioHandlers', value: 0 }, { name: 'AudioWorkletProcessors', value: 0 }, @@ -1477,149 +1585,150 @@ const metrics = await I.grabMetrics(); { name: 'JSHeapTotalSize', value: 26820608 }, { name: 'FirstMeaningfulPaint', value: 0 }, { name: 'DomContentLoaded', value: 1584903.690491 }, - { name: 'NavigationStart', value: 1584902.841845 } + { name: 'NavigationStart', value: 1584902.841845 }, ] ``` -* Grab WebSocket (WS) messages (#3789) - by @KobeNguyenT - * `flushWebSocketMessages` - * `grabWebSocketMessages` - * `startRecordingWebSocketMessages` - * `stopRecordingWebSocketMessages` +- Grab WebSocket (WS) messages (#3789) - by @KobeNguyenT + - `flushWebSocketMessages` + - `grabWebSocketMessages` + - `startRecordingWebSocketMessages` + - `stopRecordingWebSocketMessages` ```js -await I.startRecordingWebSocketMessages(); -I.amOnPage('https://websocketstest.com/'); -I.waitForText('Work for You!'); -I.flushNetworkTraffics(); -const wsMessages = I.grabWebSocketMessages(); -expect(wsMessages.length).to.equal(0); +await I.startRecordingWebSocketMessages() +I.amOnPage('https://websocketstest.com/') +I.waitForText('Work for You!') +I.flushNetworkTraffics() +const wsMessages = I.grabWebSocketMessages() +expect(wsMessages.length).to.equal(0) ``` ```js -await I.startRecordingWebSocketMessages(); -await I.amOnPage('https://websocketstest.com/'); -I.waitForText('Work for You!'); -const wsMessages = I.grabWebSocketMessages(); -expect(wsMessages.length).to.greaterThan(0); +await I.startRecordingWebSocketMessages() +await I.amOnPage('https://websocketstest.com/') +I.waitForText('Work for You!') +const wsMessages = I.grabWebSocketMessages() +expect(wsMessages.length).to.greaterThan(0) ``` ```js -await I.startRecordingWebSocketMessages(); -await I.amOnPage('https://websocketstest.com/'); -I.waitForText('Work for You!'); -const wsMessages = I.grabWebSocketMessages(); -await I.stopRecordingWebSocketMessages(); -await I.amOnPage('https://websocketstest.com/'); -I.waitForText('Work for You!'); -const afterWsMessages = I.grabWebSocketMessages(); -expect(wsMessages.length).to.equal(afterWsMessages.length); +await I.startRecordingWebSocketMessages() +await I.amOnPage('https://websocketstest.com/') +I.waitForText('Work for You!') +const wsMessages = I.grabWebSocketMessages() +await I.stopRecordingWebSocketMessages() +await I.amOnPage('https://websocketstest.com/') +I.waitForText('Work for You!') +const afterWsMessages = I.grabWebSocketMessages() +expect(wsMessages.length).to.equal(afterWsMessages.length) ``` -* Move from `ElementHandle` to `Locator`. This change is quite major, but it happened under hood, so should not affect your code. (#3738) - by @KobeNguyenT +- Move from `ElementHandle` to `Locator`. This change is quite major, but it happened under hood, so should not affect your code. (#3738) - by @KobeNguyenT ## 3.5.3 πŸ›©οΈ Features -* [Playwright] Added commands to check network traffic #3748 - by @ngraf @KobeNguyenT - * `startRecordingTraffic` - * `grabRecordedNetworkTraffics` - * `blockTraffic` - * `mockTraffic` - * `flushNetworkTraffics` - * `stopRecordingTraffic` - * `seeTraffic` - * `grabTrafficUrl` - * `dontSeeTraffic` +- [Playwright] Added commands to check network traffic #3748 - by @ngraf @KobeNguyenT + - `startRecordingTraffic` + - `grabRecordedNetworkTraffics` + - `blockTraffic` + - `mockTraffic` + - `flushNetworkTraffics` + - `stopRecordingTraffic` + - `seeTraffic` + - `grabTrafficUrl` + - `dontSeeTraffic` Examples: ```js // recording traffics and verify the traffic - await I.startRecordingTraffic(); - I.amOnPage('https://codecept.io/'); - await I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' }); +await I.startRecordingTraffic() +I.amOnPage('https://codecept.io/') +await I.seeTraffic({ name: 'traffics', url: 'https://codecept.io/img/companies/BC_LogoScreen_C.jpg' }) ``` ```js // block the traffic - I.blockTraffic('https://reqres.in/api/comments/*'); - await I.amOnPage('/form/fetch_call'); - await I.startRecordingTraffic(); - await I.click('GET COMMENTS'); - await I.see('Can not load data!'); +I.blockTraffic('https://reqres.in/api/comments/*') +await I.amOnPage('/form/fetch_call') +await I.startRecordingTraffic() +await I.click('GET COMMENTS') +await I.see('Can not load data!') ``` ```js // check the traffic with advanced params - I.amOnPage('https://openai.com/blog/chatgpt'); - await I.startRecordingTraffic(); - await I.seeTraffic({ - name: 'sentry event', - url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600', - parameters: { - width: '1919', - height: '1138', - }, - }); +I.amOnPage('https://openai.com/blog/chatgpt') +await I.startRecordingTraffic() +await I.seeTraffic({ + name: 'sentry event', + url: 'https://images.openai.com/blob/cf717bdb-0c8c-428a-b82b-3c3add87a600', + parameters: { + width: '1919', + height: '1138', + }, +}) ``` πŸ› Bugfix -* [retryStepPlugin] Fix retry step when using global retry #3768 - by @KobeNguyenT +- [retryStepPlugin] Fix retry step when using global retry #3768 - by @KobeNguyenT πŸ—‘ Deprecated -* Nightmare and Protractor helpers have been deprecated +- Nightmare and Protractor helpers have been deprecated ## 3.5.2 πŸ› Bug Fixes -* [Playwright] reverted `clearField` to previous implementation -* [OpenAI] fixed running helper in pause mode. #3755 by @KobeNguyenT +- [Playwright] reverted `clearField` to previous implementation +- [OpenAI] fixed running helper in pause mode. #3755 by @KobeNguyenT ## 3.5.1 πŸ›©οΈ Features -* [Puppeteer][WebDriver][TestCafe] Added methods by @KobeNguyenT in #3737 - * `blur` - * `focus` -* Improved BDD output to print steps without `I.` commands` by @davertmik #3739 -* Improved `codecept init` setup for Electron tests by @KobeNguyenT. See #3733 +- [Puppeteer][WebDriver][TestCafe] Added methods by @KobeNguyenT in #3737 + - `blur` + - `focus` +- Improved BDD output to print steps without `I.` commands` by @davertmik #3739 +- Improved `codecept init` setup for Electron tests by @KobeNguyenT. See #3733 πŸ› Bug Fixes -* Fixed serializing of custom errors making tests stuck. Fix #3739 by @davertmik. +- Fixed serializing of custom errors making tests stuck. Fix #3739 by @davertmik. πŸ“– Documentation -* Fixed Playwright docs by @Horsty80 -* Fixed ai docs by @ngraf -* Various fixes by @KobeNguyenT +- Fixed Playwright docs by @Horsty80 +- Fixed ai docs by @ngraf +- Various fixes by @KobeNguyenT ## 3.5.0 πŸ›©οΈ Features - **πŸͺ„ [AI Powered Test Automation](/ai)** - use OpenAI as a copilot for test automation. #3713 By @davertmik -![](https://user-images.githubusercontent.com/220264/250418764-c382709a-3ccb-4eb5-b6bc-538f3b3b3d35.png) - * [AI guide](/ai) added - * added support for OpenAI in `pause()` - * added [`heal` plugin](/plugins#heal) for self-healing tests - * added [`OpenAI`](/helpers/openai) helper + ![](https://user-images.githubusercontent.com/220264/250418764-c382709a-3ccb-4eb5-b6bc-538f3b3b3d35.png) + - [AI guide](/ai) added + - added support for OpenAI in `pause()` + - added [`heal` plugin](/plugins#heal) for self-healing tests + - added [`OpenAI`](/helpers/openai) helper - [Playwright][Puppeteer][WebDriver] Highlight the interacting elements in debug mode or with `highlightElement` option set (#3672) - by @KobeNguyenT ![](https://user-images.githubusercontent.com/220264/250415226-a7620418-56a4-4837-b790-b15e91e5d1f0.png) - [Playwright] Support for APIs in Playwright (#3665) - by Egor Bodnar - * `clearField` replaced to use new Playwright API - * `blur` added - * `focus` added + + - `clearField` replaced to use new Playwright API + - `blur` added + - `focus` added - **[Added support for multiple browsers](/parallel#Parallel-Execution-by-Workers-on-Multiple-Browsers)** in `run-workers` (#3606) by @karanshah-browserstack : @@ -1642,8 +1751,9 @@ exports.config = { browser: "chrome", } ] - }, + }, ``` + And executed via `run-workers` with `all` argument ``` @@ -1664,34 +1774,34 @@ npx codeceptjs run-workers 2 all - Fixed global retry #3667 by @KobeNguyenT - Fixed creating JavaScript test using "codeceptjs gt" (#3611) - by Jaromir Obr - ## 3.4.1 -* Updated mocha to v 10.2. Fixes #3591 -* Fixes executing a faling Before hook. Resolves #3592 +- Updated mocha to v 10.2. Fixes #3591 +- Fixes executing a faling Before hook. Resolves #3592 ## 3.4.0 -* **Updated to latest mocha and modern Cucumber** -* **Allure plugin moved to [@codeceptjs/allure-legacy](https://github.com/codeceptjs/allure-legacy) package**. This happened because allure-commons package v1 was not updated and caused vulnarabilities. Fixes #3422. We don't plan to maintain allure v2 plugin so it's up to community to take this initiative. Current allure plugin will print a warning message without interfering the run, so it won't accidentally fail your builds. -* Added ability to **[retry Before](https://codecept.io/basics/#retry-before), BeforeSuite, After, AfterSuite** hooks by @davertmik: +- **Updated to latest mocha and modern Cucumber** +- **Allure plugin moved to [@codeceptjs/allure-legacy](https://github.com/codeceptjs/allure-legacy) package**. This happened because allure-commons package v1 was not updated and caused vulnarabilities. Fixes #3422. We don't plan to maintain allure v2 plugin so it's up to community to take this initiative. Current allure plugin will print a warning message without interfering the run, so it won't accidentally fail your builds. +- Added ability to **[retry Before](https://codecept.io/basics/#retry-before), BeforeSuite, After, AfterSuite** hooks by @davertmik: + ```js Feature('flaky Before & BeforeSuite', { retryBefore: 2, retryBeforeSuite: 3 }) ``` -* **Flexible [retries configuration](https://codecept.io/basics/#retry-configuration) introduced** by @davertmik: +- **Flexible [retries configuration](https://codecept.io/basics/#retry-configuration) introduced** by @davertmik: ```js retry: [ { // enable this config only for flaky tests - grep: '@flaky', + grep: '@flaky', Before: 3 // retry Before 3 times Scenario: 3 // retry Scenario 3 times - }, + }, { // retry less when running slow tests - grep: '@slow' + grep: '@slow' Scenario: 1 Before: 1 }, { @@ -1700,91 +1810,92 @@ retry: [ } ] ``` -* **Flexible [timeout configuration](https://codecept.io/advanced/#timeout-configuration)** introduced by @davertmik: + +- **Flexible [timeout configuration](https://codecept.io/advanced/#timeout-configuration)** introduced by @davertmik: ```js timeout: [ - 10, // default timeout is 10secs - { // but increase timeout for slow tests + 10, // default timeout is 10secs + { + // but increase timeout for slow tests grep: '@slow', - Feature: 50 + Feature: 50, }, ] ``` -* JsDoc: Removed promise from `I.say`. See #3535 by @danielrentz -* [Playwright] `handleDownloads` requires now a filename param. See #3511 by @PeterNgTr -* [WebDriver] Added support for v8, removed support for webdriverio v5 and lower. See #3578 by @PeterNgTr - +- JsDoc: Removed promise from `I.say`. See #3535 by @danielrentz +- [Playwright] `handleDownloads` requires now a filename param. See #3511 by @PeterNgTr +- [WebDriver] Added support for v8, removed support for webdriverio v5 and lower. See #3578 by @PeterNgTr ## 3.3.7 πŸ›©οΈ Features -* **Promise-based typings** for TypeScript definitions in #3465 by @nlespiaucq. If you use TypeScript or use linters [check how it may be useful to you](https://bit.ly/3XIMq6n). -* **Translation** improved to use [custom vocabulary](https://codecept.io/translation/). -* [Playwright] Added methods in #3398 by @mirao - * `restartBrowser` - to restart a browser (with different config) - * `_createContextPage` - to create a new browser context with a page from a helper -* Added [Cucumber custom types](/bdd#custom-types) for BDD in #3435 by @Likstern -* Propose using JSONResponse helper when initializing project for API testing. #3455 by @PeterNgTr -* When translation enabled, generate tests using localized aliases. By @davertmik -* [Appium] Added `checkIfAppIsInstalled` in #3507 by @PeterNgTr +- **Promise-based typings** for TypeScript definitions in #3465 by @nlespiaucq. If you use TypeScript or use linters [check how it may be useful to you](https://bit.ly/3XIMq6n). +- **Translation** improved to use [custom vocabulary](https://codecept.io/translation/). +- [Playwright] Added methods in #3398 by @mirao + - `restartBrowser` - to restart a browser (with different config) + - `_createContextPage` - to create a new browser context with a page from a helper +- Added [Cucumber custom types](/bdd#custom-types) for BDD in #3435 by @Likstern +- Propose using JSONResponse helper when initializing project for API testing. #3455 by @PeterNgTr +- When translation enabled, generate tests using localized aliases. By @davertmik +- [Appium] Added `checkIfAppIsInstalled` in #3507 by @PeterNgTr πŸ› Bugfixes -* Fixed #3462 `TypeError: Cannot read properties of undefined (reading 'setStatus')` by @dwentland24 in #3438 -* Fixed creating steps file for TypeScript setup #3459 by @PeterNgTr -* Fixed issue of after all event in `run-rerun` command after complete execution #3464 by @jain-neeeraj -* [Playwright][WebDriver][Appium] Do not change `waitForTimeout` value on validation. See #3478 by @pmajewski24. Fixes #2589 -* [Playwright][WebDriver][Protractor][Puppeteer][TestCafe] Fixes `Element "{null: undefined}" was not found` and `element ([object Object]) still not present` messages when using object locators. See #3501 and #3502 by @pmajewski24 -* [Playwright] Improved file names when downloading file in #3449 by @PeterNgTr. Fixes #3412 and #3409 -* Add default value to `profile` env variable. See #3443 by @dwentland24. Resolves #3339 -* [Playwright] Using system-native path separator when saving artifacts in #3460 by @PeterNgTr -* [Playwright] Saving videos and traces from multiple sessions in #3505 by @davertmik -* [Playwright] Fixed `amOnPage` to navigate to `about:blank` by @zaxoavoki in #3470 Fixes #2311 -* Various typing improvements by @AWolf81 @PeterNgTr @mirao +- Fixed #3462 `TypeError: Cannot read properties of undefined (reading 'setStatus')` by @dwentland24 in #3438 +- Fixed creating steps file for TypeScript setup #3459 by @PeterNgTr +- Fixed issue of after all event in `run-rerun` command after complete execution #3464 by @jain-neeeraj +- [Playwright][WebDriver][Appium] Do not change `waitForTimeout` value on validation. See #3478 by @pmajewski24. Fixes #2589 +- [Playwright][WebDriver][Protractor][Puppeteer][TestCafe] Fixes `Element "{null: undefined}" was not found` and `element ([object Object]) still not present` messages when using object locators. See #3501 and #3502 by @pmajewski24 +- [Playwright] Improved file names when downloading file in #3449 by @PeterNgTr. Fixes #3412 and #3409 +- Add default value to `profile` env variable. See #3443 by @dwentland24. Resolves #3339 +- [Playwright] Using system-native path separator when saving artifacts in #3460 by @PeterNgTr +- [Playwright] Saving videos and traces from multiple sessions in #3505 by @davertmik +- [Playwright] Fixed `amOnPage` to navigate to `about:blank` by @zaxoavoki in #3470 Fixes #2311 +- Various typing improvements by @AWolf81 @PeterNgTr @mirao πŸ“– Documentation -* Updated [Quickstart](https://codecept.io/quickstart/) with detailed explanation of questions in init -* Added [Translation](/translation/) guide -* Updated [TypeScript](https://bit.ly/3XIMq6n) guide for promise-based typings -* Reordered guides list on a website +- Updated [Quickstart](https://codecept.io/quickstart/) with detailed explanation of questions in init +- Added [Translation](/translation/) guide +- Updated [TypeScript](https://bit.ly/3XIMq6n) guide for promise-based typings +- Reordered guides list on a website ## 3.3.6 -* [`run-rerun`](https://codecept.io/commands/#run-rerun) command was re-introduced by @dwentland24 in #3436. Use it to perform run multiple times and detect flaky tests -* Enabled `retryFailedStep` by default in `@codeceptjs/configure` v 0.10. See https://github.com/codeceptjs/configure/pull/26 -* [Playwright] Fixed properties types "waitForNavigation" and "firefox" by @mirao in #3401 -* [REST] Changed "endpoint" to optional by @mirao in #3404 -* [REST] Use [`secret`](/secrets) for form encoded string by @PeterNgTr: +- [`run-rerun`](https://codecept.io/commands/#run-rerun) command was re-introduced by @dwentland24 in #3436. Use it to perform run multiple times and detect flaky tests +- Enabled `retryFailedStep` by default in `@codeceptjs/configure` v 0.10. See https://github.com/codeceptjs/configure/pull/26 +- [Playwright] Fixed properties types "waitForNavigation" and "firefox" by @mirao in #3401 +- [REST] Changed "endpoint" to optional by @mirao in #3404 +- [REST] Use [`secret`](/secrets) for form encoded string by @PeterNgTr: ```js -const secretData = secret('name=john&password=123456'); -const response = await I.sendPostRequest('/user', secretData); -``` - -* [Playwright]Fixed docs related to fixed properties types "waitForNavigation" and "firefox" by @mirao in #3407 -* [Playwright]Fixed parameters of startActivity() by @mirao in #3408 -* Move semver to prod dependencies by @timja in #3413 -* check if browser is W3C instead of Android by @mikk150 in #3414 -* Pass service configs with options and caps as array for browsers… by @07souravkunda in #3418 -* fix for type of "webdriver.port" by @ngraf in #3421 -* fix for type of "webdriver.smartWait" by @pmajewski24 in #3426 -* fix(datatable): mask secret text by @PeterNgTr in #3432 -* fix(playwright) - video name and missing type by @PeterNgTr in #3430 -* fix for expected type of "bootstrap", "teardown", "bootstrapAll" and "teardownAll" by @ngraf in #3424 -* Improve generate pageobject `gpo` command to work with TypeScript by @PeterNgTr in #3411 -* Fixed dry-run to always return 0 code and exit -* Added minimal version notice for NodeJS >= 12 -* fix(utils): remove . of test title to avoid confusion by @PeterNgTr in #3431 +const secretData = secret('name=john&password=123456') +const response = await I.sendPostRequest('/user', secretData) +``` + +- [Playwright]Fixed docs related to fixed properties types "waitForNavigation" and "firefox" by @mirao in #3407 +- [Playwright]Fixed parameters of startActivity() by @mirao in #3408 +- Move semver to prod dependencies by @timja in #3413 +- check if browser is W3C instead of Android by @mikk150 in #3414 +- Pass service configs with options and caps as array for browsers… by @07souravkunda in #3418 +- fix for type of "webdriver.port" by @ngraf in #3421 +- fix for type of "webdriver.smartWait" by @pmajewski24 in #3426 +- fix(datatable): mask secret text by @PeterNgTr in #3432 +- fix(playwright) - video name and missing type by @PeterNgTr in #3430 +- fix for expected type of "bootstrap", "teardown", "bootstrapAll" and "teardownAll" by @ngraf in #3424 +- Improve generate pageobject `gpo` command to work with TypeScript by @PeterNgTr in #3411 +- Fixed dry-run to always return 0 code and exit +- Added minimal version notice for NodeJS >= 12 +- fix(utils): remove . of test title to avoid confusion by @PeterNgTr in #3431 ## 3.3.5 πŸ›©οΈ Features -* Added **TypeScript types for CodeceptJS config**. +- Added **TypeScript types for CodeceptJS config**. Update `codecept.conf.js` to get intellisense when writing config file: @@ -1794,42 +1905,41 @@ exports.config = { //... } ``` -* Added TS types for helpers config: - * Playwright - * Puppeteer - * WebDriver - * REST -* Added **[TypeScript option](/typescript)** for installation via `codeceptjs init` to initialize new projects in TS (by @PeterNgTr and @davertmik) -* Includes `node-ts` automatically when using TypeScript setup. +- Added TS types for helpers config: + - Playwright + - Puppeteer + - WebDriver + - REST +- Added **[TypeScript option](/typescript)** for installation via `codeceptjs init` to initialize new projects in TS (by @PeterNgTr and @davertmik) +- Includes `node-ts` automatically when using TypeScript setup. πŸ› Bugfixes -* [Puppeteer] Fixed support for Puppeteer > 14.4 by @PeterNgTr -* Don't report files as existing when non-directory is in path by @jonathanperret. See #3374 -* Fixed TS type for `secret` function by @PeterNgTr -* Fixed wrong order for async MetaSteps by @dwentland24. See #3393 -* Fixed same param substitution in BDD step. See #3385 by @snehabhandge +- [Puppeteer] Fixed support for Puppeteer > 14.4 by @PeterNgTr +- Don't report files as existing when non-directory is in path by @jonathanperret. See #3374 +- Fixed TS type for `secret` function by @PeterNgTr +- Fixed wrong order for async MetaSteps by @dwentland24. See #3393 +- Fixed same param substitution in BDD step. See #3385 by @snehabhandge πŸ“– Documentation -* Updated [configuration options](https://codecept.io/configuration/) to match TypeScript types -* Updated [TypeScript documentation](https://codecept.io/typescript/) on simplifying TS installation -* Added codecept-tesults plugin documentation by @ajeetd - - +- Updated [configuration options](https://codecept.io/configuration/) to match TypeScript types +- Updated [TypeScript documentation](https://codecept.io/typescript/) on simplifying TS installation +- Added codecept-tesults plugin documentation by @ajeetd ## 3.3.4 -* Added support for masking fields in objects via `secret` function: +- Added support for masking fields in objects via `secret` function: ```js -I.sendPostRequest('/auth', secret({ name: 'jon', password: '123456' }, 'password')); +I.sendPostRequest('/auth', secret({ name: 'jon', password: '123456' }, 'password')) ``` -* Added [a guide about using of `secret`](/secrets) function -* [Appium] Use `touchClick` when interacting with elements in iOS. See #3317 by @mikk150 -* [Playwright] Added `cdpConnection` option to connect over CDP. See #3309 by @Hmihaly -* [customLocator plugin] Allowed to specify multiple attributes for custom locator. Thanks to @aruiz-caritsqa + +- Added [a guide about using of `secret`](/secrets) function +- [Appium] Use `touchClick` when interacting with elements in iOS. See #3317 by @mikk150 +- [Playwright] Added `cdpConnection` option to connect over CDP. See #3309 by @Hmihaly +- [customLocator plugin] Allowed to specify multiple attributes for custom locator. Thanks to @aruiz-caritsqa ```js plugins: { @@ -1840,10 +1950,11 @@ plugins: { } } ``` -* [retryTo plugin] Fixed #3147 using `pollInterval` option. See #3351 by @cyonkee -* [Playwright] Fixed grabbing of browser console messages and window resize in new tab. Thanks to @mirao -* [REST] Added `prettyPrintJson` option to print JSON in nice way by @PeterNgTr -* [JSONResponse] Updated response validation to iterate over array items if response is array. Thanks to @PeterNgTr + +- [retryTo plugin] Fixed #3147 using `pollInterval` option. See #3351 by @cyonkee +- [Playwright] Fixed grabbing of browser console messages and window resize in new tab. Thanks to @mirao +- [REST] Added `prettyPrintJson` option to print JSON in nice way by @PeterNgTr +- [JSONResponse] Updated response validation to iterate over array items if response is array. Thanks to @PeterNgTr ```js // response.data == [ @@ -1851,37 +1962,36 @@ plugins: { // { user: { name: 'matt', email: 'matt@doe.com' } }, //] -I.seeResponseContainsKeys(['user']); -I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }); -I.seeResponseContainsJson({ user: { email: 'matt@doe.com' } }); -I.dontSeeResponseContainsJson({ user: 2 }); +I.seeResponseContainsKeys(['user']) +I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }) +I.seeResponseContainsJson({ user: { email: 'matt@doe.com' } }) +I.dontSeeResponseContainsJson({ user: 2 }) ``` ## 3.3.3 -* Fixed `DataCloneError: () => could not be cloned` when running data tests in run-workers -* πŸ‡ΊπŸ‡¦ Added #StandWithUkraine notice to CLI - +- Fixed `DataCloneError: () => could not be cloned` when running data tests in run-workers +- πŸ‡ΊπŸ‡¦ Added #StandWithUkraine notice to CLI ## 3.3.2 -* [REST] Fixed override of headers/token in `haveRequestHeaders()` and `amBearerAuthenticated()`. See #3304 by @mirao -* Reverted typings change introduced in #3245. [More details on this](https://twitter.com/CodeceptJS/status/1519725963856207873) +- [REST] Fixed override of headers/token in `haveRequestHeaders()` and `amBearerAuthenticated()`. See #3304 by @mirao +- Reverted typings change introduced in #3245. [More details on this](https://twitter.com/CodeceptJS/status/1519725963856207873) ## 3.3.1 πŸ›©οΈ Features: -* Add option to avoid duplicate gherkin step definitions (#3257) - @raywiis -* Added `step.*` for run-workers #3272. Thanks to @abhimanyupandian -* Fixed loading tests for `codecept run` using glob patterns. By @jayudey-wf +- Add option to avoid duplicate gherkin step definitions (#3257) - @raywiis +- Added `step.*` for run-workers #3272. Thanks to @abhimanyupandian +- Fixed loading tests for `codecept run` using glob patterns. By @jayudey-wf ``` npx codeceptjs run test-dir/*" ``` -* [Playwright] **Possible breaking change.** By default `timeout` is changed to 5000ms. The value set in 3.3.0 was too low. Please set `timeout` explicitly to not depend on release values. -* [Playwright] Added for color scheme option by @PeterNgTr +- [Playwright] **Possible breaking change.** By default `timeout` is changed to 5000ms. The value set in 3.3.0 was too low. Please set `timeout` explicitly to not depend on release values. +- [Playwright] Added for color scheme option by @PeterNgTr ```js helpers: { @@ -1892,40 +2002,39 @@ npx codeceptjs run test-dir/*" } ``` - πŸ› Bugfixes: -* [Playwright] Fixed `Cannot read property 'video' of undefined` -* Fixed haveRequestHeaders() and amBearerAuthenticated() of REST helper (#3260) - @mirao -* Fixed: allure attachment fails if screenshot failed #3298 by @ruudvanderweijde -* Fixed #3105 using autoLogin() plugin with TypeScript. Fix #3290 by @PeterNgTr -* [Playwright] Added extra params for click and dragAndDrop to type definitions by @mirao - +- [Playwright] Fixed `Cannot read property 'video' of undefined` +- Fixed haveRequestHeaders() and amBearerAuthenticated() of REST helper (#3260) - @mirao +- Fixed: allure attachment fails if screenshot failed #3298 by @ruudvanderweijde +- Fixed #3105 using autoLogin() plugin with TypeScript. Fix #3290 by @PeterNgTr +- [Playwright] Added extra params for click and dragAndDrop to type definitions by @mirao πŸ“– Documentation -* Improving the typings in many places -* Improving the return type of helpers for TS users (#3245) - @nlespiaucq + +- Improving the typings in many places +- Improving the return type of helpers for TS users (#3245) - @nlespiaucq ## 3.3.0 πŸ›©οΈ Features: -* [**API Testing introduced**](/api) - * Introduced [`JSONResponse`](/helpers/JSONResponse) helper which connects to REST, GraphQL or Playwright helper - * [REST] Added `amBearerAuthenticated` method - * [REST] Added `haveRequestHeaders` method - * Added dependency on `joi` and `chai` -* [Playwright] Added `timeout` option to set [timeout](https://playwright.dev/docs/api/class-page#page-set-default-timeout) for all Playwright actions. If an action fails, Playwright keeps retrying it for a time set by timeout. -* [Playwright] **Possible breaking change.** By default `timeout` is set to 1000ms. *Previous default was set by Playwright internally to 30s. This was causing contradiction to CodeceptJS retries, so triggered up to 3 retries for 30s of time. This timeout option was lowered so retryFailedStep plugin would not cause long delays.* -* [Playwright] Updated `restart` config option to include 3 restart strategies: - * 'context' or **false** - restarts [browser context](https://playwright.dev/docs/api/class-browsercontext) but keeps running browser. Recommended by Playwright team to keep tests isolated. - * 'browser' or **true** - closes browser and opens it again between tests. - * 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default prior CodeceptJS 3.1 -* [Playwright] Extended methods to provide more options from engine. These methods were updated so additional options can be be passed as the last argument: - * [`click`](/helpers/Playwright#click) - * [`dragAndDrop`](/helpers/Playwright#dragAndDrop) - * [`checkOption`](/helpers/Playwright#checkOption) - * [`uncheckOption`](/helpers/Playwright#uncheckOption) +- [**API Testing introduced**](/api) + - Introduced [`JSONResponse`](/helpers/JSONResponse) helper which connects to REST, GraphQL or Playwright helper + - [REST] Added `amBearerAuthenticated` method + - [REST] Added `haveRequestHeaders` method + - Added dependency on `joi` and `chai` +- [Playwright] Added `timeout` option to set [timeout](https://playwright.dev/docs/api/class-page#page-set-default-timeout) for all Playwright actions. If an action fails, Playwright keeps retrying it for a time set by timeout. +- [Playwright] **Possible breaking change.** By default `timeout` is set to 1000ms. _Previous default was set by Playwright internally to 30s. This was causing contradiction to CodeceptJS retries, so triggered up to 3 retries for 30s of time. This timeout option was lowered so retryFailedStep plugin would not cause long delays._ +- [Playwright] Updated `restart` config option to include 3 restart strategies: + - 'context' or **false** - restarts [browser context](https://playwright.dev/docs/api/class-browsercontext) but keeps running browser. Recommended by Playwright team to keep tests isolated. + - 'browser' or **true** - closes browser and opens it again between tests. + - 'session' or 'keep' - keeps browser context and session, but cleans up cookies and localStorage between tests. The fastest option when running tests in windowed mode. Works with `keepCookies` and `keepBrowserState` options. This behavior was default prior CodeceptJS 3.1 +- [Playwright] Extended methods to provide more options from engine. These methods were updated so additional options can be be passed as the last argument: + - [`click`](/helpers/Playwright#click) + - [`dragAndDrop`](/helpers/Playwright#dragAndDrop) + - [`checkOption`](/helpers/Playwright#checkOption) + - [`uncheckOption`](/helpers/Playwright#uncheckOption) ```js // use Playwright click options as 3rd argument @@ -1934,83 +2043,85 @@ I.click('canvas', '.model', { position: { x: 20, y: 40 } }) I.checkOption('Agree', '.signup', { position: { x: 5, y: 5 } }) ``` -* `eachElement` plugin introduced. It allows you to iterate over elements and perform some action on them using direct engines API +- `eachElement` plugin introduced. It allows you to iterate over elements and perform some action on them using direct engines API ```js await eachElement('click all links in .list', '.list a', (el) => { await el.click(); }) ``` -* [Playwright] Added support to `playwright-core` package if `playwright` is not installed. See #3190, fixes #2663. -* [Playwright] Added `makeApiRequest` action to perform API requests. Requires Playwright >= 1.18 -* Added support to `codecept.config.js` for name consistency across other JS tools. See motivation at #3195 by @JiLiZART -* [ApiDataFactory] Added options arg to `have` method. See #3197 by @JJlokidoki -* Improved pt-br translations to include keywords: 'Funcionalidade', 'CenΓ‘rio', 'Antes', 'Depois', 'AntesDaSuite', 'DepoisDaSuite'. See #3206 by @danilolutz -* [allure plugin] Introduced `addStep` method to add comments and attachments. See #3104 by @EgorBodnar + +- [Playwright] Added support to `playwright-core` package if `playwright` is not installed. See #3190, fixes #2663. +- [Playwright] Added `makeApiRequest` action to perform API requests. Requires Playwright >= 1.18 +- Added support to `codecept.config.js` for name consistency across other JS tools. See motivation at #3195 by @JiLiZART +- [ApiDataFactory] Added options arg to `have` method. See #3197 by @JJlokidoki +- Improved pt-br translations to include keywords: 'Funcionalidade', 'CenΓ‘rio', 'Antes', 'Depois', 'AntesDaSuite', 'DepoisDaSuite'. See #3206 by @danilolutz +- [allure plugin] Introduced `addStep` method to add comments and attachments. See #3104 by @EgorBodnar πŸ› Bugfixes: -* Fixed #3212: using Regex flags for Cucumber steps. See #3214 by @anils92 +- Fixed #3212: using Regex flags for Cucumber steps. See #3214 by @anils92 πŸ“– Documentation -* Added [Testomat.io reporter](/reports#testomatio) -* Added [api testing](/api) guides -* Added [internal api](/internal-api) guides -* [Appium] Fixed documentation for `performSwipe` -* [Playwright] update docs for `usePlaywrightTo` method by @dbudzins +- Added [Testomat.io reporter](/reports#testomatio) +- Added [api testing](/api) guides +- Added [internal api](/internal-api) guides +- [Appium] Fixed documentation for `performSwipe` +- [Playwright] update docs for `usePlaywrightTo` method by @dbudzins ## 3.2.3 -* Documentation improvements by @maojunxyz -* Guard mocha cli reporter from registering step logger multiple times #3180 by @nikocanvacom -* [Playwright] Fixed "tracing.stop: tracing.stop: ENAMETOOLONG: name too long" by @hatufacci -* Fixed #2889: return always the same error contract from simplifyTest. See #3168 by @andremoah +- Documentation improvements by @maojunxyz +- Guard mocha cli reporter from registering step logger multiple times #3180 by @nikocanvacom +- [Playwright] Fixed "tracing.stop: tracing.stop: ENAMETOOLONG: name too long" by @hatufacci +- Fixed #2889: return always the same error contract from simplifyTest. See #3168 by @andremoah ## 3.2.2 -* [Playwright] Reverted removal of retry on context errors. Fixes #3130 -* Timeout improvements by @nikocanvacom: - * Added priorites to timeouts - * Added `overrideStepLimits` to [stepTimeout plugin](https://codecept.io/plugins/#steptimeout) to override steps timeouts set by `limitTime`. - * Fixed step timeout not working due to override by NaN by test timeout #3126 -* [Appium] Fixed logging error when `manualStart` is true. See #3140 by @nikocanvacom - +- [Playwright] Reverted removal of retry on context errors. Fixes #3130 +- Timeout improvements by @nikocanvacom: + - Added priorites to timeouts + - Added `overrideStepLimits` to [stepTimeout plugin](https://codecept.io/plugins/#steptimeout) to override steps timeouts set by `limitTime`. + - Fixed step timeout not working due to override by NaN by test timeout #3126 +- [Appium] Fixed logging error when `manualStart` is true. See #3140 by @nikocanvacom ## 3.2.1 > ♻️ This release fixes hanging of tests by reducing timeouts for automatic retries on failures. -* [retryFailedStep plugin] **New Defaults**: retries steps up to 3 times with factor of 1.5 (previously 5 with factor 2) -* [Playwright] - disabled retry on failed context actions (not needed anymore) -* [Puppeteer] - reduced retries on context failures to 3 times. -* [Playwright] Handling `crash` event to automatically close crashed pages. +- [retryFailedStep plugin] **New Defaults**: retries steps up to 3 times with factor of 1.5 (previously 5 with factor 2) +- [Playwright] - disabled retry on failed context actions (not needed anymore) +- [Puppeteer] - reduced retries on context failures to 3 times. +- [Playwright] Handling `crash` event to automatically close crashed pages. ## 3.2.0 πŸ›©οΈ Features: **[Timeouts](https://codecept.io/advanced/#timeout) implemented** - * global timeouts (via `timeout` config option). - * _Breaking change:_ timeout option expects **timeout in seconds**, not in milliseconds as it was previously. - * test timeouts (via `Scenario` and `Feature` options) - * _Breaking change:_ `Feature().timeout()` and `Scenario().timeout()` calls has no effect and are deprecated + +- global timeouts (via `timeout` config option). + - _Breaking change:_ timeout option expects **timeout in seconds**, not in milliseconds as it was previously. +- test timeouts (via `Scenario` and `Feature` options) + - _Breaking change:_ `Feature().timeout()` and `Scenario().timeout()` calls has no effect and are deprecated ```js // set timeout for every test in suite to 10 secs -Feature('tests with timeout', { timeout: 10 }); +Feature('tests with timeout', { timeout: 10 }) // set timeout for this test to 20 secs -Scenario('a test with timeout', { timeout: 20 }, ({ I }) => {}); -``` +Scenario('a test with timeout', { timeout: 20 }, ({ I }) => {}) +``` - * step timeouts (See #3059 by @nikocanvacom) +- step timeouts (See #3059 by @nikocanvacom) ```js // set step timeout to 5 secs -I.limitTime(5).click('Link'); -``` - * `stepTimeout` plugin introduced to automatically add timeouts for each step (#3059 by @nikocanvacom). +I.limitTime(5).click('Link') +``` + +- `stepTimeout` plugin introduced to automatically add timeouts for each step (#3059 by @nikocanvacom). [**retryTo**](/plugins/#retryto) plugin introduced to rerun a set of steps on failure: @@ -2018,150 +2129,149 @@ I.limitTime(5).click('Link'); // editing in text in iframe // if iframe was not loaded - retry 5 times await retryTo(() => { - I.switchTo('#editor frame'); - I.fillField('textarea', 'value'); -}, 5); + I.switchTo('#editor frame') + I.fillField('textarea', 'value') +}, 5) ``` -* [Playwright] added `locale` configuration -* [WebDriver] upgraded to webdriverio v7 +- [Playwright] added `locale` configuration +- [WebDriver] upgraded to webdriverio v7 πŸ› Bugfixes: -* Fixed allure plugin "Unexpected endStep()" error in #3098 by @abhimanyupandian -* [Puppeteer] always close remote browser on test end. See #3054 by @mattonem -* stepbyStepReport Plugin: Disabled screenshots after test has failed. See #3119 by @ioannisChalkias - +- Fixed allure plugin "Unexpected endStep()" error in #3098 by @abhimanyupandian +- [Puppeteer] always close remote browser on test end. See #3054 by @mattonem +- stepbyStepReport Plugin: Disabled screenshots after test has failed. See #3119 by @ioannisChalkias ## 3.1.3 πŸ›©οΈ Features: -* BDD Improvement. Added `DataTableArgument` class to work with table data structures. +- BDD Improvement. Added `DataTableArgument` class to work with table data structures. ```js const { DataTableArgument } = require('codeceptjs'); //... Given('I have an employee card', (table) => { const dataTableArgument = new DataTableArgument(table); - const hashes = dataTableArgument.hashes(); + const hashes = dataTableArgument.hashes(); // hashes = [{ name: 'Harry', surname: 'Potter', position: 'Seeker' }]; const rows = dataTableArgument.rows(); // rows = [['Harry', 'Potter', Seeker]]; } ``` + See updated [BDD section](https://codecept.io/bdd/) for more API options. Thanks to @EgorBodnar -* Support `cjs` file extensions for config file: `codecept.conf.cjs`. See #3052 by @kalvenschraut -* API updates: Added `test.file` and `suite.file` properties to `test` and `suite` objects to use in helpers and plugins. +- Support `cjs` file extensions for config file: `codecept.conf.cjs`. See #3052 by @kalvenschraut +- API updates: Added `test.file` and `suite.file` properties to `test` and `suite` objects to use in helpers and plugins. πŸ› Bugfixes: -* [Playwright] Fixed resetting `test.artifacts` for failing tests. See #3033 by @jancorvus. Fixes #3032 -* [Playwright] Apply `basicAuth` credentials to all opened browser contexts. See #3036 by @nikocanvacom. Fixes #3035 -* [WebDriver] Updated `webdriverio` default version to `^6.12.1`. See #3043 by @sridhareaswaran -* [Playwright] `I.haveRequestHeaders` affects all tabs. See #3049 by @jancorvus -* BDD: Fixed unhandled empty feature files. Fix #3046 by @abhimanyupandian -* Fixed `RangeError: Invalid string length` in `recorder.js` when running huge amount of tests. -* [Appium] Fixed definitions for `touchPerform`, `hideDeviceKeyboard`, `removeApp` by @mirao +- [Playwright] Fixed resetting `test.artifacts` for failing tests. See #3033 by @jancorvus. Fixes #3032 +- [Playwright] Apply `basicAuth` credentials to all opened browser contexts. See #3036 by @nikocanvacom. Fixes #3035 +- [WebDriver] Updated `webdriverio` default version to `^6.12.1`. See #3043 by @sridhareaswaran +- [Playwright] `I.haveRequestHeaders` affects all tabs. See #3049 by @jancorvus +- BDD: Fixed unhandled empty feature files. Fix #3046 by @abhimanyupandian +- Fixed `RangeError: Invalid string length` in `recorder.js` when running huge amount of tests. +- [Appium] Fixed definitions for `touchPerform`, `hideDeviceKeyboard`, `removeApp` by @mirao πŸ“– Documentation: -* Added Testrail reporter [Reports Docs](https://codecept.io/reports/#testrail) - +- Added Testrail reporter [Reports Docs](https://codecept.io/reports/#testrail) ## 3.1.2 πŸ›©οΈ Features: -* Added `coverage` plugin to generate code coverage for Playwright & Puppeteer. By @anirudh-modi -* Added `subtitle` plugin to generate subtitles for videos recorded with Playwright. By @anirudh-modi -* Configuration: `config.tests` to accept array of file patterns. See #2994 by @monsteramba +- Added `coverage` plugin to generate code coverage for Playwright & Puppeteer. By @anirudh-modi +- Added `subtitle` plugin to generate subtitles for videos recorded with Playwright. By @anirudh-modi +- Configuration: `config.tests` to accept array of file patterns. See #2994 by @monsteramba ```js exports.config = { - tests: ['./*_test.js','./sampleTest.js'], - // ... + tests: ['./*_test.js', './sampleTest.js'], + // ... } ``` -* Notification is shown for test files without `Feature()`. See #3011 by @PeterNgTr + +- Notification is shown for test files without `Feature()`. See #3011 by @PeterNgTr πŸ› Bugfixes: -* [Playwright] Fixed #2986 error is thrown when deleting a missing video. Fix by @hatufacci -* Fixed false positive result when invalid function is called in a helper. See #2997 by @abhimanyupandian -* [Appium] Removed full page mode for `saveScreenshot`. See #3002 by @nlespiaucq -* [Playwright] Fixed #3003 saving trace for a test with a long name. Fix by @hatufacci +- [Playwright] Fixed #2986 error is thrown when deleting a missing video. Fix by @hatufacci +- Fixed false positive result when invalid function is called in a helper. See #2997 by @abhimanyupandian +- [Appium] Removed full page mode for `saveScreenshot`. See #3002 by @nlespiaucq +- [Playwright] Fixed #3003 saving trace for a test with a long name. Fix by @hatufacci 🎱 Other: -* Deprecated `puppeteerCoverage` plugin in favor of `coverage` plugin. +- Deprecated `puppeteerCoverage` plugin in favor of `coverage` plugin. ## 3.1.1 -* [Appium] Fixed #2759 - `grabNumberOfVisibleElements`, `grabAttributeFrom`, `grabAttributeFromAll` to allow id locators. +- [Appium] Fixed #2759 + `grabNumberOfVisibleElements`, `grabAttributeFrom`, `grabAttributeFromAll` to allow id locators. ## 3.1.0 -* [Plawyright] Updated to Playwright 1.13 -* [Playwright] **Possible breaking change**: `BrowserContext` is initialized before each test and closed after. This behavior matches recommendation from Playwright team to use different contexts for tests. -* [Puppeteer] Updated to Puppeteer 10.2. -* [Protractor] Helper deprecated +- [Plawyright] Updated to Playwright 1.13 +- [Playwright] **Possible breaking change**: `BrowserContext` is initialized before each test and closed after. This behavior matches recommendation from Playwright team to use different contexts for tests. +- [Puppeteer] Updated to Puppeteer 10.2. +- [Protractor] Helper deprecated πŸ›©οΈ Features: -* [Playwright] Added recording of [video](https://codecept.io/playwright/#video) and [traces](https://codecept.io/playwright/#trace) by @davertmik -* [Playwritght] [Mocking requests](https://codecept.io/playwright/#mocking-network-requests) implemented via `route` API of Playwright by @davertmik -* [Playwright] Added **support for [React locators](https://codecept.io/react/#locators)** in #2912 by @AAAstorga +- [Playwright] Added recording of [video](https://codecept.io/playwright/#video) and [traces](https://codecept.io/playwright/#trace) by @davertmik +- [Playwritght] [Mocking requests](https://codecept.io/playwright/#mocking-network-requests) implemented via `route` API of Playwright by @davertmik +- [Playwright] Added **support for [React locators](https://codecept.io/react/#locators)** in #2912 by @AAAstorga πŸ› Bugfixes: -* [Puppeteer] Fixed #2244 `els[0]._clickablePoint is not a function` by @karunandrii. -* [Puppeteer] Fixed `fillField` to check for invisible elements. See #2916 by @anne-open-xchange -* [Playwright] Reset of dialog event listener before registration of new one. #2946 by @nikocanvacom -* Fixed running Gherkin features with `run-multiple` using chunks. See #2900 by @andrenoberto -* Fixed #2937 broken typings for subfolders on Windows by @jancorvus -* Fixed issue where cucumberJsonReporter not working with fakerTransform plugin. See #2942 by @ilangv -* Fixed #2952 finished job with status code 0 when playwright cannot connect to remote wss url. By @davertmik - +- [Puppeteer] Fixed #2244 `els[0]._clickablePoint is not a function` by @karunandrii. +- [Puppeteer] Fixed `fillField` to check for invisible elements. See #2916 by @anne-open-xchange +- [Playwright] Reset of dialog event listener before registration of new one. #2946 by @nikocanvacom +- Fixed running Gherkin features with `run-multiple` using chunks. See #2900 by @andrenoberto +- Fixed #2937 broken typings for subfolders on Windows by @jancorvus +- Fixed issue where cucumberJsonReporter not working with fakerTransform plugin. See #2942 by @ilangv +- Fixed #2952 finished job with status code 0 when playwright cannot connect to remote wss url. By @davertmik ## 3.0.7 πŸ“– Documentation fixes: -* Remove broken link from `Nightmare helper`. See #2860 by @Arhell -* Fixed broken links in `playwright.md`. See #2848 by @johnhoodjr -* Fix mocha-multi config example. See #2881 by @rimesc -* Fix small errors in email documentation file. See #2884 by @mkrtchian -* Improve documentation for `Sharing Data Between Workers` section. See #2891 by @ngraf +- Remove broken link from `Nightmare helper`. See #2860 by @Arhell +- Fixed broken links in `playwright.md`. See #2848 by @johnhoodjr +- Fix mocha-multi config example. See #2881 by @rimesc +- Fix small errors in email documentation file. See #2884 by @mkrtchian +- Improve documentation for `Sharing Data Between Workers` section. See #2891 by @ngraf πŸ›©οΈ Features: -* [WebDriver] Shadow DOM Support for `Webdriver`. See #2741 by @gkushang -* [Release management] Introduce the versioning automatically, it follows the semantics versioning. See #2883 by @PeterNgTr -* Adding opts into `Scenario.skip` that it would be useful for building reports. See #2867 by @AlexKo4 -* Added support for attaching screenshots to [cucumberJsonReporter](https://github.com/ktryniszewski-mdsol/codeceptjs-cucumber-json-reporter) See #2888 by @fijijavis -* Supported config file for `codeceptjs shell` command. See #2895 by @PeterNgTr: +- [WebDriver] Shadow DOM Support for `Webdriver`. See #2741 by @gkushang +- [Release management] Introduce the versioning automatically, it follows the semantics versioning. See #2883 by @PeterNgTr +- Adding opts into `Scenario.skip` that it would be useful for building reports. See #2867 by @AlexKo4 +- Added support for attaching screenshots to [cucumberJsonReporter](https://github.com/ktryniszewski-mdsol/codeceptjs-cucumber-json-reporter) See #2888 by @fijijavis +- Supported config file for `codeceptjs shell` command. See #2895 by @PeterNgTr: ``` npx codeceptjs shell -c foo.conf.js ``` Bug fixes: -* [GraphQL] Use a helper-specific instance of Axios to avoid contaminating global defaults. See #2868 by @vanvoljg -* A default system color is used when passing non supported system color when using I.say(). See #2874 by @PeterNgTr -* [Playwright] Avoid the timout due to calling the click on invisible elements. See #2875 by cbayer97 +- [GraphQL] Use a helper-specific instance of Axios to avoid contaminating global defaults. See #2868 by @vanvoljg +- A default system color is used when passing non supported system color when using I.say(). See #2874 by @PeterNgTr +- [Playwright] Avoid the timout due to calling the click on invisible elements. See #2875 by cbayer97 ## 3.0.6 -* [Playwright] Added `electron` as a browser to config. See #2834 by @cbayer97 -* [Playwright] Implemented `launchPersistentContext` to be able to launch persistent remote browsers. See #2817 by @brunoqueiros. Fixes #2376. -* Fixed printing logs and stack traces for `run-workers`. See #2857 by @haveac1gar. Fixes #2621, #2852 -* Emit custom messages from worker to the main thread. See #2824 by @jccguimaraes -* Improved workers processes output. See #2804 by @drfiresign -* BDD. Added ability to use an array of feature files inside config in `gherkin.features`. See #2814 by @jbergeronjr +- [Playwright] Added `electron` as a browser to config. See #2834 by @cbayer97 +- [Playwright] Implemented `launchPersistentContext` to be able to launch persistent remote browsers. See #2817 by @brunoqueiros. Fixes #2376. +- Fixed printing logs and stack traces for `run-workers`. See #2857 by @haveac1gar. Fixes #2621, #2852 +- Emit custom messages from worker to the main thread. See #2824 by @jccguimaraes +- Improved workers processes output. See #2804 by @drfiresign +- BDD. Added ability to use an array of feature files inside config in `gherkin.features`. See #2814 by @jbergeronjr ```js "features": [ @@ -2169,8 +2279,9 @@ Bug fixes: "./features/api_features/*.feature" ], ``` -* Added `getQueueId` to reporter to rerun a specific promise. See #2837 by @jonatask -* **Added `fakerTransform` plugin** to use faker data in Gherkin scenarios. See #2854 by @adrielcodeco + +- Added `getQueueId` to reporter to rerun a specific promise. See #2837 by @jonatask +- **Added `fakerTransform` plugin** to use faker data in Gherkin scenarios. See #2854 by @adrielcodeco ```feature Scenario Outline: ... @@ -2182,119 +2293,123 @@ Scenario Outline: ... | productName | customer | email | anythingMore | | {{commerce.product}} | Dr. {{name.findName}} | {{internet.email}} | staticData | ``` -* [REST] Use class instance of axios, not the global instance, to avoid contaminating global configuration. #2846 by @vanvoljg -* [Appium] Added `tunnelIdentifier` config option to provide tunnel for SauceLabs. See #2832 by @gurjeetbains -## 3.0.5 +- [REST] Use class instance of axios, not the global instance, to avoid contaminating global configuration. #2846 by @vanvoljg +- [Appium] Added `tunnelIdentifier` config option to provide tunnel for SauceLabs. See #2832 by @gurjeetbains +## 3.0.5 Features: -* **[Official Docker image for CodeceptJS v3](https://hub.docker.com/r/codeceptjs/codeceptjs)**. New Docker image is based on official Playwright image and supports Playwright, Puppeteer, WebDriver engines. Thanks @VikentyShevyrin -* Better support for Typescript `codecept.conf.ts` configuration files. See #2750 by @elaichenkov -* Propagate more events for custom parallel script. See #2796 by @jccguimaraes -* [mocha-junit-reporter] Now supports attachments, see documentation for details. See #2675 by @Shard -* CustomLocators interface for TypeScript to extend from LocatorOrString. See #2798 by @danielrentz -* [REST] Mask sensitive data from log messages. +- **[Official Docker image for CodeceptJS v3](https://hub.docker.com/r/codeceptjs/codeceptjs)**. New Docker image is based on official Playwright image and supports Playwright, Puppeteer, WebDriver engines. Thanks @VikentyShevyrin +- Better support for Typescript `codecept.conf.ts` configuration files. See #2750 by @elaichenkov +- Propagate more events for custom parallel script. See #2796 by @jccguimaraes +- [mocha-junit-reporter] Now supports attachments, see documentation for details. See #2675 by @Shard +- CustomLocators interface for TypeScript to extend from LocatorOrString. See #2798 by @danielrentz +- [REST] Mask sensitive data from log messages. + ```js -I.sendPatchRequest('/api/users.json', secret({ "email": "user@user.com" })); +I.sendPatchRequest('/api/users.json', secret({ email: 'user@user.com' })) ``` + See #2786 by @PeterNgTr Bug fixes: -* Fixed reporting of nested steps with PageObjects and BDD scenarios. See #2800 by @davertmik. Fixes #2720 #2682 -* Fixed issue with `codeceptjs shell` which was broken since 3.0.0. See #2743 by @stedman -* [Gherkin] Fixed issue suppressed or hidden errors in tests. See #2745 by @ktryniszewski-mdsol -* [Playwright] fix grabCssPropertyFromAll serialization by using property names. See #2757 by @elaichenkov -* [Allure] fix report for multi sessions. See #2771 by @cbayer97 -* [WebDriver] Fix locator object debug log messages in smart wait. See 2748 by @elaichenkov + +- Fixed reporting of nested steps with PageObjects and BDD scenarios. See #2800 by @davertmik. Fixes #2720 #2682 +- Fixed issue with `codeceptjs shell` which was broken since 3.0.0. See #2743 by @stedman +- [Gherkin] Fixed issue suppressed or hidden errors in tests. See #2745 by @ktryniszewski-mdsol +- [Playwright] fix grabCssPropertyFromAll serialization by using property names. See #2757 by @elaichenkov +- [Allure] fix report for multi sessions. See #2771 by @cbayer97 +- [WebDriver] Fix locator object debug log messages in smart wait. See 2748 by @elaichenkov Documentation fixes: -* Fixed some broken examples. See #2756 by @danielrentz -* Fixed Typescript typings. See #2747, #2758 and #2769 by @elaichenkov -* Added missing type for xFeature. See #2754 by @PeterNgTr -* Fixed code example in Page Object documentation. See #2793 by @mkrtchian + +- Fixed some broken examples. See #2756 by @danielrentz +- Fixed Typescript typings. See #2747, #2758 and #2769 by @elaichenkov +- Added missing type for xFeature. See #2754 by @PeterNgTr +- Fixed code example in Page Object documentation. See #2793 by @mkrtchian Library updates: -* Updated Axios to 0.21.1. See by @sseide -* Updated @pollyjs/core @pollyjs/adapter-puppeteer. See #2760 by @Anikethana + +- Updated Axios to 0.21.1. See by @sseide +- Updated @pollyjs/core @pollyjs/adapter-puppeteer. See #2760 by @Anikethana ## 3.0.4 -* **Hotfix** Fixed `init` script by adding `cross-spawn` package. By @vipulgupta2048 -* Fixed handling error during initialization of `run-multiple`. See #2730 by @wagoid +- **Hotfix** Fixed `init` script by adding `cross-spawn` package. By @vipulgupta2048 +- Fixed handling error during initialization of `run-multiple`. See #2730 by @wagoid ## 3.0.3 -* **Playwright 1.7 support** -* [Playwright] Fixed handling null context in click. See #2667 by @matthewjf -* [Playwright] Fixed `Cannot read property '$$' of null` when locating elements. See #2713 by @matthewjf -* Command `npx codeceptjs init` improved - * auto-installing required packages - * better error messages - * fixed generating type definitions -* Data Driven Tests improvements: instead of having one skipped test for data driven scenarios when using xData you get a skipped test for each entry in the data table. See #2698 by @Georgegriff -* [Puppeteer] Fixed that `waitForFunction` was not working with number values. See #2703 by @MumblesNZ -* Enabled autocompletion for custom helpers. #2695 by @PeterNgTr -* Emit test.after on workers. Fix #2693 by @jccguimaraes -* TypeScript: Allow .ts config files. See #2708 by @elukoyanov -* Fixed definitions generation errors by @elukoyanov. See #2707 and #2718 -* Fixed handing error in _after function; for example, browser is closed during test and tests executions is stopped, but error was not logged. See #2715 by @elukoyanov -* Emit hook.failed in workers. Fix #2723 by @jccguimaraes -* [wdio plugin] Added `seleniumArgs` and `seleniumInstallArgs` config options for plugin. See #2687 by @andrerleao -* [allure plugin] Added `addParameter` method in #2717 by @jancorvus. Fixes #2716 -* Added mocha-based `--reporter-options` and `--reporter ` commands to `run-workers` command by in #2691 @Ameterezu -* Fixed infinite loop for junit reports. See #2691 @Ameterezu -* Added status, start/end time, and match line for BDD steps. See #2678 by @ktryniszewski-mdsol -* [stepByStepReport plugin] Fixed "helper.saveScreenshot is not a function". Fix #2688 by @andrerleao - - +- **Playwright 1.7 support** +- [Playwright] Fixed handling null context in click. See #2667 by @matthewjf +- [Playwright] Fixed `Cannot read property '$$' of null` when locating elements. See #2713 by @matthewjf +- Command `npx codeceptjs init` improved + - auto-installing required packages + - better error messages + - fixed generating type definitions +- Data Driven Tests improvements: instead of having one skipped test for data driven scenarios when using xData you get a skipped test for each entry in the data table. See #2698 by @Georgegriff +- [Puppeteer] Fixed that `waitForFunction` was not working with number values. See #2703 by @MumblesNZ +- Enabled autocompletion for custom helpers. #2695 by @PeterNgTr +- Emit test.after on workers. Fix #2693 by @jccguimaraes +- TypeScript: Allow .ts config files. See #2708 by @elukoyanov +- Fixed definitions generation errors by @elukoyanov. See #2707 and #2718 +- Fixed handing error in \_after function; for example, browser is closed during test and tests executions is stopped, but error was not logged. See #2715 by @elukoyanov +- Emit hook.failed in workers. Fix #2723 by @jccguimaraes +- [wdio plugin] Added `seleniumArgs` and `seleniumInstallArgs` config options for plugin. See #2687 by @andrerleao +- [allure plugin] Added `addParameter` method in #2717 by @jancorvus. Fixes #2716 +- Added mocha-based `--reporter-options` and `--reporter ` commands to `run-workers` command by in #2691 @Ameterezu +- Fixed infinite loop for junit reports. See #2691 @Ameterezu +- Added status, start/end time, and match line for BDD steps. See #2678 by @ktryniszewski-mdsol +- [stepByStepReport plugin] Fixed "helper.saveScreenshot is not a function". Fix #2688 by @andrerleao ## 3.0.2 -* [Playwright] Fix connection close with remote browser. See #2629 by @dipiash -* [REST] set maxUploadFileSize when performing api calls. See #2611 by @PeterNgTr -* Duplicate Scenario names (combined with Feature name) are now detected via a warning message. -Duplicate test names can cause `codeceptjs run-workers` to not function. See #2656 by @Georgegriff -* Documentation fixes +- [Playwright] Fix connection close with remote browser. See #2629 by @dipiash +- [REST] set maxUploadFileSize when performing api calls. See #2611 by @PeterNgTr +- Duplicate Scenario names (combined with Feature name) are now detected via a warning message. + Duplicate test names can cause `codeceptjs run-workers` to not function. See #2656 by @Georgegriff +- Documentation fixes Bug Fixes: - * --suites flag now should function correctly for `codeceptjs run-workers`. See #2655 by @Georgegriff - * [autoLogin plugin] Login methods should now function as expected with `codeceptjs run-workers`. See #2658 by @Georgegriff, resolves #2620 - +- --suites flag now should function correctly for `codeceptjs run-workers`. See #2655 by @Georgegriff +- [autoLogin plugin] Login methods should now function as expected with `codeceptjs run-workers`. See #2658 by @Georgegriff, resolves #2620 ## 3.0.1 ♨️ Hot fix: - * Lock the mocha version to avoid the errors. See #2624 by PeterNgTr + +- Lock the mocha version to avoid the errors. See #2624 by PeterNgTr πŸ› Bug Fix: - * Fixed error handling in Scenario.js. See #2607 by haveac1gar - * Changing type definition in order to allow the use of functions with any number of any arguments. See #2616 by akoltun -* Some updates/changes on documentations +- Fixed error handling in Scenario.js. See #2607 by haveac1gar +- Changing type definition in order to allow the use of functions with any number of any arguments. See #2616 by akoltun + +- Some updates/changes on documentations ## 3.0.0 -> [ πŸ‘Œ **LEARN HOW TO UPGRADE TO CODECEPTJS 3 ➑**](https://bit.ly/codecept3Up) -* Playwright set to be a default engine. -* **NodeJS 12+ required** -* **BREAKING CHANGE:** Syntax for tests has changed. +> [ πŸ‘Œ **LEARN HOW TO UPGRADE TO CODECEPTJS 3 ➑**](https://bit.ly/codecept3Up) +- Playwright set to be a default engine. +- **NodeJS 12+ required** +- **BREAKING CHANGE:** Syntax for tests has changed. ```js // Previous -Scenario('title', (I, loginPage) => {}); +Scenario('title', (I, loginPage) => {}) // Current -Scenario('title', ({ I, loginPage }) => {}); +Scenario('title', ({ I, loginPage }) => {}) ``` -* **BREAKING** Replaced bootstrap/teardown scripts to accept only functions or async functions. Async function with callback (with done parameter) should be replaced with async/await. [See our upgrade guide](https://bit.ly/codecept3Up). -* **[TypeScript guide](/typescript)** and [boilerplate project](https://github.com/codeceptjs/typescript-boilerplate) -* [tryTo](/plugins/#tryto) and [pauseOnFail](/plugins/#pauseOnFail) plugins installed by default -* Introduced one-line installer: +- **BREAKING** Replaced bootstrap/teardown scripts to accept only functions or async functions. Async function with callback (with done parameter) should be replaced with async/await. [See our upgrade guide](https://bit.ly/codecept3Up). +- **[TypeScript guide](/typescript)** and [boilerplate project](https://github.com/codeceptjs/typescript-boilerplate) +- [tryTo](/plugins/#tryto) and [pauseOnFail](/plugins/#pauseOnFail) plugins installed by default +- Introduced one-line installer: ``` npx create-codeceptjs . @@ -2304,50 +2419,50 @@ Read changelog to learn more about version πŸ‘‡ ## 3.0.0-rc - - -* Moved [Helper class into its own package](https://github.com/codeceptjs/helper) to simplify publishing standalone helpers. -* Fixed typings for `I.say` and `I.retry` by @Vorobeyko -* Updated documentation: - * [Quickstart](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/quickstart.md#quickstart) - * [Best Practices](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/best.md) - * [Custom Helpers](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/custom-helpers.md) - * [TypeScript](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/typescript.md) +- Moved [Helper class into its own package](https://github.com/codeceptjs/helper) to simplify publishing standalone helpers. +- Fixed typings for `I.say` and `I.retry` by @Vorobeyko +- Updated documentation: + - [Quickstart](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/quickstart.md#quickstart) + - [Best Practices](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/best.md) + - [Custom Helpers](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/custom-helpers.md) + - [TypeScript](https://github.com/codeceptjs/CodeceptJS/blob/codeceptjs-v3.0/docs/typescript.md) ## 3.0.0-beta.4 πŸ› Bug Fix: - * PageObject was broken when using "this" inside a simple object. - * The typings for all WebDriver methods work correctly. - * The typings for "this.helper" and helper constructor work correctly, too. + +- PageObject was broken when using "this" inside a simple object. +- The typings for all WebDriver methods work correctly. +- The typings for "this.helper" and helper constructor work correctly, too. 🧀 Internal: - * Our TS Typings will be tested now! We strarted using [dtslint](https://github.com/microsoft/dtslint) to check all typings and all rules for linter. - Example: - ```ts - const psp = wd.grabPageScrollPosition() // $ExpectType Promise - psp.then( - result => { - result.x // $ExpectType number - result.y // $ExpectType number - } - ) - ``` - * And last: Reducing package size from 3.3Mb to 2.0Mb + +- Our TS Typings will be tested now! We strarted using [dtslint](https://github.com/microsoft/dtslint) to check all typings and all rules for linter. + Example: + +```ts +const psp = wd.grabPageScrollPosition() // $ExpectType Promise +psp.then((result) => { + result.x // $ExpectType number + result.y // $ExpectType number +}) +``` + +- And last: Reducing package size from 3.3Mb to 2.0Mb ## 3.0.0-beta-3 -* **BREAKING** Replaced bootstrap/teardown scripts to accept only functions or async functions. Async function with callback (with done parameter) should be replaced with async/await. [See our upgrde guide](https://bit.ly/codecept3Up). -* Test artifacts introduced. Each test object has `artifacts` property, to keep attachment files. For instance, a screenshot of a failed test is attached to a test as artifact. -* Improved output for test execution - * Changed colors for steps output, simplified - * Added stack trace for test failures - * Removed `Event emitted` from log in `--verbose` mode - * List artifacts of a failed tests +- **BREAKING** Replaced bootstrap/teardown scripts to accept only functions or async functions. Async function with callback (with done parameter) should be replaced with async/await. [See our upgrde guide](https://bit.ly/codecept3Up). +- Test artifacts introduced. Each test object has `artifacts` property, to keep attachment files. For instance, a screenshot of a failed test is attached to a test as artifact. +- Improved output for test execution + - Changed colors for steps output, simplified + - Added stack trace for test failures + - Removed `Event emitted` from log in `--verbose` mode + - List artifacts of a failed tests ![](https://user-images.githubusercontent.com/220264/82160052-397bf800-989b-11ea-81c0-8e58b3d33525.png) -* Steps & metasteps refactored by @Vorobeyko. Logs to arguments passed to page objects: +- Steps & metasteps refactored by @Vorobeyko. Logs to arguments passed to page objects: ```js // TEST: @@ -2358,146 +2473,146 @@ MyPage: hasFile "First arg", "Second arg" I see file "codecept.js" I see file "codecept.po.json" ``` -* Introduced official [TypeScript boilerplate](https://github.com/codeceptjs/typescript-boilerplate). Started by @Vorobeyko. - -## 3.0.0-beta +- Introduced official [TypeScript boilerplate](https://github.com/codeceptjs/typescript-boilerplate). Started by @Vorobeyko. -* **NodeJS 12+ required** -* **BREAKING CHANGE:** Syntax for tests has changed. +## 3.0.0-beta +- **NodeJS 12+ required** +- **BREAKING CHANGE:** Syntax for tests has changed. ```js // Previous -Scenario('title', (I, loginPage) => {}); +Scenario('title', (I, loginPage) => {}) // Current -Scenario('title', ({ I, loginPage }) => {}); +Scenario('title', ({ I, loginPage }) => {}) ``` -* **BREAKING CHANGE:** [WebDriver][Protractor][Puppeteer][Playwright][Nightmare] `grab*` functions unified: - * `grab*From` => **returns single value** from element or throws error when no matchng elements found - * `grab*FromAll` => returns array of values, or empty array when no matching elements -* Public API for workers introduced by @koushikmohan1996. [Customize parallel execution](https://github.com/Codeception/CodeceptJS/blob/codeceptjs-v3.0/docs/parallel.md#custom-parallel-execution) with workers by building custom scripts. +- **BREAKING CHANGE:** [WebDriver][Protractor][Puppeteer][Playwright][Nightmare] `grab*` functions unified: + - `grab*From` => **returns single value** from element or throws error when no matchng elements found + - `grab*FromAll` => returns array of values, or empty array when no matching elements +- Public API for workers introduced by @koushikmohan1996. [Customize parallel execution](https://github.com/Codeception/CodeceptJS/blob/codeceptjs-v3.0/docs/parallel.md#custom-parallel-execution) with workers by building custom scripts. -* [Playwright] Added `usePlaywrightTo` method to access Playwright API in tests directly: +- [Playwright] Added `usePlaywrightTo` method to access Playwright API in tests directly: ```js I.usePlaywrightTo('do something special', async ({ page }) => { // use page or browser objects here -}); +}) ``` -* [Puppeteer] Introduced `usePuppeteerTo` method to access Puppeteer API: +- [Puppeteer] Introduced `usePuppeteerTo` method to access Puppeteer API: ```js I.usePuppeteerTo('do something special', async ({ page, browser }) => { // use page or browser objects here -}); +}) ``` -* [WebDriver] Introduced `useWebDriverTo` method to access webdriverio API: +- [WebDriver] Introduced `useWebDriverTo` method to access webdriverio API: ```js I.useWebDriverTo('do something special', async ({ browser }) => { // use browser object here -}); +}) ``` -* [Protractor] Introduced `useProtractorTo` method to access protractor API -* `tryTo` plugin introduced. Allows conditional action execution: +- [Protractor] Introduced `useProtractorTo` method to access protractor API +- `tryTo` plugin introduced. Allows conditional action execution: ```js const isSeen = await tryTo(() => { - I.see('Some text'); -}); + I.see('Some text') +}) // we are not sure if cookie bar is displayed, but if so - accept cookies -tryTo(() => I.click('Accept', '.cookies')); +tryTo(() => I.click('Accept', '.cookies')) ``` -* **Possible breaking change** In semantic locators `[` char indicates CSS selector. +- **Possible breaking change** In semantic locators `[` char indicates CSS selector. + ## 2.6.11 -* [Playwright] Playwright 1.4 compatibility -* [Playwright] Added `ignoreHTTPSErrors` config option (default: false). See #2566 by gurjeetbains -* Added French translation by @vimar -* [WebDriver] Updated `dragSlider` to work in WebDriver W3C protocol. Fixes #2557 by suniljaiswal01 +- [Playwright] Playwright 1.4 compatibility +- [Playwright] Added `ignoreHTTPSErrors` config option (default: false). See #2566 by gurjeetbains +- Added French translation by @vimar +- [WebDriver] Updated `dragSlider` to work in WebDriver W3C protocol. Fixes #2557 by suniljaiswal01 ## 2.6.10 -* Fixed saving options for suite via `Feature('title', {key: value})` by @Diokuz. See #2553 and [Docs](https://codecept.io/advanced/#dynamic-configuration) +- Fixed saving options for suite via `Feature('title', {key: value})` by @Diokuz. See #2553 and [Docs](https://codecept.io/advanced/#dynamic-configuration) ## 2.6.9 -* [Puppeteer][Playwright] SessionStorage is now cleared in after hook. See #2524 -* When helper load failed the error stack is now logged by @SkReD. See #2541 -* Small documentation fixes. +- [Puppeteer][Playwright] SessionStorage is now cleared in after hook. See #2524 +- When helper load failed the error stack is now logged by @SkReD. See #2541 +- Small documentation fixes. ## 2.6.8 -* [WebDriver][Protractor][Playwright][Puppeteer][Nightmare] `saveElementScreenshot` method added to make screenshot of an element. By @suniljaiswal01 -* [Playwright][Puppeteer] Added `type` method to type a text using keyboard with an optional delay. -* [WebDriver] Added optional `delay` argument to `type` method to slow down typing. -* [Puppeteer] Fixed `amOnPage` freeze when `getPageTimeout` is 0"; set 30 sec as default timeout by @Vorobeyko. -* Fixed printing step with null argument in custom helper by @sjana-aj. See #2494 -* Fix missing screenshot on failure when REST helper is in use #2513 by @PeterNgTr -* Improve error logging in the `screenshotOnFail` plugin #2512 by @pablopaul +- [WebDriver][Protractor][Playwright][Puppeteer][Nightmare] `saveElementScreenshot` method added to make screenshot of an element. By @suniljaiswal01 +- [Playwright][Puppeteer] Added `type` method to type a text using keyboard with an optional delay. +- [WebDriver] Added optional `delay` argument to `type` method to slow down typing. +- [Puppeteer] Fixed `amOnPage` freeze when `getPageTimeout` is 0"; set 30 sec as default timeout by @Vorobeyko. +- Fixed printing step with null argument in custom helper by @sjana-aj. See #2494 +- Fix missing screenshot on failure when REST helper is in use #2513 by @PeterNgTr +- Improve error logging in the `screenshotOnFail` plugin #2512 by @pablopaul ## 2.6.7 -* Add REST helper into `standardActingHelpers` array #2474 by @PeterNgTr -* Add missing `--invert` option for `run-workers` command #2504 by @pablopaul -* [WebDriver] Introduce `forceRightClick` method #2485 bylsuniljaiswal01 -* [Playwright] Fix `setCookie` method #2491 by @bmbarker90 -* [TypeScript] Update compilerOptions.target to es2017 #2483 by @shanplourde -* [Mocha] Honor reporter configuration #2465 by @trinhpham +- Add REST helper into `standardActingHelpers` array #2474 by @PeterNgTr +- Add missing `--invert` option for `run-workers` command #2504 by @pablopaul +- [WebDriver] Introduce `forceRightClick` method #2485 bylsuniljaiswal01 +- [Playwright] Fix `setCookie` method #2491 by @bmbarker90 +- [TypeScript] Update compilerOptions.target to es2017 #2483 by @shanplourde +- [Mocha] Honor reporter configuration #2465 by @trinhpham ## 2.6.6 -* Puppeteer 4.0 support. Important: MockRequest helper won't work with Puppeter > 3.3 -* Added `xFeature` and `Feature.skip` to skip all tests in a suite. By @Georgegriff -* [Appium] Fixed #2428 Android native locator support by @idxn -* [WebDriver] Fixed `waitNumberOfVisibleElements` to actually filter visible elements. By @ilangv -* [Puppeteer] Fixed handling error which is not an Error object. Fixes `cannot read property indexOf of undefined` error. Fix #2436 by @Georgegriff -* [Puppeteer] Print error on page crash by @Georgegriff +- Puppeteer 4.0 support. Important: MockRequest helper won't work with Puppeter > 3.3 +- Added `xFeature` and `Feature.skip` to skip all tests in a suite. By @Georgegriff +- [Appium] Fixed #2428 Android native locator support by @idxn +- [WebDriver] Fixed `waitNumberOfVisibleElements` to actually filter visible elements. By @ilangv +- [Puppeteer] Fixed handling error which is not an Error object. Fixes `cannot read property indexOf of undefined` error. Fix #2436 by @Georgegriff +- [Puppeteer] Print error on page crash by @Georgegriff ## 2.6.5 -* Added `test.skipped` event to run-workers, fixing allure reports with skipped tests in workers #2391. Fix #2387 by @koushikmohan1996 -* [Playwright] Fixed calling `waitFor*` methods with custom locators #2314. Fix #2389 by @Georgegriff +- Added `test.skipped` event to run-workers, fixing allure reports with skipped tests in workers #2391. Fix #2387 by @koushikmohan1996 +- [Playwright] Fixed calling `waitFor*` methods with custom locators #2314. Fix #2389 by @Georgegriff ## 2.6.4 -* [Playwright] **Playwright 1.0 support** by @Georgegriff. +- [Playwright] **Playwright 1.0 support** by @Georgegriff. ## 2.6.3 -* [stepByStepReport plugin] Fixed when using plugin with BeforeSuite. Fixes #2337 by @mirao -* [allure plugin] Fixed reporting of tests skipped by failure in before hook. Refer to #2349 & #2354. Fix by @koushikmohan1996 +- [stepByStepReport plugin] Fixed when using plugin with BeforeSuite. Fixes #2337 by @mirao +- [allure plugin] Fixed reporting of tests skipped by failure in before hook. Refer to #2349 & #2354. Fix by @koushikmohan1996 ## 2.6.2 -* [WebDriver][Puppeteer] Added `forceClick` method to emulate click event instead of using native events. -* [Playwright] Updated to 0.14 -* [Puppeteer] Updated to Puppeteer v3.0 -* [wdio] Fixed undefined output directory for wdio plugns. Fix By @PeterNgTr -* [Playwright] Introduced `handleDownloads` method to download file. Please note, this method has slightly different API than the same one in Puppeteer. -* [allure] Fixed undefined output directory for allure plugin on using custom runner. Fix by @charliepradeep -* [WebDriver] Fixed `waitForEnabled` fix for webdriver 6. Fix by @dsharapkou -* Workers: Fixed negative failure result if use scenario with the same names. Fix by @Vorobeyko -* [MockRequest] Updated documentation to match new helper version -* Fixed: skipped tests are not reported if a suite failed in `before`. Refer #2349 & #2354. Fix by @koushikmohan1996 +- [WebDriver][Puppeteer] Added `forceClick` method to emulate click event instead of using native events. +- [Playwright] Updated to 0.14 +- [Puppeteer] Updated to Puppeteer v3.0 +- [wdio] Fixed undefined output directory for wdio plugns. Fix By @PeterNgTr +- [Playwright] Introduced `handleDownloads` method to download file. Please note, this method has slightly different API than the same one in Puppeteer. +- [allure] Fixed undefined output directory for allure plugin on using custom runner. Fix by @charliepradeep +- [WebDriver] Fixed `waitForEnabled` fix for webdriver 6. Fix by @dsharapkou +- Workers: Fixed negative failure result if use scenario with the same names. Fix by @Vorobeyko +- [MockRequest] Updated documentation to match new helper version +- Fixed: skipped tests are not reported if a suite failed in `before`. Refer #2349 & #2354. Fix by @koushikmohan1996 ## 2.6.1 -* [screenshotOnFail plugin] Fixed saving screenshot of active session. -* [screenshotOnFail plugin] Fix issue #2301 when having the flag `uniqueScreenshotNames`=true results in `undefined` in screenshot file name by @PeterNgTr -* [WebDriver] Fixed `waitForElement` not applying the optional second argument to override the default timeout in webdriverio 6. Fix by @Mooksc -* [WebDriver] Updated `waitUntil` method which is used by all of the wait* functions. This updates the `waitForElement` by the same convention used to update `waitForVisible` and `waitInUrl` to be compatible with both WebDriverIO v5 & v6. See #2313 by @Mooksc +- [screenshotOnFail plugin] Fixed saving screenshot of active session. +- [screenshotOnFail plugin] Fix issue #2301 when having the flag `uniqueScreenshotNames`=true results in `undefined` in screenshot file name by @PeterNgTr +- [WebDriver] Fixed `waitForElement` not applying the optional second argument to override the default timeout in webdriverio 6. Fix by @Mooksc +- [WebDriver] Updated `waitUntil` method which is used by all of the wait\* functions. This updates the `waitForElement` by the same convention used to update `waitForVisible` and `waitInUrl` to be compatible with both WebDriverIO v5 & v6. See #2313 by @Mooksc ## 2.6.0 -* **[Playwright] Updated to Playwright 0.12** by @Georgegriff. +- **[Playwright] Updated to Playwright 0.12** by @Georgegriff. Upgrade playwright to ^0.12: @@ -2506,22 +2621,25 @@ npm i playwright@^0.12 --save ``` [Notable changes](https://github.com/microsoft/playwright/releases/tag/v0.12.0): - * Fixed opening two browsers on start - * `executeScript` - passed function now accepts only one argument. Pass in objects or arrays if you need multtple arguments: + +- Fixed opening two browsers on start +- `executeScript` - passed function now accepts only one argument. Pass in objects or arrays if you need multtple arguments: + ```js // Old style, does not work anymore: -I.executeScript((x, y) => x + y, x, y); +I.executeScript((x, y) => x + y, x, y) // New style, passing an object: -I.executeScript(({x, y}) => x + y, {x, y}); +I.executeScript(({ x, y }) => x + y, { x, y }) ``` - * `click` - automatically waits for element to become clickable (visible, not animated) and waits for navigation. - * `clickLink` - deprecated - * `waitForClickable` - deprecated - * `forceClick` - added - * Added support for custom locators. See #2277 - * Introduced [device emulation](/playwright/#device-emulation): - * globally via `emulate` config option - * per session + +- `click` - automatically waits for element to become clickable (visible, not animated) and waits for navigation. +- `clickLink` - deprecated +- `waitForClickable` - deprecated +- `forceClick` - added +- Added support for custom locators. See #2277 +- Introduced [device emulation](/playwright/#device-emulation): + - globally via `emulate` config option + - per session **[WebDriver] Updated to webdriverio v6** by @PeterNgTr. @@ -2531,28 +2649,29 @@ upgrade webdriverio to ^6.0: ``` npm i webdriverio@^6.0 --save ``` -*(webdriverio v5 support is deprecated and will be removed in CodeceptJS 3.0)* + +_(webdriverio v5 support is deprecated and will be removed in CodeceptJS 3.0)_ [WebDriver] Introduced [Shadow DOM support](/shadow) by @gkushang ```js -I.click({ shadow: ['my-app', 'recipe-hello', 'button'] }); +I.click({ shadow: ['my-app', 'recipe-hello', 'button'] }) ``` -* **Fixed parallel execution of `run-workers` for Gherkin** scenarios by @koushikmohan1996 -* [MockRequest] Updated and **moved to [standalone package](https://github.com/codeceptjs/mock-request)**: - * full support for record/replay mode for Puppeteer - * added `mockServer` method to use flexible PollyJS API to define mocks - * fixed stale browser screen in record mode. -* [Playwright] Added support on for `screenshotOnFail` plugin by @amonkc -* Gherkin improvement: setting different tags per examples. See #2208 by @acuper -* [TestCafe] Updated `click` to take first visible element. Fixes #2226 by @theTainted -* [Puppeteer][WebDriver] Updated `waitForClickable` method to check for element overlapping. See #2261 by @PiQx -* [Puppeteer] Dropped `puppeteer-firefox` support, as Puppeteer supports Firefox natively. -* [REST] Rrespect Content-Type header. See #2262 by @pmarshall-legacy -* [allure plugin] Fixes BeforeSuite failures in allure reports. See #2248 by @Georgegriff -* [WebDriver][Puppeteer][Playwright] A screenshot of for an active session is saved in multi-session mode. See #2253 by @ChexWarrior -* Fixed `--profile` option by @pablopaul. Profile value to be passed into `run-multiple` and `run-workers`: +- **Fixed parallel execution of `run-workers` for Gherkin** scenarios by @koushikmohan1996 +- [MockRequest] Updated and **moved to [standalone package](https://github.com/codeceptjs/mock-request)**: + - full support for record/replay mode for Puppeteer + - added `mockServer` method to use flexible PollyJS API to define mocks + - fixed stale browser screen in record mode. +- [Playwright] Added support on for `screenshotOnFail` plugin by @amonkc +- Gherkin improvement: setting different tags per examples. See #2208 by @acuper +- [TestCafe] Updated `click` to take first visible element. Fixes #2226 by @theTainted +- [Puppeteer][WebDriver] Updated `waitForClickable` method to check for element overlapping. See #2261 by @PiQx +- [Puppeteer] Dropped `puppeteer-firefox` support, as Puppeteer supports Firefox natively. +- [REST] Rrespect Content-Type header. See #2262 by @pmarshall-legacy +- [allure plugin] Fixes BeforeSuite failures in allure reports. See #2248 by @Georgegriff +- [WebDriver][Puppeteer][Playwright] A screenshot of for an active session is saved in multi-session mode. See #2253 by @ChexWarrior +- Fixed `--profile` option by @pablopaul. Profile value to be passed into `run-multiple` and `run-workers`: ``` npx codecept run-workers 2 --profile firefox @@ -2560,128 +2679,128 @@ npx codecept run-workers 2 --profile firefox Value is available at `process.env.profile` (previously `process.profile`). See #2302. Fixes #1968 #1315 -* [commentStep Plugin introduced](/plugins#commentstep). Allows to annotate logical parts of a test: +- [commentStep Plugin introduced](/plugins#commentstep). Allows to annotate logical parts of a test: ```js -__`Given`; +__`Given` I.amOnPage('/profile') -__`When`; -I.click('Logout'); +__`When` +I.click('Logout') -__`Then`; -I.see('You are logged out'); +__`Then` +I.see('You are logged out') ``` ## 2.5.0 -* **Experimental: [Playwright](/playwright) helper introduced**. +- **Experimental: [Playwright](/playwright) helper introduced**. > [Playwright](https://github.com/microsoft/playwright/) is an alternative to Puppeteer which works very similarly to it but adds cross-browser support with Firefox and Webkit. Until v1.0 Playwright API is not stable but we introduce it to CodeceptJS so you could try it. -* [Puppeteer] Fixed basic auth support when running in multiple sessions. See #2178 by @ian-bartholomew -* [Puppeteer] Fixed `waitForText` when there is no `body` element on page (redirect). See #2181 by @Vorobeyko -* [Selenoid plugin] Fixed overriding current capabilities by adding deepMerge. Fixes #2183 by @koushikmohan1996 -* Added types for `Scenario.todo` by @Vorobeyko -* Added types for Mocha by @Vorobeyko. Fixed typing conflicts with Jest -* [FileSystem] Added methods by @nitschSB - * `waitForFile` - * `seeFileContentsEqualReferenceFile` -* Added `--colors` option to `run` and `run-multiple` so you force colored output in dockerized environment. See #2189 by @mirao -* [WebDriver] Added `type` command to enter value without focusing on a field. See #2198 by @xMutaGenx -* Fixed `codeceptjs gt` command to respect config pattern for tests. See #2200 and #2204 by @matheo - +- [Puppeteer] Fixed basic auth support when running in multiple sessions. See #2178 by @ian-bartholomew +- [Puppeteer] Fixed `waitForText` when there is no `body` element on page (redirect). See #2181 by @Vorobeyko +- [Selenoid plugin] Fixed overriding current capabilities by adding deepMerge. Fixes #2183 by @koushikmohan1996 +- Added types for `Scenario.todo` by @Vorobeyko +- Added types for Mocha by @Vorobeyko. Fixed typing conflicts with Jest +- [FileSystem] Added methods by @nitschSB + - `waitForFile` + - `seeFileContentsEqualReferenceFile` +- Added `--colors` option to `run` and `run-multiple` so you force colored output in dockerized environment. See #2189 by @mirao +- [WebDriver] Added `type` command to enter value without focusing on a field. See #2198 by @xMutaGenx +- Fixed `codeceptjs gt` command to respect config pattern for tests. See #2200 and #2204 by @matheo ## 2.4.3 -* Hotfix for interactive pause +- Hotfix for interactive pause ## 2.4.2 -* **Interactive pause improvements** by @koushikmohan1996 - * allows using in page objects and variables: `pause({ loginPage, a })` - * enables custom commands inside pause with `=>` prefix: `=> loginPage.open()` -* [Selenoid plugin](/plugins#selenoid) added by by @koushikmohan1996 - * uses Selenoid to launch browsers inside Docker containers - * automatically **records videos** and attaches them to allure reports - * can delete videos for successful tests - * can automatically pull in and start Selenoid containers - * works with WebDriver helper -* Avoid failiure report on successful retry in worker by @koushikmohan1996 -* Added translation ability to Scenario, Feature and other context methods by @koushikmohan1996 - * πŸ“’ Please help us translate context methods to your language! See [italian translation](https://github.com/codeceptjs/CodeceptJS/blob/master/translations/it-IT.js#L3) as an example and send [patches to vocabularies](https://github.com/codeceptjs/CodeceptJS/tree/master/translations). -* allurePlugin: Added `say` comments to allure reports by @PeterNgTr. -* Fixed no custom output folder created when executed with run-worker. Fix by @PeterNgTr -* [Puppeteer] Fixed error description for context element not found. See #2065. Fix by @PeterNgTr -* [WebDriver] Fixed `waitForClickable` to wait for exact number of seconds by @mirao. Resolves #2166 -* Fixed setting `compilerOptions` in `jsconfig.json` file on init by @PeterNgTr -* [Filesystem] Added method by @nitschSB - * `seeFileContentsEqualReferenceFile` - * `waitForFile` - +- **Interactive pause improvements** by @koushikmohan1996 + - allows using in page objects and variables: `pause({ loginPage, a })` + - enables custom commands inside pause with `=>` prefix: `=> loginPage.open()` +- [Selenoid plugin](/plugins#selenoid) added by by @koushikmohan1996 + - uses Selenoid to launch browsers inside Docker containers + - automatically **records videos** and attaches them to allure reports + - can delete videos for successful tests + - can automatically pull in and start Selenoid containers + - works with WebDriver helper +- Avoid failiure report on successful retry in worker by @koushikmohan1996 +- Added translation ability to Scenario, Feature and other context methods by @koushikmohan1996 + - πŸ“’ Please help us translate context methods to your language! See [italian translation](https://github.com/codeceptjs/CodeceptJS/blob/master/translations/it-IT.js#L3) as an example and send [patches to vocabularies](https://github.com/codeceptjs/CodeceptJS/tree/master/translations). +- allurePlugin: Added `say` comments to allure reports by @PeterNgTr. +- Fixed no custom output folder created when executed with run-worker. Fix by @PeterNgTr +- [Puppeteer] Fixed error description for context element not found. See #2065. Fix by @PeterNgTr +- [WebDriver] Fixed `waitForClickable` to wait for exact number of seconds by @mirao. Resolves #2166 +- Fixed setting `compilerOptions` in `jsconfig.json` file on init by @PeterNgTr +- [Filesystem] Added method by @nitschSB + - `seeFileContentsEqualReferenceFile` + - `waitForFile` ## 2.4.1 -* [Hotfix] - Add missing lib that prevents codeceptjs from initializing. +- [Hotfix] - Add missing lib that prevents codeceptjs from initializing. ## 2.4.0 -* Improved setup wizard with `npx codecept init`: - * **enabled [retryFailedStep](/plugins/#retryfailedstep) plugin for new setups**. - * enabled [@codeceptjs/configure](/configuration/#common-configuration-patterns) to toggle headless/window mode via env variable - * creates a new test on init - * removed question on "steps file", create it by default. -* Added [pauseOnFail plugin](/plugins/#pauseonfail). *Sponsored by Paul Vincent Beigang and his book "[Practical End 2 End Testing with CodeceptJS](https://leanpub.com/codeceptjs/)"*. -* Added [`run-rerun` command](/commands/#run-rerun) to run tests multiple times to detect and fix flaky tests. By @Ilrilan and @Vorobeyko. -* Added [`Scenario.todo()` to declare tests as pending](/basics#todotest). See #2100 by @Vorobeyko -* Added support for absolute path for `output` dir. See #2049 by @elukoyanov -* Fixed error in `npx codecept init` caused by calling `console.print`. See #2071 by @Atinux. -* [Filesystem] Methods added by @aefluke: - * `seeFileNameMatching` - * `grabFileNames` -* [Puppeteer] Fixed grabbing attributes with hyphen by @Holorium -* [TestCafe] Fixed `grabAttributeFrom` method by @elukoyanov -* [MockRequest] Added support for [Polly config options](https://netflix.github.io/pollyjs/#/configuration?id=configuration) by @ecrmnn -* [TestCafe] Fixes exiting with zero code on failure. Fixed #2090 with #2106 by @koushikmohan1996 -* [WebDriver][Puppeteer] Added basicAuth support via config. Example: `basicAuth: {username: 'username', password: 'password'}`. See #1962 by @PeterNgTr -* [WebDriver][Appium] Added `scrollIntoView` by @pablopaul -* Fixed #2118: No error stack trace for syntax error by @senthillkumar -* Added `parse()` method to data table inside Cucumber tests. Use it to obtain rows and hashes for test data. See #2082 by @Sraime +- Improved setup wizard with `npx codecept init`: + - **enabled [retryFailedStep](/plugins/#retryfailedstep) plugin for new setups**. + - enabled [@codeceptjs/configure](/configuration/#common-configuration-patterns) to toggle headless/window mode via env variable + - creates a new test on init + - removed question on "steps file", create it by default. +- Added [pauseOnFail plugin](/plugins/#pauseonfail). _Sponsored by Paul Vincent Beigang and his book "[Practical End 2 End Testing with CodeceptJS](https://leanpub.com/codeceptjs/)"_. +- Added [`run-rerun` command](/commands/#run-rerun) to run tests multiple times to detect and fix flaky tests. By @Ilrilan and @Vorobeyko. +- Added [`Scenario.todo()` to declare tests as pending](/basics#todotest). See #2100 by @Vorobeyko +- Added support for absolute path for `output` dir. See #2049 by @elukoyanov +- Fixed error in `npx codecept init` caused by calling `console.print`. See #2071 by @Atinux. +- [Filesystem] Methods added by @aefluke: + - `seeFileNameMatching` + - `grabFileNames` +- [Puppeteer] Fixed grabbing attributes with hyphen by @Holorium +- [TestCafe] Fixed `grabAttributeFrom` method by @elukoyanov +- [MockRequest] Added support for [Polly config options](https://netflix.github.io/pollyjs/#/configuration?id=configuration) by @ecrmnn +- [TestCafe] Fixes exiting with zero code on failure. Fixed #2090 with #2106 by @koushikmohan1996 +- [WebDriver][Puppeteer] Added basicAuth support via config. Example: `basicAuth: {username: 'username', password: 'password'}`. See #1962 by @PeterNgTr +- [WebDriver][Appium] Added `scrollIntoView` by @pablopaul +- Fixed #2118: No error stack trace for syntax error by @senthillkumar +- Added `parse()` method to data table inside Cucumber tests. Use it to obtain rows and hashes for test data. See #2082 by @Sraime ## 2.3.6 -* Create better Typescript definition file through JSDoc. By @lemnis -* `run-workers` now can use glob pattern. By @Ilrilan +- Create better Typescript definition file through JSDoc. By @lemnis +- `run-workers` now can use glob pattern. By @Ilrilan + ```js // Example: exports.config = { tests: '{./workers/base_test.workers.js,./workers/test_grep.workers.js}', } ``` -* Added new command `npx codeceptjs info` which print information about your environment and CodeceptJS configs. By @jamesgeorge007 -* Fixed some typos in documantation. By @pablopaul @atomicpages @EricTendian -* Added PULL_REQUEST template. -* [Puppeteer][WebDriver] Added `waitForClickable` for waiting clickable element on page. -* [TestCafe] Added support for remote connection. By @jvdieten -* [Puppeteer] Fixed `waitForText` XPath context now works correctly. By @Heavik -* [TestCafe] Fixed `clearField` clear field now awaits TestCafe's promise. By @orihomie -* [Puppeteer] Fixed fails when executing localStorage on services pages. See #2026 -* Fixed empty tags in test name. See #2038 + +- Added new command `npx codeceptjs info` which print information about your environment and CodeceptJS configs. By @jamesgeorge007 +- Fixed some typos in documantation. By @pablopaul @atomicpages @EricTendian +- Added PULL_REQUEST template. +- [Puppeteer][WebDriver] Added `waitForClickable` for waiting clickable element on page. +- [TestCafe] Added support for remote connection. By @jvdieten +- [Puppeteer] Fixed `waitForText` XPath context now works correctly. By @Heavik +- [TestCafe] Fixed `clearField` clear field now awaits TestCafe's promise. By @orihomie +- [Puppeteer] Fixed fails when executing localStorage on services pages. See #2026 +- Fixed empty tags in test name. See #2038 ## 2.3.5 -* Set "parse-function" dependency to "5.2.11" to avoid further installation errors. +- Set "parse-function" dependency to "5.2.11" to avoid further installation errors. ## 2.3.4 -* Fixed installation error "Cannot find module '@babel/runtime/helpers/interopRequireDefault'". The issue came from `parse-function` package. Fixed by @pablopaul. -* [Puppeteer] Fixed switching to iframe without an ID by @johnyb. See #1974 -* Added `--profile` option to `run-workers` by @orihomie -* Added a tag definition to `FeatureConfig` and `ScenarioConfig` by @sseliverstov +- Fixed installation error "Cannot find module '@babel/runtime/helpers/interopRequireDefault'". The issue came from `parse-function` package. Fixed by @pablopaul. +- [Puppeteer] Fixed switching to iframe without an ID by @johnyb. See #1974 +- Added `--profile` option to `run-workers` by @orihomie +- Added a tag definition to `FeatureConfig` and `ScenarioConfig` by @sseliverstov ## 2.3.3 -* **[customLocator plugin](#customlocator) introduced**. Adds a locator strategy for special test attributes on elements. +- **[customLocator plugin](#customlocator) introduced**. Adds a locator strategy for special test attributes on elements. ```js // when data-test-id is a special test attribute @@ -2690,279 +2809,280 @@ I.click({ css: '[data-test-id=register_button]'); // with this I.click('$register_button'); ``` -* [Puppeteer][WebDriver] `pressKey` improvements by @martomo: -Changed pressKey method to resolve issues and extend functionality. - * Did not properly recognize 'Meta' (or 'Command') as modifier key. - * Right modifier keys did not work in WebDriver using JsonWireProtocol. - * 'Shift' + 'key' combination would not reflect actual keyboard behavior. - * Respect sequence with multiple modifier keys passed to pressKey. - * Added support to automatic change operation modifier key based on operating system. -* [Puppeteer][WebDriver] Added `pressKeyUp` and `pressKeyDown` to press and release modifier keys like `Control` or `Shift`. By @martomo. -* [Puppeteer][WebDriver] Added `grabElementBoundingRect` by @PeterNgTr. -* [Puppeteer] Fixed speed degradation introduced in #1306 with accessibility locators support. See #1953. -* Added `Config.addHook` to add a function that will update configuration on load. -* Started [`@codeceptjs/configure`](https://github.com/codeceptjs/configure) package with a collection of common configuration patterns. -* [TestCafe] port's management removed (left on TestCafe itself) by @orihomie. Fixes #1934. -* [REST] Headers are no more declared as singleton variable. Fixes #1959 -* Updated Docker image to include run tests in workers with `NUMBER_OF_WORKERS` env variable. By @PeterNgTr. + +- [Puppeteer][WebDriver] `pressKey` improvements by @martomo: + Changed pressKey method to resolve issues and extend functionality. + - Did not properly recognize 'Meta' (or 'Command') as modifier key. + - Right modifier keys did not work in WebDriver using JsonWireProtocol. + - 'Shift' + 'key' combination would not reflect actual keyboard behavior. + - Respect sequence with multiple modifier keys passed to pressKey. + - Added support to automatic change operation modifier key based on operating system. +- [Puppeteer][WebDriver] Added `pressKeyUp` and `pressKeyDown` to press and release modifier keys like `Control` or `Shift`. By @martomo. +- [Puppeteer][WebDriver] Added `grabElementBoundingRect` by @PeterNgTr. +- [Puppeteer] Fixed speed degradation introduced in #1306 with accessibility locators support. See #1953. +- Added `Config.addHook` to add a function that will update configuration on load. +- Started [`@codeceptjs/configure`](https://github.com/codeceptjs/configure) package with a collection of common configuration patterns. +- [TestCafe] port's management removed (left on TestCafe itself) by @orihomie. Fixes #1934. +- [REST] Headers are no more declared as singleton variable. Fixes #1959 +- Updated Docker image to include run tests in workers with `NUMBER_OF_WORKERS` env variable. By @PeterNgTr. ## 2.3.2 -* [Puppeteer] Fixed Puppeteer 1.20 support by @davertmik -* Fixed `run-workers` to run with complex configs. See #1887 by @nitschSB -* Added `--suites` option to `run-workers` to split suites by workers (tests of the same suite goes to teh same worker). Thanks @nitschSB. -* Added a guide on [Email Testing](https://codecept.io/email). -* [retryFailedStepPlugin] Improved to ignore wait* steps and others. Also added option to ignore this plugin per test bases. See [updated documentation](https://codecept.io/plugins#retryfailedstep). By @davertmik -* Fixed using PageObjects as classes by @Vorobeyko. See #1896 -* [WebDriver] Fixed opening more than one tab. See #1875 by @jplegoff. Fixes #1874 -* Fixed #1891 when `I.retry()` affected retries of next steps. By @davertmik +- [Puppeteer] Fixed Puppeteer 1.20 support by @davertmik +- Fixed `run-workers` to run with complex configs. See #1887 by @nitschSB +- Added `--suites` option to `run-workers` to split suites by workers (tests of the same suite goes to teh same worker). Thanks @nitschSB. +- Added a guide on [Email Testing](https://codecept.io/email). +- [retryFailedStepPlugin] Improved to ignore wait\* steps and others. Also added option to ignore this plugin per test bases. See [updated documentation](https://codecept.io/plugins#retryfailedstep). By @davertmik +- Fixed using PageObjects as classes by @Vorobeyko. See #1896 +- [WebDriver] Fixed opening more than one tab. See #1875 by @jplegoff. Fixes #1874 +- Fixed #1891 when `I.retry()` affected retries of next steps. By @davertmik ## 2.3.1 -* [MockRequest] Polly helper was renamed to MockRequest. -* [MockRequest][WebDriver] [Mocking requests](https://codecept.io/webdriver#mocking-requests) is now available in WebDriver. Thanks @radhey1851 -* [Puppeteer] Ensure configured user agent and/or window size is applied to all pages. See #1862 by @martomo -* Improve handling of xpath locators with round brackets by @nitschSB. See #1870 -* Use WebDriver capabilities config in wdio plugin. #1869 by @quekshuy +- [MockRequest] Polly helper was renamed to MockRequest. +- [MockRequest][WebDriver] [Mocking requests](https://codecept.io/webdriver#mocking-requests) is now available in WebDriver. Thanks @radhey1851 +- [Puppeteer] Ensure configured user agent and/or window size is applied to all pages. See #1862 by @martomo +- Improve handling of xpath locators with round brackets by @nitschSB. See #1870 +- Use WebDriver capabilities config in wdio plugin. #1869 by @quekshuy ## 2.3.0 - -* **[Parallel testing by workers](https://codecept.io/parallel#parallel-execution-by-workers) introduced** by @VikalpP and @davertmik. Use `run-workers` command as faster and simpler alternative to `run-multiple`. Requires NodeJS v12 +- **[Parallel testing by workers](https://codecept.io/parallel#parallel-execution-by-workers) introduced** by @VikalpP and @davertmik. Use `run-workers` command as faster and simpler alternative to `run-multiple`. Requires NodeJS v12 ``` # run all tests in parallel using 3 workers npx codeceptjs run-workers 3 ``` -* [GraphQL][GraphQLDataFactory] **Helpers for data management over GraphQL** APIs added. By @radhey1851. - * Learn how to [use GraphQL helper](https://codecept.io/data#graphql) to access GarphQL API - * And how to combine it with [GraphQLDataFactory](https://codecept.io/data#graphql-data-factory) to generate and persist test data. -* **Updated to use Mocha 6**. See #1802 by @elukoyanov -* Added `dry-run` command to print steps of test scenarios without running them. Fails to execute scenarios with `grab*` methods or custom code. See #1825 for more details. + +- [GraphQL][GraphQLDataFactory] **Helpers for data management over GraphQL** APIs added. By @radhey1851. + - Learn how to [use GraphQL helper](https://codecept.io/data#graphql) to access GarphQL API + - And how to combine it with [GraphQLDataFactory](https://codecept.io/data#graphql-data-factory) to generate and persist test data. +- **Updated to use Mocha 6**. See #1802 by @elukoyanov +- Added `dry-run` command to print steps of test scenarios without running them. Fails to execute scenarios with `grab*` methods or custom code. See #1825 for more details. ``` npx codeceptjs dry-run ``` -* [Appium] Optimization when clicking, searching for fields by accessibility id. See #1777 by @gagandeepsingh26 -* [TestCafe] Fixed `switchTo` by @KadoBOT -* [WebDriver] Added geolocation actions by @PeterNgTr - * `grabGeoLocation()` - * `setGeoLocation()` -* [Polly] Check typeof arguments for mock requests by @VikalpP. Fixes #1815 -* CLI improvements by @jamesgeorge007 - * `codeceptjs` command prints list of all available commands - * added `codeceptjs -V` flag to print version information - * warns on unknown command -* Added TypeScript files support to `run-multiple` by @z4o4z -* Fixed element position bug in locator builder. See #1829 by @AnotherAnkor -* Various TypeScript typings updates by @elukoyanov and @Vorobeyko -* Added `event.step.comment` event for all comment steps like `I.say` or gherking steps. +- [Appium] Optimization when clicking, searching for fields by accessibility id. See #1777 by @gagandeepsingh26 +- [TestCafe] Fixed `switchTo` by @KadoBOT +- [WebDriver] Added geolocation actions by @PeterNgTr + - `grabGeoLocation()` + - `setGeoLocation()` +- [Polly] Check typeof arguments for mock requests by @VikalpP. Fixes #1815 +- CLI improvements by @jamesgeorge007 + - `codeceptjs` command prints list of all available commands + - added `codeceptjs -V` flag to print version information + - warns on unknown command +- Added TypeScript files support to `run-multiple` by @z4o4z +- Fixed element position bug in locator builder. See #1829 by @AnotherAnkor +- Various TypeScript typings updates by @elukoyanov and @Vorobeyko +- Added `event.step.comment` event for all comment steps like `I.say` or gherking steps. ## 2.2.1 -* [WebDriver] A [dedicated guide](https://codecept.io/webdriver) written. -* [TestCafe] A [dedicated guide](https://codecept.io/testcafe) written. -* [Puppeteer] A [chapter on mocking](https://codecept.io/puppeteer#mocking-requests) written -* [Puppeteer][Nightmare][TestCafe] Window mode is enabled by default on `codeceptjs init`. -* [TestCafe] Actions implemented by @hubidu - * `grabPageScrollPosition` - * `scrollPageToTop` - * `scrollPageToBottom` - * `scrollTo` - * `switchTo` -* Intellisense improvements. Renamed `tsconfig.json` to `jsconfig.json` on init. Fixed autocompletion for Visual Studio Code. -* [Polly] Take configuration values from Puppeteer. Fix #1766 by @VikalpP -* [Polly] Add preconditions to check for puppeteer page availability by @VikalpP. Fixes #1767 -* [WebDriver] Use filename for `uploadFile` by @VikalpP. See #1797 -* [Puppeteer] Configure speed of input with `pressKeyDelay` option. By @hubidu -* Fixed recursive loading of support objects by @davertmik. -* Fixed support object definitions in steps.d.ts by @johnyb. Fixes #1795 -* Fixed `Data().Scenario().injectDependencies()` is not a function by @andrerleao -* Fixed crash when using xScenario & Scenario.skip with tag by @VikalpP. Fixes #1751 -* Dynamic configuration of helpers can be performed with async function. See #1786 by @cviejo -* Added TS definitions for internal objects by @Vorobeyko -* BDD improvements: - * Fix for snippets command with a .feature file that has special characters by @asselin - * Fix `--path` option on `gherkin:snippets` command by @asselin. See #1790 - * Added `--feature` option to `gherkin:snippets` to enable creating snippets for a subset of .feature files. See #1803 by @asselin. -* Fixed: dynamic configs not reset after test. Fixes #1776 by @cviejo. +- [WebDriver] A [dedicated guide](https://codecept.io/webdriver) written. +- [TestCafe] A [dedicated guide](https://codecept.io/testcafe) written. +- [Puppeteer] A [chapter on mocking](https://codecept.io/puppeteer#mocking-requests) written +- [Puppeteer][Nightmare][TestCafe] Window mode is enabled by default on `codeceptjs init`. +- [TestCafe] Actions implemented by @hubidu + - `grabPageScrollPosition` + - `scrollPageToTop` + - `scrollPageToBottom` + - `scrollTo` + - `switchTo` +- Intellisense improvements. Renamed `tsconfig.json` to `jsconfig.json` on init. Fixed autocompletion for Visual Studio Code. +- [Polly] Take configuration values from Puppeteer. Fix #1766 by @VikalpP +- [Polly] Add preconditions to check for puppeteer page availability by @VikalpP. Fixes #1767 +- [WebDriver] Use filename for `uploadFile` by @VikalpP. See #1797 +- [Puppeteer] Configure speed of input with `pressKeyDelay` option. By @hubidu +- Fixed recursive loading of support objects by @davertmik. +- Fixed support object definitions in steps.d.ts by @johnyb. Fixes #1795 +- Fixed `Data().Scenario().injectDependencies()` is not a function by @andrerleao +- Fixed crash when using xScenario & Scenario.skip with tag by @VikalpP. Fixes #1751 +- Dynamic configuration of helpers can be performed with async function. See #1786 by @cviejo +- Added TS definitions for internal objects by @Vorobeyko +- BDD improvements: + - Fix for snippets command with a .feature file that has special characters by @asselin + - Fix `--path` option on `gherkin:snippets` command by @asselin. See #1790 + - Added `--feature` option to `gherkin:snippets` to enable creating snippets for a subset of .feature files. See #1803 by @asselin. +- Fixed: dynamic configs not reset after test. Fixes #1776 by @cviejo. ## 2.2.0 -* **EXPERIMENTAL** [**TestCafe** helper](https://codecept.io/helpers/TestCafe) introduced. TestCafe allows to run cross-browser tests it its own very fast engine. Supports all browsers including mobile. Thanks to @hubidu for implementation! Please test it and send us feedback. -* [Puppeteer] Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly). Thanks @VikalpP +- **EXPERIMENTAL** [**TestCafe** helper](https://codecept.io/helpers/TestCafe) introduced. TestCafe allows to run cross-browser tests it its own very fast engine. Supports all browsers including mobile. Thanks to @hubidu for implementation! Please test it and send us feedback. +- [Puppeteer] Mocking requests enabled by introducing [Polly.js helper](https://codecept.io/helpers/Polly). Thanks @VikalpP ```js // use Polly & Puppeteer helpers -I.mockRequest('GET', '/api/users', 200); -I.mockRequest('POST', '/users', { user: { name: 'fake' }}); -``` - -* **EXPERIMENTAL** [Puppeteer] [Firefox support](https://codecept.io/helpers/Puppeteer-firefox) introduced by @ngadiyak, see #1740 -* [stepByStepReportPlugin] use md5 hash to generate reports into unique folder. Fix #1744 by @chimurai -* Interactive pause improvements: - * print result of `grab` commands - * print message for successful assertions -* `run-multiple` (parallel execution) improvements: - * `bootstrapAll` must be called before creating chunks. #1741 by @Vorobeyko - * Bugfix: If value in config has falsy value then multiple config does not overwrite original value. #1756 by @LukoyanovE -* Fixed hooks broken in 2.1.5 by @Vorobeyko -* Fix references to support objects when using Dependency Injection. Fix by @johnyb. See #1701 -* Fix dynamic config applied for multiple helpers by @VikalpP #1743 - +I.mockRequest('GET', '/api/users', 200) +I.mockRequest('POST', '/users', { user: { name: 'fake' } }) +``` + +- **EXPERIMENTAL** [Puppeteer] [Firefox support](https://codecept.io/helpers/Puppeteer-firefox) introduced by @ngadiyak, see #1740 +- [stepByStepReportPlugin] use md5 hash to generate reports into unique folder. Fix #1744 by @chimurai +- Interactive pause improvements: + - print result of `grab` commands + - print message for successful assertions +- `run-multiple` (parallel execution) improvements: + - `bootstrapAll` must be called before creating chunks. #1741 by @Vorobeyko + - Bugfix: If value in config has falsy value then multiple config does not overwrite original value. #1756 by @LukoyanovE +- Fixed hooks broken in 2.1.5 by @Vorobeyko +- Fix references to support objects when using Dependency Injection. Fix by @johnyb. See #1701 +- Fix dynamic config applied for multiple helpers by @VikalpP #1743 ## 2.1.5 -* **EXPERIMENTAL** [Wix Detox support](https://github.com/codeceptjs/detox-helper) introduced as standalone helper. Provides a faster alternative to Appium for mobile testing. -* Saving successful commands inside interactive pause into `_output/cli-history` file. By @hubidu -* Fixed hanging error handler inside scenario. See #1721 by @haily-lgc. -* Fixed by @Vorobeyko: tests did not fail when an exception was raised in async bootstrap. -* [WebDriver] Added window control methods by @emmonspired - * `grabAllWindowHandles` returns all window handles - * `grabCurrentWindowHandle` returns current window handle - * `switchToWindow` switched to window by its handle -* [Appium] Fixed using `host` as configuration by @trinhpham -* Fixed `run-multiple` command when `tests` config option is undefined (in Gherkin scenarios). By @gkushang. -* German translation introduced by @hubidu +- **EXPERIMENTAL** [Wix Detox support](https://github.com/codeceptjs/detox-helper) introduced as standalone helper. Provides a faster alternative to Appium for mobile testing. +- Saving successful commands inside interactive pause into `_output/cli-history` file. By @hubidu +- Fixed hanging error handler inside scenario. See #1721 by @haily-lgc. +- Fixed by @Vorobeyko: tests did not fail when an exception was raised in async bootstrap. +- [WebDriver] Added window control methods by @emmonspired + - `grabAllWindowHandles` returns all window handles + - `grabCurrentWindowHandle` returns current window handle + - `switchToWindow` switched to window by its handle +- [Appium] Fixed using `host` as configuration by @trinhpham +- Fixed `run-multiple` command when `tests` config option is undefined (in Gherkin scenarios). By @gkushang. +- German translation introduced by @hubidu ## 2.1.4 -* [WebDriver][Puppeteer][Protractor][Nightmare] A11y locator support introduced by @Holorium. Clickable elements as well as fields can be located by following attributes: - * `aria-label` - * `title` - * `aria-labelledby` -* [Puppeteer] Added support for React locators. - * New [React Guide](https://codecept.io/react) added. -* [Puppeteer] Deprecated `downloadFile` -* [Puppeteer] Introduced `handleDownloads` replacing `downloadFile` -* [puppeteerCoverage plugin] Fixed path already exists error by @seta-tuha. -* Fixed 'ERROR: ENAMETOOLONG' creating directory names in `run-multiple` with long config. By @artvinn -* [REST] Fixed url autocompletion combining base and relative paths by @LukoyanovE -* [Nightmare][Protractor] `uncheckOption` method introduced by @PeterNgTr -* [autoLogin plugin] Enable to use without `await` by @tsuemura -* [Puppeteer] Fixed `UnhandledPromiseRejectionWarning: "Execution context was destroyed...` by @adrielcodeco -* [WebDriver] Keep browser window dimensions when starting a new session by @spiroid -* Replace Ghekrin plceholders with values in files that combine a scenerio outline and table by @medtoure18. -* Added Documentation to [locate elements in React Native](https://codecept.io/mobile-react-native-locators) apps. By @DimGun. -* Adding optional `path` parameter to `bdd:snippets` command to append snippets to a specific file. By @cthorsen31. -* Added optional `output` parameter to `def` command by @LukoyanovE. -* [Puppeteer] Added `grabDataFromPerformanceTiming` by @PeterNgTr. -* axios updated to `0.19.0` by @SteveShaffer -* TypeScript defitions updated by @LukoyanovE. Added `secret` and `inject` function. +- [WebDriver][Puppeteer][Protractor][Nightmare] A11y locator support introduced by @Holorium. Clickable elements as well as fields can be located by following attributes: + - `aria-label` + - `title` + - `aria-labelledby` +- [Puppeteer] Added support for React locators. + - New [React Guide](https://codecept.io/react) added. +- [Puppeteer] Deprecated `downloadFile` +- [Puppeteer] Introduced `handleDownloads` replacing `downloadFile` +- [puppeteerCoverage plugin] Fixed path already exists error by @seta-tuha. +- Fixed 'ERROR: ENAMETOOLONG' creating directory names in `run-multiple` with long config. By @artvinn +- [REST] Fixed url autocompletion combining base and relative paths by @LukoyanovE +- [Nightmare][Protractor] `uncheckOption` method introduced by @PeterNgTr +- [autoLogin plugin] Enable to use without `await` by @tsuemura +- [Puppeteer] Fixed `UnhandledPromiseRejectionWarning: "Execution context was destroyed...` by @adrielcodeco +- [WebDriver] Keep browser window dimensions when starting a new session by @spiroid +- Replace Ghekrin plceholders with values in files that combine a scenerio outline and table by @medtoure18. +- Added Documentation to [locate elements in React Native](https://codecept.io/mobile-react-native-locators) apps. By @DimGun. +- Adding optional `path` parameter to `bdd:snippets` command to append snippets to a specific file. By @cthorsen31. +- Added optional `output` parameter to `def` command by @LukoyanovE. +- [Puppeteer] Added `grabDataFromPerformanceTiming` by @PeterNgTr. +- axios updated to `0.19.0` by @SteveShaffer +- TypeScript defitions updated by @LukoyanovE. Added `secret` and `inject` function. ## 2.1.3 -* Fixed autoLogin plugin to inject `login` function -* Fixed using `toString()` in DataTablewhen it is defined by @tsuemura +- Fixed autoLogin plugin to inject `login` function +- Fixed using `toString()` in DataTablewhen it is defined by @tsuemura ## 2.1.2 -* Fixed `inject` to load objects recursively. -* Fixed TypeScript definitions for locators by @LukoyanovE -* **EXPERIMENTAL** [WebDriver] ReactJS locators support with webdriverio v5.8+: +- Fixed `inject` to load objects recursively. +- Fixed TypeScript definitions for locators by @LukoyanovE +- **EXPERIMENTAL** [WebDriver] ReactJS locators support with webdriverio v5.8+: ```js // locating React element by name, prop, state -I.click({ react: 'component-name', props: {}, state: {} }); -I.seeElement({ react: 'component-name', props: {}, state: {} }); +I.click({ react: 'component-name', props: {}, state: {} }) +I.seeElement({ react: 'component-name', props: {}, state: {} }) ``` ## 2.1.1 -* Do not retry `within` and `session` calls inside `retryFailedStep` plugin. Fix by @tsuemura +- Do not retry `within` and `session` calls inside `retryFailedStep` plugin. Fix by @tsuemura ## 2.1.0 -* Added global `inject()` function to require actor and page objects using dependency injection. Recommended to use in page objects, step definition files, support objects: +- Added global `inject()` function to require actor and page objects using dependency injection. Recommended to use in page objects, step definition files, support objects: ```js // old way -const I = actor(); -const myPage = require('../page/myPage'); +const I = actor() +const myPage = require('../page/myPage') // new way -const { I, myPage } = inject(); +const { I, myPage } = inject() ``` -* Added global `secret` function to fill in sensitive data. By @RohanHart: +- Added global `secret` function to fill in sensitive data. By @RohanHart: ```js -I.fillField('password', secret('123456')); -``` - -* [wdioPlugin](https://codecept.io/plugins/#wdio) Added a plugin to **support webdriverio services** including *selenium-standalone*, *sauce*, *browserstack*, etc. **Sponsored by @GSasu** -* [Appium] Fixed `swipe*` methods by @PeterNgTr -* BDD Gherkin Improvements: - * Implemented `run-multiple` for feature files. **Sponsored by @GSasu** - * Added `--features` and `--tests` options to `run-multiple`. **Sponsored by @GSasu** - * Implemented `Before` and `After` hooks in [step definitions](https://codecept.io/bdd#before) -* Fixed running tests by absolute path. By @batalov. -* Enabled the adding screenshot to failed test for moch-junit-reporter by @PeterNgTr. -* [Puppeteer] Implemented `uncheckOption` and fixed behavior of `checkOption` by @aml2610 -* [WebDriver] Fixed `seeTextEquals` on empty strings by @PeterNgTr -* [Puppeteer] Fixed launch with `browserWSEndpoint` config by @ngadiyak. -* [Puppeteer] Fixed switching back to main window in multi-session mode by @davertmik. -* [autoLoginPlugin] Fixed using async functions for auto login by @nitschSB +I.fillField('password', secret('123456')) +``` + +- [wdioPlugin](https://codecept.io/plugins/#wdio) Added a plugin to **support webdriverio services** including _selenium-standalone_, _sauce_, _browserstack_, etc. **Sponsored by @GSasu** +- [Appium] Fixed `swipe*` methods by @PeterNgTr +- BDD Gherkin Improvements: + - Implemented `run-multiple` for feature files. **Sponsored by @GSasu** + - Added `--features` and `--tests` options to `run-multiple`. **Sponsored by @GSasu** + - Implemented `Before` and `After` hooks in [step definitions](https://codecept.io/bdd#before) +- Fixed running tests by absolute path. By @batalov. +- Enabled the adding screenshot to failed test for moch-junit-reporter by @PeterNgTr. +- [Puppeteer] Implemented `uncheckOption` and fixed behavior of `checkOption` by @aml2610 +- [WebDriver] Fixed `seeTextEquals` on empty strings by @PeterNgTr +- [Puppeteer] Fixed launch with `browserWSEndpoint` config by @ngadiyak. +- [Puppeteer] Fixed switching back to main window in multi-session mode by @davertmik. +- [autoLoginPlugin] Fixed using async functions for auto login by @nitschSB > This release was partly sponsored by @GSasu. Thanks for the support! -Do you want to improve this project? [Learn more about sponsorin CodeceptJS - +> Do you want to improve this project? [Learn more about sponsorin CodeceptJS ## 2.0.8 -* [Puppeteer] Added `downloadFile` action by @PeterNgTr. +- [Puppeteer] Added `downloadFile` action by @PeterNgTr. Use it with `FileSystem` helper to test availability of a file: + ```js - const fileName = await I.downloadFile('a.file-link'); - I.amInPath('output'); - I.seeFile(fileName); +const fileName = await I.downloadFile('a.file-link') +I.amInPath('output') +I.seeFile(fileName) ``` + > Actions `amInPath` and `seeFile` are taken from [FileSystem](https://codecept.io/helpers/FileSystem) helper -* [Puppeteer] Fixed `autoLogin` plugin with Puppeteer by @davertmik -* [WebDriver] `seeInField` should throw error if element has no value attrubite. By @PeterNgTr -* [WebDriver] Fixed `seeTextEquals` passes for any string if element is empty by @PeterNgTr. -* [WebDriver] Internal refctoring to use `el.isDisplayed` to match latest webdriverio implementation. Thanks to @LukoyanovE -* [allure plugin] Add ability enable [screenshotDiff plugin](https://github.com/allure-framework/allure2/blob/master/plugins/screen-diff-plugin/README.md) by @Vorobeyko -* [Appium] Fixed `locator.stringify` call by @LukoyanovE +- [Puppeteer] Fixed `autoLogin` plugin with Puppeteer by @davertmik +- [WebDriver] `seeInField` should throw error if element has no value attrubite. By @PeterNgTr +- [WebDriver] Fixed `seeTextEquals` passes for any string if element is empty by @PeterNgTr. +- [WebDriver] Internal refctoring to use `el.isDisplayed` to match latest webdriverio implementation. Thanks to @LukoyanovE +- [allure plugin] Add ability enable [screenshotDiff plugin](https://github.com/allure-framework/allure2/blob/master/plugins/screen-diff-plugin/README.md) by @Vorobeyko +- [Appium] Fixed `locator.stringify` call by @LukoyanovE ## 2.0.7 -* [WebDriver][Protractor][Nightmare] `rightClick` method implemented (fixed) in a standard way. By @davertmik -* [WebDriver] Updated WebDriver API calls in helper. By @PeterNgTr -* [stepByStepReportPlugin] Added `screenshotsForAllureReport` config options to automatically attach screenshots to allure reports. By @PeterNgTr -* [allurePlugin] Added `addLabel` method by @Vorobeyko -* Locator Builder: fixed `withChild` and `withDescendant` to match deep nested siblings by @Vorobeyko. +- [WebDriver][Protractor][Nightmare] `rightClick` method implemented (fixed) in a standard way. By @davertmik +- [WebDriver] Updated WebDriver API calls in helper. By @PeterNgTr +- [stepByStepReportPlugin] Added `screenshotsForAllureReport` config options to automatically attach screenshots to allure reports. By @PeterNgTr +- [allurePlugin] Added `addLabel` method by @Vorobeyko +- Locator Builder: fixed `withChild` and `withDescendant` to match deep nested siblings by @Vorobeyko. ## 2.0.6 -* Introduced [Custom Locator Strategies](https://codecept.io/locators#custom-locators). -* Added [Visual Testing Guide](https://codecept.io/visual) by @puneet0191 and @MitkoTschimev. -* [Puppeteer] [`puppeteerCoverage`](https://codecept.io/plugins#puppeteercoverage) plugin added to collect code coverage in JS. By @dvillarama -* Make override option in `run-multiple` to respect the generated overridden config by @kinyat -* Fixed deep merge for `container.append()`. Introduced `lodash.merge()`. By @Vorobeyko -* Fixed saving screenshot on Windows by -* Fix errors on using interactive shell with Allure plugin by tsuemura -* Fixed using dynamic injections with `Scenario().injectDependencies` by @tsemura -* [WebDriver][Puppeteer][Nightmare][Protractor] Fixed url protocol detection for non-http urls by @LukoyanovE -* [WebDriver] Enabled compatibility with `stepByStepReport` by @tsuemura -* [WebDriver] Fixed `grabHTMLFrom` to return innerHTML value by @Holorium. Fixed compatibility with WebDriverIO. -* [WebDriver] `grabHTMLFrom` to return one HTML vlaue for one element matched, array if multiple elements found by @davertmik. -* [Nightmare] Added `grabHTMLFrom` by @davertmik -* Fixed `bootstrapAll` and `teardownAll` launch with path as argument by @LukoyanovE -* Fixed `bootstrapAll` and `teardownAll` calls from exported object by @LukoyanovE -* [WebDriver] Added possibility to define conditional checks interval for `waitUntil` by @LukoyanovE -* Fixed storing current data in data driven tests in a test object. By @Vorobeyko -* [WebDriver] Fixed `hostname` config option overwrite when setting a cloud provider. By @LukoyanovE -* [WebDriver] `dragSlider` method implemented by @DavertMik -* [WebDrover] Fixed `scrollTo` to use new webdriverio API by @PeterNgTr -* Added Japanese translation file by @tsemura -* Added `Locator.withDescendant()` method to find an element which contains a descendant (child, grandchild) by @Vorobeyko -* [WebDriver] Fixed configuring capabilities for Selenoid and IE by @Vorobeyko -* [WebDriver] Restore original window size when taking full size screenshot by @tsuemura -* Enabled `throws()`,` fails()`, `retry()`, `timeout()`, `config()` functions for data driven tests. By @jjm409 +- Introduced [Custom Locator Strategies](https://codecept.io/locators#custom-locators). +- Added [Visual Testing Guide](https://codecept.io/visual) by @puneet0191 and @MitkoTschimev. +- [Puppeteer] [`puppeteerCoverage`](https://codecept.io/plugins#puppeteercoverage) plugin added to collect code coverage in JS. By @dvillarama +- Make override option in `run-multiple` to respect the generated overridden config by @kinyat +- Fixed deep merge for `container.append()`. Introduced `lodash.merge()`. By @Vorobeyko +- Fixed saving screenshot on Windows by +- Fix errors on using interactive shell with Allure plugin by tsuemura +- Fixed using dynamic injections with `Scenario().injectDependencies` by @tsemura +- [WebDriver][Puppeteer][Nightmare][Protractor] Fixed url protocol detection for non-http urls by @LukoyanovE +- [WebDriver] Enabled compatibility with `stepByStepReport` by @tsuemura +- [WebDriver] Fixed `grabHTMLFrom` to return innerHTML value by @Holorium. Fixed compatibility with WebDriverIO. +- [WebDriver] `grabHTMLFrom` to return one HTML vlaue for one element matched, array if multiple elements found by @davertmik. +- [Nightmare] Added `grabHTMLFrom` by @davertmik +- Fixed `bootstrapAll` and `teardownAll` launch with path as argument by @LukoyanovE +- Fixed `bootstrapAll` and `teardownAll` calls from exported object by @LukoyanovE +- [WebDriver] Added possibility to define conditional checks interval for `waitUntil` by @LukoyanovE +- Fixed storing current data in data driven tests in a test object. By @Vorobeyko +- [WebDriver] Fixed `hostname` config option overwrite when setting a cloud provider. By @LukoyanovE +- [WebDriver] `dragSlider` method implemented by @DavertMik +- [WebDrover] Fixed `scrollTo` to use new webdriverio API by @PeterNgTr +- Added Japanese translation file by @tsemura +- Added `Locator.withDescendant()` method to find an element which contains a descendant (child, grandchild) by @Vorobeyko +- [WebDriver] Fixed configuring capabilities for Selenoid and IE by @Vorobeyko +- [WebDriver] Restore original window size when taking full size screenshot by @tsuemura +- Enabled `throws()`,` fails()`, `retry()`, `timeout()`, `config()` functions for data driven tests. By @jjm409 ## 2.0.5 @@ -2970,60 +3090,58 @@ Use it with `FileSystem` helper to test availability of a file: ## 2.0.4 -* [WebDriver][Protractor][Nightmare][Puppeteer] `grabAttributeFrom` returns an array when multiple elements matched. By @PeterNgTr -* [autoLogin plugin] Fixed merging users config by @nealfennimore -* [autoDelay plugin] Added WebDriver to list of supported helpers by @mattin4d -* [Appium] Fixed using locators in `waitForElement`, `waitForVisible`, `waitForInvisible`. By @eduardofinotti -* [allure plugin] Add tags to allure reports by @Vorobeyko -* [allure plugin] Add skipped tests to allure reports by @Vorobeyko -* Fixed `Logged Test name | [object Object]` when used Data().Scenario(). By @Vorobeyko -* Fixed Data().only.Scenario() to run for all datasets. By @Vorobeyko -* [WebDriver] `attachFile` to work with hidden elements. Fixed in #1460 by @tsuemura - - +- [WebDriver][Protractor][Nightmare][Puppeteer] `grabAttributeFrom` returns an array when multiple elements matched. By @PeterNgTr +- [autoLogin plugin] Fixed merging users config by @nealfennimore +- [autoDelay plugin] Added WebDriver to list of supported helpers by @mattin4d +- [Appium] Fixed using locators in `waitForElement`, `waitForVisible`, `waitForInvisible`. By @eduardofinotti +- [allure plugin] Add tags to allure reports by @Vorobeyko +- [allure plugin] Add skipped tests to allure reports by @Vorobeyko +- Fixed `Logged Test name | [object Object]` when used Data().Scenario(). By @Vorobeyko +- Fixed Data().only.Scenario() to run for all datasets. By @Vorobeyko +- [WebDriver] `attachFile` to work with hidden elements. Fixed in #1460 by @tsuemura ## 2.0.3 -* [**autoLogin plugin**](https://codecept.io/plugins#autologin) added. Allows to log in once and reuse browser session. When session expires - automatically logs in again. Can persist session between runs by saving cookies to file. -* Fixed `Maximum stack trace` issue in `retryFailedStep` plugin. -* Added `locate()` function into the interactive shell. -* [WebDriver] Disabled smartWait for interactive shell. -* [Appium] Updated methods to use for mobile locators - * `waitForElement` - * `waitForVisible` - * `waitForInvisible` -* Helper and page object generators no longer update config automatically. Please add your page objects and helpers manually. +- [**autoLogin plugin**](https://codecept.io/plugins#autologin) added. Allows to log in once and reuse browser session. When session expires - automatically logs in again. Can persist session between runs by saving cookies to file. +- Fixed `Maximum stack trace` issue in `retryFailedStep` plugin. +- Added `locate()` function into the interactive shell. +- [WebDriver] Disabled smartWait for interactive shell. +- [Appium] Updated methods to use for mobile locators + - `waitForElement` + - `waitForVisible` + - `waitForInvisible` +- Helper and page object generators no longer update config automatically. Please add your page objects and helpers manually. ## 2.0.2 -* [Puppeteer] Improved handling of connection with remote browser using Puppeteer by @martomo -* [WebDriver] Updated to webdriverio 5.2.2 by @martomo -* Interactive pause improvements by @davertmik - * Disable retryFailedStep plugin in in interactive mode - * Removes `Interface: parseInput` while in interactive pause -* [ApiDataFactory] Improvements - * added `fetchId` config option to override id retrieval from payload - * added `onRequest` config option to update request in realtime - * added `returnId` config option to return ids of created items instead of items themvelves - * added `headers` config option to override default headers. - * added a new chapter into [DataManagement](https://codecept.io/data#api-requests-using-browser-session) -* [REST] Added `onRequest` config option - +- [Puppeteer] Improved handling of connection with remote browser using Puppeteer by @martomo +- [WebDriver] Updated to webdriverio 5.2.2 by @martomo +- Interactive pause improvements by @davertmik + - Disable retryFailedStep plugin in in interactive mode + - Removes `Interface: parseInput` while in interactive pause +- [ApiDataFactory] Improvements + - added `fetchId` config option to override id retrieval from payload + - added `onRequest` config option to update request in realtime + - added `returnId` config option to return ids of created items instead of items themvelves + - added `headers` config option to override default headers. + - added a new chapter into [DataManagement](https://codecept.io/data#api-requests-using-browser-session) +- [REST] Added `onRequest` config option ## 2.0.1 -* Fixed creating project with `codecept init`. -* Fixed error while installing webdriverio@5. -* Added code beautifier for generated configs. -* [WebDriver] Updated to webdriverio 5.1.0 +- Fixed creating project with `codecept init`. +- Fixed error while installing webdriverio@5. +- Added code beautifier for generated configs. +- [WebDriver] Updated to webdriverio 5.1.0 ## 2.0.0 -* [WebDriver] **Breaking Change.** Updated to webdriverio v5. New helper **WebDriver** helper introduced. +- [WebDriver] **Breaking Change.** Updated to webdriverio v5. New helper **WebDriver** helper introduced. - * **Upgrade plan**: + - **Upgrade plan**: 1. Install latest webdriverio + ``` npm install webdriverio@5 --save ``` @@ -3034,138 +3152,139 @@ Use it with `FileSystem` helper to test availability of a file: > If you face issues using webdriverio v5 you can still use webdriverio 4.x and WebDriverIO helper. Make sure you have `webdriverio: ^4.0` installed. - * Known issues: `attachFile` doesn't work with proxy server. + - Known issues: `attachFile` doesn't work with proxy server. -* [Appium] **Breaking Change.** Updated to use webdriverio v5 as well. See upgrade plan ↑ -* [REST] **Breaking Change.** Replaced `unirest` library with `axios`. +- [Appium] **Breaking Change.** Updated to use webdriverio v5 as well. See upgrade plan ↑ +- [REST] **Breaking Change.** Replaced `unirest` library with `axios`. - * **Upgrade plan**: + - **Upgrade plan**: 1. Refer to [axios API](https://github.com/axios/axios). 2. If you were using `unirest` requests/responses in your tests change them to axios format. -* **Breaking Change.** Generators support in tests removed. Use `async/await` in your tests -* **Using `codecept.conf.js` as default configuration format** -* Fixed "enametoolong" error when saving screenshots for data driven tests by @PeterNgTr -* Updated NodeJS to 10 in Docker image -* [Pupeteer] Add support to use WSEndpoint. Allows to execute tests remotely. [See #1350] by @gabrielcaires (https://github.com/codeceptjs/CodeceptJS/pull/1350) -* In interactive shell [Enter] goes to next step. Improvement by @PeterNgTr. -* `I.say` accepts second parameter as color to print colorful comments. Improvement by @PeterNgTr. + +- **Breaking Change.** Generators support in tests removed. Use `async/await` in your tests +- **Using `codecept.conf.js` as default configuration format** +- Fixed "enametoolong" error when saving screenshots for data driven tests by @PeterNgTr +- Updated NodeJS to 10 in Docker image +- [Pupeteer] Add support to use WSEndpoint. Allows to execute tests remotely. [See #1350] by @gabrielcaires (https://github.com/codeceptjs/CodeceptJS/pull/1350) +- In interactive shell [Enter] goes to next step. Improvement by @PeterNgTr. +- `I.say` accepts second parameter as color to print colorful comments. Improvement by @PeterNgTr. ```js -I.say('This is red', 'red'); //red is used -I.say('This is blue', 'blue'); //blue is used -I.say('This is by default'); //cyan is used +I.say('This is red', 'red') //red is used +I.say('This is blue', 'blue') //blue is used +I.say('This is by default') //cyan is used ``` -* Fixed allure reports for multi session testing by @PeterNgTr -* Fixed allure reports for hooks by @PeterNgTr + +- Fixed allure reports for multi session testing by @PeterNgTr +- Fixed allure reports for hooks by @PeterNgTr ## 1.4.6 -* [Puppeteer] `dragSlider` action added by @PeterNgTr -* [Puppeteer] Fixed opening browser in shell mode by @allenhwkim -* [Puppeteer] Fixed making screenshot on additional sessions by @PeterNgTr. Fixes #1266 -* Added `--invert` option to `run-multiple` command by @LukoyanovE -* Fixed steps in Allure reports by @PeterNgTr -* Add option `output` to customize output directory in [stepByStepReport plugin](https://codecept.io/plugins/#stepbystepreport). By @fpsthirty -* Changed type definition of PageObjects to get auto completion by @rhicu -* Fixed steps output for async/arrow functions in CLI by @LukoyanovE. See #1329 +- [Puppeteer] `dragSlider` action added by @PeterNgTr +- [Puppeteer] Fixed opening browser in shell mode by @allenhwkim +- [Puppeteer] Fixed making screenshot on additional sessions by @PeterNgTr. Fixes #1266 +- Added `--invert` option to `run-multiple` command by @LukoyanovE +- Fixed steps in Allure reports by @PeterNgTr +- Add option `output` to customize output directory in [stepByStepReport plugin](https://codecept.io/plugins/#stepbystepreport). By @fpsthirty +- Changed type definition of PageObjects to get auto completion by @rhicu +- Fixed steps output for async/arrow functions in CLI by @LukoyanovE. See #1329 ## 1.4.5 -* Add **require** param to main config. Allows to require Node modules before executing tests. By @LukoyanovE. For example: - * Use `ts-node/register` to register TypeScript parser - * Use `should` to register should-style assertions +- Add **require** param to main config. Allows to require Node modules before executing tests. By @LukoyanovE. For example: + - Use `ts-node/register` to register TypeScript parser + - Use `should` to register should-style assertions ```js "require": ["ts-node/register", "should"] ``` -* [WebDriverIO] Fix timeouts definition to be compatible with W3C drivers. By @LukoyanovE -* Fixed: exception in Before block w/ Mocha causes test not to report failure. See #1292 by @PeterNgTr -* Command `run-parallel` now accepts `--override` flag. Thanks to @ClemCB -* Fixed Allure report with Before/BeforeSuite/After/AfterSuite steps. By @PeterNgTr -* Added `RUN_MULTIPLE` env variable to [Docker config](https://codecept.io/docker/). Allows to run tests in parallel inside a container. Thanks to @PeterNgTr -* [Mochawesome] Fixed showing screenshot on failure. Fix by @PeterNgTr -* Fixed running tests filtering by tag names defined via `Scenario.tag()` +- [WebDriverIO] Fix timeouts definition to be compatible with W3C drivers. By @LukoyanovE +- Fixed: exception in Before block w/ Mocha causes test not to report failure. See #1292 by @PeterNgTr +- Command `run-parallel` now accepts `--override` flag. Thanks to @ClemCB +- Fixed Allure report with Before/BeforeSuite/After/AfterSuite steps. By @PeterNgTr +- Added `RUN_MULTIPLE` env variable to [Docker config](https://codecept.io/docker/). Allows to run tests in parallel inside a container. Thanks to @PeterNgTr +- [Mochawesome] Fixed showing screenshot on failure. Fix by @PeterNgTr +- Fixed running tests filtering by tag names defined via `Scenario.tag()` ## 1.4.4 -* [autoDelay plugin](https://codecept.io/plugins/#autoDelay) added. Adds tiny delay before and after an action so the page could react to actions performed. -* [Puppeteer] improvements by @luismanuel001 - * `click` no longer waits for navigation - * `clickLink` method added. Performs a click and waits for navigation. -* Bootstrap scripts to be started only for `run` command and ignored on `list`, `def`, etc. Fix by @LukoyanovE - +- [autoDelay plugin](https://codecept.io/plugins/#autoDelay) added. Adds tiny delay before and after an action so the page could react to actions performed. +- [Puppeteer] improvements by @luismanuel001 + - `click` no longer waits for navigation + - `clickLink` method added. Performs a click and waits for navigation. +- Bootstrap scripts to be started only for `run` command and ignored on `list`, `def`, etc. Fix by @LukoyanovE ## 1.4.3 -* Groups renamed to Tags for compatibility with BDD layer -* Test and suite objects to contain tags property which can be accessed from internal API -* Fixed adding tags for Scenario Outline in BDD -* Added `tag()` method to ScenarioConfig and FeatureConfig: +- Groups renamed to Tags for compatibility with BDD layer +- Test and suite objects to contain tags property which can be accessed from internal API +- Fixed adding tags for Scenario Outline in BDD +- Added `tag()` method to ScenarioConfig and FeatureConfig: ```js Scenario('update user profile', () => { // test goes here -}).tag('@slow'); +}).tag('@slow') ``` -* Fixed attaching Allure screenshot on exception. Fix by @DevinWatson -* Improved type definitions for custom steps. By @Akxe -* Fixed setting `multiple.parallel.chunks` as environment variable in config. See #1238 by @ngadiyak +- Fixed attaching Allure screenshot on exception. Fix by @DevinWatson +- Improved type definitions for custom steps. By @Akxe +- Fixed setting `multiple.parallel.chunks` as environment variable in config. See #1238 by @ngadiyak ## 1.4.2 -* Fixed setting config for plugins (inclunding setting `outputDir` for allure) by @jplegoff +- Fixed setting config for plugins (inclunding setting `outputDir` for allure) by @jplegoff ## 1.4.1 -* Added `plugins` option to `run-multiple` -* Minor output fixes -* Added Type Definition for Helper class by @Akxe -* Fixed extracing devault extension in generators by @Akxe +- Added `plugins` option to `run-multiple` +- Minor output fixes +- Added Type Definition for Helper class by @Akxe +- Fixed extracing devault extension in generators by @Akxe ## 1.4.0 -* [**Allure Reporter Integration**](https://codecept.io/reports/#allure). Full inegration with Allure Server. Get nicely looking UI for tests,including steps, nested steps, and screenshots. Thanks **Natarajan Krishnamurthy @krish** for sponsoring this feature. -* [Plugins API introduced](https://codecept.io/hooks/#plugins). Create custom plugins for CodeceptJS by hooking into event dispatcher, and using promise recorder. -* **Official [CodeceptJS plugins](https://codecept.io/plugins) added**: - * **`stepByStepReport` - creates nicely looking report to see test execution as a slideshow**. Use this plugin to debug tests in headless environment without recording a video. - * `allure` - Allure reporter added as plugin. - * `screenshotOnFail` - saves screenshot on fail. Replaces similar functionality from helpers. - * `retryFailedStep` - to rerun each failed step. -* [Puppeteer] Fix `executeAsyncScript` unexpected token by @jonathanz -* Added `override` option to `run-multiple` command by @svarlet +- [**Allure Reporter Integration**](https://codecept.io/reports/#allure). Full inegration with Allure Server. Get nicely looking UI for tests,including steps, nested steps, and screenshots. Thanks **Natarajan Krishnamurthy @krish** for sponsoring this feature. +- [Plugins API introduced](https://codecept.io/hooks/#plugins). Create custom plugins for CodeceptJS by hooking into event dispatcher, and using promise recorder. +- **Official [CodeceptJS plugins](https://codecept.io/plugins) added**: + - **`stepByStepReport` - creates nicely looking report to see test execution as a slideshow**. Use this plugin to debug tests in headless environment without recording a video. + - `allure` - Allure reporter added as plugin. + - `screenshotOnFail` - saves screenshot on fail. Replaces similar functionality from helpers. + - `retryFailedStep` - to rerun each failed step. +- [Puppeteer] Fix `executeAsyncScript` unexpected token by @jonathanz +- Added `override` option to `run-multiple` command by @svarlet ## 1.3.3 -* Added `initGlobals()` function to API of [custom runner](https://codecept.io/hooks/#custom-runner). +- Added `initGlobals()` function to API of [custom runner](https://codecept.io/hooks/#custom-runner). ## 1.3.2 -* Interactve Shell improvements for `pause()` - * Added `next` command for **step-by-step debug** when using `pause()`. - * Use `After(pause);` in a to start interactive console after last step. -* [Puppeteer] Updated to Puppeteer 1.6.0 - * Added `waitForRequest` to wait for network request. - * Added `waitForResponse` to wait for network response. -* Improved TypeScript definitions to support custom steps and page objects. By @xt1 -* Fixed XPath detection to accept XPath which starts with `./` by @BenoitZugmeyer +- Interactve Shell improvements for `pause()` + - Added `next` command for **step-by-step debug** when using `pause()`. + - Use `After(pause);` in a to start interactive console after last step. +- [Puppeteer] Updated to Puppeteer 1.6.0 + - Added `waitForRequest` to wait for network request. + - Added `waitForResponse` to wait for network response. +- Improved TypeScript definitions to support custom steps and page objects. By @xt1 +- Fixed XPath detection to accept XPath which starts with `./` by @BenoitZugmeyer ## 1.3.1 -* BDD-Gherkin: Fixed running async steps. -* [Puppeteer] Fixed process hanging for 30 seconds. Page loading timeout default via `getPageTimeout` set 0 seconds. -* [Puppeteer] Improved displaying client-side console messages in debug mode. -* [Puppeteer] Fixed closing sessions in `restart:false` mode for multi-session mode. -* [Protractor] Fixed `grabPopupText` to not throw error popup is not opened. -* [Protractor] Added info on using 'direct' Protractor driver to helper documentation by @xt1. -* [WebDriverIO] Added a list of all special keys to WebDriverIO helper by @davertmik and @xt1. -* Improved TypeScript definitions generator by @xt1 +- BDD-Gherkin: Fixed running async steps. +- [Puppeteer] Fixed process hanging for 30 seconds. Page loading timeout default via `getPageTimeout` set 0 seconds. +- [Puppeteer] Improved displaying client-side console messages in debug mode. +- [Puppeteer] Fixed closing sessions in `restart:false` mode for multi-session mode. +- [Protractor] Fixed `grabPopupText` to not throw error popup is not opened. +- [Protractor] Added info on using 'direct' Protractor driver to helper documentation by @xt1. +- [WebDriverIO] Added a list of all special keys to WebDriverIO helper by @davertmik and @xt1. +- Improved TypeScript definitions generator by @xt1 ## 1.3.0 -* **Cucumber-style BDD. Introduced [Gherkin support](https://codecept.io/bdd). Thanks to [David Vins](https://github.com/dvins) and [Omedym](https://www.omedym.com) for sponsoring this feature**. +- **Cucumber-style BDD. Introduced [Gherkin support](https://codecept.io/bdd). Thanks to [David Vins](https://github.com/dvins) and [Omedym](https://www.omedym.com) for sponsoring this feature**. Basic feature file: @@ -3182,11 +3301,11 @@ Feature: Business rules Step definition: ```js -const I = actor(); +const I = actor() Given('I need to open Google', () => { - I.amOnPage('https://google.com'); -}); + I.amOnPage('https://google.com') +}) ``` Run it with `--features --steps` flag: @@ -3197,66 +3316,68 @@ codeceptjs run --steps --features --- -* **Brekaing Chnage** `run` command now uses relative path + test name to run exactly one test file. +- **Brekaing Chnage** `run` command now uses relative path + test name to run exactly one test file. Previous behavior (removed): + ``` codeceptjs run basic_test.js ``` + Current behavior (relative path to config + a test name) ``` codeceptjs run tests/basic_test.js ``` + This change allows using auto-completion when running a specific test. --- -* Nested steps output enabled for page objects. - * to see high-level steps only run tests with `--steps` flag. - * to see PageObjects implementation run tests with `--debug`. -* PageObjects simplified to remove `_init()` extra method. Try updated generators and see [updated guide](https://codecept.io/pageobjects/#pageobject). -* [Puppeteer] [Multiple sessions](https://codecept.io/acceptance/#multiple-sessions) enabled. Requires Puppeteer >= 1.5 -* [Puppeteer] Stability improvement. Waits for for `load` event on page load. This strategy can be changed in config: - * `waitForNavigation` config option introduced. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions) - * `getPageTimeout` config option to set maximum navigation time in milliseconds. Default is 30 seconds. - * `waitForNavigation` method added. Explicitly waits for navigation to be finished. -* [WebDriverIO][Protractor][Puppeteer][Nightmare] **Possible BC** `grabTextFrom` unified. Return a text for single matched element and an array of texts for multiple elements. -* [Puppeteer]Fixed `resizeWindow` by @sergejkaravajnij -* [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForFunction` added. Waits for client-side JavaScript function to return true by @GREENpoint. -* [Puppeteer] `waitUntil` deprecated in favor of `waitForFunction`. -* Added `filter` function to DataTable. -* Send non-nested array of files to custom parallel execution chunking by @mikecbrant. -* Fixed invalid output directory path for run-multiple by @mikecbrant. -* [WebDriverIO] `waitUntil` timeout accepts time in seconds (as all other wait* functions). Fix by @truesrc. -* [Nightmare] Fixed `grabNumberOfVisibleElements` to work similarly to `seeElement`. Thx to @stefanschenk and Jinbo Jinboson. -* [Protractor] Fixed alert handling error with message 'no such alert' by @truesrc. - +- Nested steps output enabled for page objects. + - to see high-level steps only run tests with `--steps` flag. + - to see PageObjects implementation run tests with `--debug`. +- PageObjects simplified to remove `_init()` extra method. Try updated generators and see [updated guide](https://codecept.io/pageobjects/#pageobject). +- [Puppeteer] [Multiple sessions](https://codecept.io/acceptance/#multiple-sessions) enabled. Requires Puppeteer >= 1.5 +- [Puppeteer] Stability improvement. Waits for for `load` event on page load. This strategy can be changed in config: + - `waitForNavigation` config option introduced. Possible options: `load`, `domcontentloaded`, `networkidle0`, `networkidle2`. See [Puppeteer API](https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pagewaitfornavigationoptions) + - `getPageTimeout` config option to set maximum navigation time in milliseconds. Default is 30 seconds. + - `waitForNavigation` method added. Explicitly waits for navigation to be finished. +- [WebDriverIO][Protractor][Puppeteer][Nightmare] **Possible BC** `grabTextFrom` unified. Return a text for single matched element and an array of texts for multiple elements. +- [Puppeteer]Fixed `resizeWindow` by @sergejkaravajnij +- [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForFunction` added. Waits for client-side JavaScript function to return true by @GREENpoint. +- [Puppeteer] `waitUntil` deprecated in favor of `waitForFunction`. +- Added `filter` function to DataTable. +- Send non-nested array of files to custom parallel execution chunking by @mikecbrant. +- Fixed invalid output directory path for run-multiple by @mikecbrant. +- [WebDriverIO] `waitUntil` timeout accepts time in seconds (as all other wait\* functions). Fix by @truesrc. +- [Nightmare] Fixed `grabNumberOfVisibleElements` to work similarly to `seeElement`. Thx to @stefanschenk and Jinbo Jinboson. +- [Protractor] Fixed alert handling error with message 'no such alert' by @truesrc. ## 1.2.1 -* Fixed running `I.retry()` on multiple steps. -* Fixed parallel execution wih chunks. -* [Puppeteer] Fixed `grabNumberOfVisibleElements` to return `0` instead of throwing error if no elements are found. +- Fixed running `I.retry()` on multiple steps. +- Fixed parallel execution wih chunks. +- [Puppeteer] Fixed `grabNumberOfVisibleElements` to return `0` instead of throwing error if no elements are found. ## 1.2.0 -* [WebDriverIO][Protractor][Multiple Sessions](https://codecept.io/acceptance/#multiple-sessions). Run several browser sessions in one test. Introduced `session` command, which opens additional browser window and closes it after a test. +- [WebDriverIO][Protractor][Multiple Sessions](https://codecept.io/acceptance/#multiple-sessions). Run several browser sessions in one test. Introduced `session` command, which opens additional browser window and closes it after a test. ```js Scenario('run in different browsers', (I) => { - I.amOnPage('/hello'); - I.see('Hello!'); + I.amOnPage('/hello') + I.see('Hello!') session('john', () => { - I.amOnPage('/bye'); - I.dontSee('Hello'); - I.see('Bye'); - }); - I.see('Hello'); -}); + I.amOnPage('/bye') + I.dontSee('Hello') + I.see('Bye') + }) + I.see('Hello') +}) ``` -* [Parallel Execution](https://codecept.io/advanced/#parallel-execution) by @sveneisenschmidt. Run tests in parallel specifying number of chunks: +- [Parallel Execution](https://codecept.io/advanced/#parallel-execution) by @sveneisenschmidt. Run tests in parallel specifying number of chunks: ```js "multiple": { @@ -3269,244 +3390,239 @@ Scenario('run in different browsers', (I) => { } ``` -* [Locator Builder](https://codecept.io/locators). Write complex locators with simplest API combining CSS and XPath: +- [Locator Builder](https://codecept.io/locators). Write complex locators with simplest API combining CSS and XPath: ```js // select 'Edit' link inside 2nd row of a table -locate('//table') - .find('tr') - .at(2) - .find('a') - .withText('Edit'); +locate('//table').find('tr').at(2).find('a').withText('Edit') ``` -* [Dynamic configuration](https://codecept.io/advanced/#dynamic-configuration) to update helpers config per test or per suite. -* Added `event.test.finished` which fires synchronously for both failed and passed tests. -* [WebDriverIO][Protractor][Nightmare][Puppeteer] Full page screenshots on failure disabled by default. See [issue#1600. You can enabled them with `fullPageScreenshots: true`, however they may work unstable in Selenium. -* `within` blocks can return values. See [updated documentation](https://codecept.io/basics/#within). -* Removed doublt call to `_init` in helpers. Fixes issue #1036 -* Added scenario and feature configuration via fluent API: +- [Dynamic configuration](https://codecept.io/advanced/#dynamic-configuration) to update helpers config per test or per suite. +- Added `event.test.finished` which fires synchronously for both failed and passed tests. +- [WebDriverIO][Protractor][Nightmare][Puppeteer] Full page screenshots on failure disabled by default. See [issue#1600. You can enabled them with `fullPageScreenshots: true`, however they may work unstable in Selenium. +- `within` blocks can return values. See [updated documentation](https://codecept.io/basics/#within). +- Removed doublt call to `_init` in helpers. Fixes issue #1036 +- Added scenario and feature configuration via fluent API: ```js -Feature('checkout') - .timeout(3000) - .retry(2); +Feature('checkout').timeout(3000).retry(2) Scenario('user can order in firefox', (I) => { // see dynamic configuration -}).config({ browser: 'firefox' }) - .timeout(20000); +}) + .config({ browser: 'firefox' }) + .timeout(20000) Scenario('this test should throw error', (I) => { // I.amOnPage -}).throws(new Error); +}).throws(new Error()) ``` ## 1.1.8 -* Fixed generating TypeScript definitions with `codeceptjs def`. -* Added Chinese translation ("zh-CN" and "zh-TW") by @TechQuery. -* Fixed running tests from a different folder specified by `-c` option. -* [Puppeteer] Added support for hash handling in URL by @gavoja. -* [Puppeteer] Fixed setting viewport size by @gavoja. See [Puppeteer issue](https://github.com/GoogleChrome/puppeteer/issues/1183) - +- Fixed generating TypeScript definitions with `codeceptjs def`. +- Added Chinese translation ("zh-CN" and "zh-TW") by @TechQuery. +- Fixed running tests from a different folder specified by `-c` option. +- [Puppeteer] Added support for hash handling in URL by @gavoja. +- [Puppeteer] Fixed setting viewport size by @gavoja. See [Puppeteer issue](https://github.com/GoogleChrome/puppeteer/issues/1183) ## 1.1.7 -* Docker Image updateed. [See updated reference](https://codecept.io/docker/): - * codeceptjs package is mounted as `/codecept` insde container - * tests directory is expected to be mounted as `/tests` - * `codeceptjs` global runner added (symlink to `/codecept/bin/codecept.js`) -* [Protractor] Functions added by @reubenmiller: - * `_locateCheckable (only available from other helpers)` - * `_locateClickable (only available from other helpers)` - * `_locateFields (only available from other helpers)` - * `acceptPopup` - * `cancelPopup` - * `dragAndDrop` - * `grabBrowserLogs` - * `grabCssPropertyFrom` - * `grabHTMLFrom` - * `grabNumberOfVisibleElements` - * `grabPageScrollPosition (new)` - * `rightClick` - * `scrollPageToBottom` - * `scrollPageToTop` - * `scrollTo` - * `seeAttributesOnElements` - * `seeCssPropertiesOnElements` - * `seeInPopup` - * `seeNumberOfVisibleElements` - * `switchTo` - * `waitForEnabled` - * `waitForValue` - * `waitInUrl` - * `waitNumberOfVisibleElements` - * `waitToHide` - * `waitUntil` - * `waitUrlEquals` -* [Nightmare] added: - * `grabPageScrollPosition` (new) - * `seeNumberOfVisibleElements` - * `waitToHide` -* [Puppeteer] added: - * `grabPageScrollPosition` (new) -* [WebDriverIO] added" - * `grabPageScrollPosition` (new) -* [Puppeteer] Fixed running wait* functions without setting `sec` parameter. -* [Puppeteer][Protractor] Fixed bug with I.click when using an object selector with the xpath property. By @reubenmiller -* [WebDriverIO][Protractor][Nightmare][Puppeteer] Fixed I.switchTo(0) and I.scrollTo(100, 100) api inconsistencies between helpers. -* [Protractor] Fixing bug when `seeAttributesOnElements` and `seeCssPropertiesOnElement` were incorrectly passing when the attributes/properties did not match by @reubenmiller -* [WebDriverIO] Use inbuilt dragAndDrop function (still doesn't work in Firefox). By @reubenmiller -* Support for Nightmare 3.0 -* Enable glob patterns in `config.test` / `Codecept.loadTests` by @sveneisenschmidt -* Enable overriding of `config.tests` for `run-multiple` by @sveneisenschmidt - +- Docker Image updateed. [See updated reference](https://codecept.io/docker/): + - codeceptjs package is mounted as `/codecept` insde container + - tests directory is expected to be mounted as `/tests` + - `codeceptjs` global runner added (symlink to `/codecept/bin/codecept.js`) +- [Protractor] Functions added by @reubenmiller: + - `_locateCheckable (only available from other helpers)` + - `_locateClickable (only available from other helpers)` + - `_locateFields (only available from other helpers)` + - `acceptPopup` + - `cancelPopup` + - `dragAndDrop` + - `grabBrowserLogs` + - `grabCssPropertyFrom` + - `grabHTMLFrom` + - `grabNumberOfVisibleElements` + - `grabPageScrollPosition (new)` + - `rightClick` + - `scrollPageToBottom` + - `scrollPageToTop` + - `scrollTo` + - `seeAttributesOnElements` + - `seeCssPropertiesOnElements` + - `seeInPopup` + - `seeNumberOfVisibleElements` + - `switchTo` + - `waitForEnabled` + - `waitForValue` + - `waitInUrl` + - `waitNumberOfVisibleElements` + - `waitToHide` + - `waitUntil` + - `waitUrlEquals` +- [Nightmare] added: + - `grabPageScrollPosition` (new) + - `seeNumberOfVisibleElements` + - `waitToHide` +- [Puppeteer] added: + - `grabPageScrollPosition` (new) +- [WebDriverIO] added" + - `grabPageScrollPosition` (new) +- [Puppeteer] Fixed running wait\* functions without setting `sec` parameter. +- [Puppeteer][Protractor] Fixed bug with I.click when using an object selector with the xpath property. By @reubenmiller +- [WebDriverIO][Protractor][Nightmare][Puppeteer] Fixed I.switchTo(0) and I.scrollTo(100, 100) api inconsistencies between helpers. +- [Protractor] Fixing bug when `seeAttributesOnElements` and `seeCssPropertiesOnElement` were incorrectly passing when the attributes/properties did not match by @reubenmiller +- [WebDriverIO] Use inbuilt dragAndDrop function (still doesn't work in Firefox). By @reubenmiller +- Support for Nightmare 3.0 +- Enable glob patterns in `config.test` / `Codecept.loadTests` by @sveneisenschmidt +- Enable overriding of `config.tests` for `run-multiple` by @sveneisenschmidt ## 1.1.6 -* Added support for `async I =>` functions syntax in Scenario by @APshenkin -* [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForInvisible` waits for element to hide or to be removed from page. By @reubenmiller -* [Protractor][Puppeteer][Nightmare] Added `grabCurrentUrl` function. By @reubenmiller -* [WebDriverIO] `grabBrowserUrl` deprecated in favor of `grabCurrentUrl` to unify the API. -* [Nightmare] Improved element visibility detection by @reubenmiller -* [Puppeteer] Fixing function calls when clearing the cookies and localstorage. By @reubenmiller -* [Puppeteer] Added `waitForEnabled`, `waitForValue` and `waitNumberOfVisibleElements` methods by @reubenmiller -* [WebDriverIO] Fixed `grabNumberOfVisibleElements` to return 0 when no visible elements are on page. By @michaltrunek -* Helpers API improvements (by @reubenmiller) - * `_passed` hook runs after a test passed successfully - * `_failed` hook runs on a failed test -* Hooks API. New events added by @reubenmiller: - * `event.all.before` - executed before all tests - * `event.all.after` - executed after all tests - * `event.multiple.before` - executed before all processes in run-multiple - * `event.multiple.after` - executed after all processes in run-multiple -* Multiple execution -* Allow `AfterSuite` and `After` test hooks to be defined after the first Scenario. By @reubenmiller -* [Nightmare] Prevent `I.amOnpage` navigation if the browser is already at the given url -* Multiple-Run: Added new `bootstrapAll` and `teardownAll` hooks to be executed before and after all processes -* `codeceptjs def` command accepts `--config` option. By @reubenmiller +- Added support for `async I =>` functions syntax in Scenario by @APshenkin +- [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForInvisible` waits for element to hide or to be removed from page. By @reubenmiller +- [Protractor][Puppeteer][Nightmare] Added `grabCurrentUrl` function. By @reubenmiller +- [WebDriverIO] `grabBrowserUrl` deprecated in favor of `grabCurrentUrl` to unify the API. +- [Nightmare] Improved element visibility detection by @reubenmiller +- [Puppeteer] Fixing function calls when clearing the cookies and localstorage. By @reubenmiller +- [Puppeteer] Added `waitForEnabled`, `waitForValue` and `waitNumberOfVisibleElements` methods by @reubenmiller +- [WebDriverIO] Fixed `grabNumberOfVisibleElements` to return 0 when no visible elements are on page. By @michaltrunek +- Helpers API improvements (by @reubenmiller) + - `_passed` hook runs after a test passed successfully + - `_failed` hook runs on a failed test +- Hooks API. New events added by @reubenmiller: + - `event.all.before` - executed before all tests + - `event.all.after` - executed after all tests + - `event.multiple.before` - executed before all processes in run-multiple + - `event.multiple.after` - executed after all processes in run-multiple +- Multiple execution +- Allow `AfterSuite` and `After` test hooks to be defined after the first Scenario. By @reubenmiller +- [Nightmare] Prevent `I.amOnpage` navigation if the browser is already at the given url +- Multiple-Run: Added new `bootstrapAll` and `teardownAll` hooks to be executed before and after all processes +- `codeceptjs def` command accepts `--config` option. By @reubenmiller ## 1.1.5 -* [Puppeteer] Rerun steps failed due to "Cannot find context with specified id" Error. -* Added syntax to retry a single step: +- [Puppeteer] Rerun steps failed due to "Cannot find context with specified id" Error. +- Added syntax to retry a single step: ```js // retry action once on failure -I.retry().see('Hello'); +I.retry().see('Hello') // retry action 3 times on failure -I.retry(3).see('Hello'); +I.retry(3).see('Hello') // retry action 3 times waiting for 0.1 second before next try -I.retry({ retries: 3, minTimeout: 100 }).see('Hello'); +I.retry({ retries: 3, minTimeout: 100 }).see('Hello') // retry action 3 times waiting no more than 3 seconds for last retry -I.retry({ retries: 3, maxTimeout: 3000 }).see('Hello'); +I.retry({ retries: 3, maxTimeout: 3000 }).see('Hello') // retry 2 times if error with message 'Node not visible' happens I.retry({ retries: 2, - when: err => err.message === 'Node not visible' -}).seeElement('#user'); -``` - -* `Scenario().injectDependencies` added to dynamically add objects into DI container by @Apshenkin. See [Dependency Injection section in PageObjects](https://codecept.io/pageobjects/#dependency-injection). -* Fixed using async/await functions inside `within` -* [WebDriverIO][Protractor][Puppeteer][Nightmare] **`waitUntilExists` deprecated** in favor of `waitForElement` -* [WebDriverIO][Protractor] **`waitForStalenessOf` deprecated** in favor of `waitForDetached` -* [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForDetached` added -* [Nightmare] Added `I.seeNumberOfElements()` by @pmoncadaisla -* [Nightmare] Load blank page when starting nightmare so that the .evaluate function will work if _failed/saveScreenshot is triggered by @reubenmiller -* Fixed using plain arrays for data driven tests by @reubenmiller -* [Puppeteer] Use default tab instead of opening a new tab when starting the browser by @reubenmiller -* [Puppeteer] Added `grabNumberOfTabs` function by @reubenmiller -* [Puppeteer] Add ability to set user-agent by @abidhahmed -* [Puppeteer] Add keepCookies and keepBrowserState @abidhahmed -* [Puppeteer] Clear value attribute instead of innerhtml for TEXTAREA by @reubenmiller -* [REST] fixed sending string payload by @michaltrunek -* Fixed unhandled rejection in async/await tests by @APshenkin - + when: (err) => err.message === 'Node not visible', +}).seeElement('#user') +``` + +- `Scenario().injectDependencies` added to dynamically add objects into DI container by @Apshenkin. See [Dependency Injection section in PageObjects](https://codecept.io/pageobjects/#dependency-injection). +- Fixed using async/await functions inside `within` +- [WebDriverIO][Protractor][Puppeteer][Nightmare] **`waitUntilExists` deprecated** in favor of `waitForElement` +- [WebDriverIO][Protractor] **`waitForStalenessOf` deprecated** in favor of `waitForDetached` +- [WebDriverIO][Protractor][Puppeteer][Nightmare] `waitForDetached` added +- [Nightmare] Added `I.seeNumberOfElements()` by @pmoncadaisla +- [Nightmare] Load blank page when starting nightmare so that the .evaluate function will work if \_failed/saveScreenshot is triggered by @reubenmiller +- Fixed using plain arrays for data driven tests by @reubenmiller +- [Puppeteer] Use default tab instead of opening a new tab when starting the browser by @reubenmiller +- [Puppeteer] Added `grabNumberOfTabs` function by @reubenmiller +- [Puppeteer] Add ability to set user-agent by @abidhahmed +- [Puppeteer] Add keepCookies and keepBrowserState @abidhahmed +- [Puppeteer] Clear value attribute instead of innerhtml for TEXTAREA by @reubenmiller +- [REST] fixed sending string payload by @michaltrunek +- Fixed unhandled rejection in async/await tests by @APshenkin ## 1.1.4 -* Removed `yarn` call in package.json -* Fixed `console.log` in Puppeteer by @othree -* [Appium] `runOnAndroid` and `runOnIOS` can receive a function to check capabilities dynamically: +- Removed `yarn` call in package.json +- Fixed `console.log` in Puppeteer by @othree +- [Appium] `runOnAndroid` and `runOnIOS` can receive a function to check capabilities dynamically: ```js -I.runOnAndroid(caps => caps.platformVersion >= 7, () => { - // run code only on Android 7+ -}); +I.runOnAndroid( + (caps) => caps.platformVersion >= 7, + () => { + // run code only on Android 7+ + }, +) ``` ## 1.1.3 -* [Puppeteer] +25 Functions added by @reubenmiller - * `_locateCheckable` - * `_locateClickable` - * `_locateFields` - * `closeOtherTabs` - * `dragAndDrop` - * `grabBrowserLogs` - * `grabCssPropertyFrom` - * `grabHTMLFrom` - * `grabNumberOfVisibleElements` - * `grabSource` - * `rightClick` - * `scrollPageToBottom` - * `scrollPageToTop` - * `scrollTo` - * `seeAttributesOnElements` - * `seeCssPropertiesOnElements` - * `seeInField` - * `seeNumberOfElements` - * `seeNumberOfVisibleElements` - * `seeTextEquals` - * `seeTitleEquals` - * `switchTo` - * `waitForInvisible` - * `waitInUrl` - * `waitUrlEquals` -* [Protractor] +8 functions added by @reubenmiller - * `closeCurrentTab` - * `grabSource` - * `openNewTab` - * `seeNumberOfElements` - * `seeTextEquals` - * `seeTitleEquals` - * `switchToNextTab` - * `switchToPreviousTab` -* [Nightmare] `waitForInvisible` added by @reubenmiller -* [Puppeteer] Printing console.log information in debug mode. -* [Nightmare] Integrated with `nightmare-har-plugin` by mingfang. Added `enableHAR` option. Added HAR functions: - * `grabHAR` - * `saveHAR` - * `resetHAR` -* [WebDriverIO] Fixed execution stability for parallel requests with Chromedriver -* [WebDriverIO] Fixed resizeWindow when resizing to 'maximize' by @reubenmiller -* [WebDriverIO] Fixing resizing window to full screen when taking a screenshot by @reubenmiller +- [Puppeteer] +25 Functions added by @reubenmiller + - `_locateCheckable` + - `_locateClickable` + - `_locateFields` + - `closeOtherTabs` + - `dragAndDrop` + - `grabBrowserLogs` + - `grabCssPropertyFrom` + - `grabHTMLFrom` + - `grabNumberOfVisibleElements` + - `grabSource` + - `rightClick` + - `scrollPageToBottom` + - `scrollPageToTop` + - `scrollTo` + - `seeAttributesOnElements` + - `seeCssPropertiesOnElements` + - `seeInField` + - `seeNumberOfElements` + - `seeNumberOfVisibleElements` + - `seeTextEquals` + - `seeTitleEquals` + - `switchTo` + - `waitForInvisible` + - `waitInUrl` + - `waitUrlEquals` +- [Protractor] +8 functions added by @reubenmiller + - `closeCurrentTab` + - `grabSource` + - `openNewTab` + - `seeNumberOfElements` + - `seeTextEquals` + - `seeTitleEquals` + - `switchToNextTab` + - `switchToPreviousTab` +- [Nightmare] `waitForInvisible` added by @reubenmiller +- [Puppeteer] Printing console.log information in debug mode. +- [Nightmare] Integrated with `nightmare-har-plugin` by mingfang. Added `enableHAR` option. Added HAR functions: + - `grabHAR` + - `saveHAR` + - `resetHAR` +- [WebDriverIO] Fixed execution stability for parallel requests with Chromedriver +- [WebDriverIO] Fixed resizeWindow when resizing to 'maximize' by @reubenmiller +- [WebDriverIO] Fixing resizing window to full screen when taking a screenshot by @reubenmiller ## 1.1.2 -* [Puppeteer] Upgraded to Puppeteer 1.0 -* Added `grep` option to config to set default matching pattern for tests. -* [Puppeteer] Added `acceptPopup`, `cancelPopup`, `seeInPopup` and `grabPopupText` functions by @reubenmiller -* [Puppeteer] `within` iframe and nested iframe support added by @reubenmiller -* [REST] Added support for JSON objects since payload (as a JSON) was automatically converted into "URL query" type of parameter by @Kalostrinho -* [REST] Added `resetRequestHeaders` method by @Kalostrinho -* [REST] Added `followRedirect` option and `amFollowingRequestRedirects`/`amNotFollowingRequestRedirects` methods by @Kalostrinho -* [WebDriverIO] `uncheckOption` implemented by @brunobg -* [WebDriverIO] Added `grabBrowserUrl` by @Kalostrinho -* Add ability to require helpers from node_modules by @APshenkin -* Added `--profile` option to `run-multiple` command by @jamie-beck -* Custom output name for multiple browser run by @tfiwm -* Fixed passing data to scenarios by @KennyRules +- [Puppeteer] Upgraded to Puppeteer 1.0 +- Added `grep` option to config to set default matching pattern for tests. +- [Puppeteer] Added `acceptPopup`, `cancelPopup`, `seeInPopup` and `grabPopupText` functions by @reubenmiller +- [Puppeteer] `within` iframe and nested iframe support added by @reubenmiller +- [REST] Added support for JSON objects since payload (as a JSON) was automatically converted into "URL query" type of parameter by @Kalostrinho +- [REST] Added `resetRequestHeaders` method by @Kalostrinho +- [REST] Added `followRedirect` option and `amFollowingRequestRedirects`/`amNotFollowingRequestRedirects` methods by @Kalostrinho +- [WebDriverIO] `uncheckOption` implemented by @brunobg +- [WebDriverIO] Added `grabBrowserUrl` by @Kalostrinho +- Add ability to require helpers from node_modules by @APshenkin +- Added `--profile` option to `run-multiple` command by @jamie-beck +- Custom output name for multiple browser run by @tfiwm +- Fixed passing data to scenarios by @KennyRules ## 1.1.1 -* [WebDriverIO] fixed `waitForInvisible` by @Kporal +- [WebDriverIO] fixed `waitForInvisible` by @Kporal ## 1.1.0 @@ -3514,10 +3630,10 @@ Major update to CodeceptJS. **NodeJS v 8.9.1** is now minimal Node version requi This brings native async-await support to CodeceptJS. It is recommended to start using await for tests instead of generators: ```js -async () => { - I.amOnPage('/page'); - const url = await I.grabTextFrom('.nextPage'); - I.amOnPage(url); +;async () => { + I.amOnPage('/page') + const url = await I.grabTextFrom('.nextPage') + I.amOnPage(url) } ``` @@ -3525,9 +3641,9 @@ Thanks to [@Apshenkin](https://github.com/apshenkin) for implementation. Also, m We also introduced strict ESLint policies for our codebase. Thanks to [@Galkin](https://github.com/galkin) for that. -* **[Puppeteer] Helper introduced**. [Learn how to run tests headlessly with Google Chrome's Puppeteer](http://codecept.io/puppeteer/). -* [SeleniumWebdriver] Helper is deprecated, it is recommended to use Protractor with config option `angular: false` instead. -* [WebDriverIO] nested iframe support in the within block by @reubenmiller. Example: +- **[Puppeteer] Helper introduced**. [Learn how to run tests headlessly with Google Chrome's Puppeteer](http://codecept.io/puppeteer/). +- [SeleniumWebdriver] Helper is deprecated, it is recommended to use Protractor with config option `angular: false` instead. +- [WebDriverIO] nested iframe support in the within block by @reubenmiller. Example: ```js within({frame: ['#wrapperId', '[name=content]']}, () => { @@ -3538,66 +3654,63 @@ I.see('Nested Iframe test'); I.dontSee('Email Address'); }); ``` -* [WebDriverIO] Support for `~` locator to find elements by `aria-label`. This behavior is similar as it is in Appium and helps testing cross-platform React apps. Example: + +- [WebDriverIO] Support for `~` locator to find elements by `aria-label`. This behavior is similar as it is in Appium and helps testing cross-platform React apps. Example: ```html - - CodeceptJS is awesome - + CodeceptJS is awesome ``` -↑ This element can be located with `~foobar` in WebDriverIO and Appium helpers. Thanks to @flyskywhy - -* Allow providing arbitrary objects in config includes by @rlewan -* [REST] Prevent from mutating default headers by @alexashley. See #789 -* [REST] Fixed sending empty helpers with `haveRequestHeaders` in `sendPostRequest`. By @petrisorionel -* Fixed displaying undefined args in output by @APshenkin -* Fixed NaN instead of seconds in output by @APshenkin -* Add browser name to report file for `multiple-run` by @trollr -* Mocha updated to 4.x +↑ This element can be located with `~foobar` in WebDriverIO and Appium helpers. Thanks to @flyskywhy +- Allow providing arbitrary objects in config includes by @rlewan +- [REST] Prevent from mutating default headers by @alexashley. See #789 +- [REST] Fixed sending empty helpers with `haveRequestHeaders` in `sendPostRequest`. By @petrisorionel +- Fixed displaying undefined args in output by @APshenkin +- Fixed NaN instead of seconds in output by @APshenkin +- Add browser name to report file for `multiple-run` by @trollr +- Mocha updated to 4.x ## 1.0.3 -* [WebDriverIO][Protractor][Nightmare] method `waitUntilExists` implemented by @sabau -* Absolute path can be set for `output` dir by @APshenkin. Fix #571* Data table rows can be ignored by using `xadd`. By @APhenkin -* Added `Data(table).only.Scenario` to give ability to launch only Data tests. By @APhenkin -* Implemented `ElementNotFound` error by @BorisOsipov. -* Added TypeScript compiler / configs to check the JavaScript by @KennyRules -* [Nightmare] fix executeScript return value by @jploskonka -* [Nightmare] fixed: err.indexOf not a function when waitForText times out in nightmare by @joeypedicini92 -* Fixed: Retries not working when using .only. By @APhenkin - +- [WebDriverIO][Protractor][Nightmare] method `waitUntilExists` implemented by @sabau +- Absolute path can be set for `output` dir by @APshenkin. Fix #571\* Data table rows can be ignored by using `xadd`. By @APhenkin +- Added `Data(table).only.Scenario` to give ability to launch only Data tests. By @APhenkin +- Implemented `ElementNotFound` error by @BorisOsipov. +- Added TypeScript compiler / configs to check the JavaScript by @KennyRules +- [Nightmare] fix executeScript return value by @jploskonka +- [Nightmare] fixed: err.indexOf not a function when waitForText times out in nightmare by @joeypedicini92 +- Fixed: Retries not working when using .only. By @APhenkin ## 1.0.2 -* Introduced generators support in scenario hooks for `BeforeSuite`/`Before`/`AfterSuite`/`After` -* [ApiDataFactory] Fixed loading helper; `requireg` package included. -* Fix #485`run-multiple`: the first browser-resolution combination was be used in all configurations -* Fixed unique test names: - * Fixed #447 tests failed silently if they have the same name as other tests. - * Use uuid in screenshot names when `uniqueScreenshotNames: true` -* [Protractor] Fixed testing non-angular application. `amOutsideAngularApp` is executed before each step. Fixes #458* Added output for steps in hooks when they fail +- Introduced generators support in scenario hooks for `BeforeSuite`/`Before`/`AfterSuite`/`After` +- [ApiDataFactory] Fixed loading helper; `requireg` package included. +- Fix #485`run-multiple`: the first browser-resolution combination was be used in all configurations +- Fixed unique test names: + - Fixed #447 tests failed silently if they have the same name as other tests. + - Use uuid in screenshot names when `uniqueScreenshotNames: true` +- [Protractor] Fixed testing non-angular application. `amOutsideAngularApp` is executed before each step. Fixes #458\* Added output for steps in hooks when they fail ## 1.0.1 -* Reporters improvements: - * Allows to execute [multiple reporters](http://codecept.io/advanced/#Multi-Reports) - * Added [Mochawesome](http://codecept.io/helpers/Mochawesome/) helper - * `addMochawesomeContext` method to add custom data to mochawesome reports - * Fixed Mochawesome context for failed screenshots. -* [WebDriverIO] improved click on context to match clickable element with a text inside. Fixes #647* [Nightmare] Added `refresh` function by @awhanks -* fixed `Unhandled promise rejection (rejection id: 1): Error: Unknown wait type: pageLoad` -* support for tests with retries in html report -* be sure that change window size and timeouts completes before test -* [Nightmare] Fixed `[Wrapped Error] "codeceptjs is not defined"`; Reinjectiing client scripts to a webpage on changes. -* [Nightmare] Added more detailed error messages for `Wait*` methods -* [Nightmare] Fixed adding screenshots to Mochawesome -* [Nightmare] Fix unique screenshots names in Nightmare -* Fixed CodeceptJS work with hooks in helpers to finish codeceptJS correctly if errors appears in helpers hooks -* Create a new session for next test If selenium grid error received -* Create screenshots for failed hooks from a Feature file -* Fixed `retries` option +- Reporters improvements: + - Allows to execute [multiple reporters](http://codecept.io/advanced/#Multi-Reports) + - Added [Mochawesome](http://codecept.io/helpers/Mochawesome/) helper + - `addMochawesomeContext` method to add custom data to mochawesome reports + - Fixed Mochawesome context for failed screenshots. +- [WebDriverIO] improved click on context to match clickable element with a text inside. Fixes #647\* [Nightmare] Added `refresh` function by @awhanks +- fixed `Unhandled promise rejection (rejection id: 1): Error: Unknown wait type: pageLoad` +- support for tests with retries in html report +- be sure that change window size and timeouts completes before test +- [Nightmare] Fixed `[Wrapped Error] "codeceptjs is not defined"`; Reinjectiing client scripts to a webpage on changes. +- [Nightmare] Added more detailed error messages for `Wait*` methods +- [Nightmare] Fixed adding screenshots to Mochawesome +- [Nightmare] Fix unique screenshots names in Nightmare +- Fixed CodeceptJS work with hooks in helpers to finish codeceptJS correctly if errors appears in helpers hooks +- Create a new session for next test If selenium grid error received +- Create screenshots for failed hooks from a Feature file +- Fixed `retries` option ## 1.0 @@ -3614,8 +3727,8 @@ I.clearField('~email of the customer')); I.dontSee('Nothing special', '~email of the customer')); ``` -* Read [the Mobile Testing guide](http://codecept.io/mobile). -* Discover [Appium Helper](http://codecept.io/helpers/Appium/) +- Read [the Mobile Testing guide](http://codecept.io/mobile). +- Discover [Appium Helper](http://codecept.io/helpers/Appium/) --- @@ -3626,116 +3739,117 @@ Sample test ```js // create a user using data factories and REST API -I.have('user', { name: 'davert', password: '123456' }); +I.have('user', { name: 'davert', password: '123456' }) // use it to login -I.amOnPage('/login'); -I.fillField('login', 'davert'); -I.fillField('password', '123456'); -I.click('Login'); -I.see('Hello, davert'); +I.amOnPage('/login') +I.fillField('login', 'davert') +I.fillField('password', '123456') +I.click('Login') +I.see('Hello, davert') // user will be removed after the test ``` -* Read [Data Management guide](http://codecept.io/data) -* [REST Helper](http://codecept.io/helpers/REST) -* [ApiDataFactory](http://codecept.io/helpers/ApiDataFactory/) +- Read [Data Management guide](http://codecept.io/data) +- [REST Helper](http://codecept.io/helpers/REST) +- [ApiDataFactory](http://codecept.io/helpers/ApiDataFactory/) --- Next notable feature is **[SmartWait](http://codecept.io/acceptance/#smartwait)** for WebDriverIO, Protractor, SeleniumWebdriver. When `smartwait` option is set, script will wait for extra milliseconds to locate an element before failing. This feature uses implicit waits of Selenium but turns them on only in applicable pieces. For instance, implicit waits are enabled for `seeElement` but disabled for `dontSeeElement` -* Read more about [SmartWait](http://codecept.io/acceptance/#smartwait) +- Read more about [SmartWait](http://codecept.io/acceptance/#smartwait) ##### Changelog -* Minimal NodeJS version is 6.11.1 LTS -* Use `within` command with generators. -* [Data Driven Tests](http://codecept.io/advanced/#data-driven-tests) introduced. -* Print execution time per step in `--debug` mode. #591 by @APshenkin -* [WebDriverIO][Protractor][Nightmare] Added `disableScreenshots` option to disable screenshots on fail by @Apshenkin -* [WebDriverIO][Protractor][Nightmare] Added `uniqueScreenshotNames` option to generate unique names for screenshots on failure by @Apshenkin -* [WebDriverIO][Nightmare] Fixed click on context; `click('text', '#el')` will throw exception if text is not found inside `#el`. -* [WebDriverIO][Protractor][SeleniumWebdriver] [SmartWait introduced](http://codecept.io/acceptance/#smartwait). -* [WebDriverIO][Protractor][Nightmare]Fixed `saveScreenshot` for PhantomJS, `fullPageScreenshots` option introduced by @HughZurname #549 -* [Appium] helper introduced by @APshenkin -* [REST] helper introduced by @atrevino in #504 -* [WebDriverIO][SeleniumWebdriver] Fixed "windowSize": "maximize" for Chrome 59+ version #560 by @APshenkin -* [Nightmare] Fixed restarting by @APshenkin #581 -* [WebDriverIO] Methods added by @APshenkin: - * [grabCssPropertyFrom](http://codecept.io/helpers/WebDriverIO/#grabcsspropertyfrom) - * [seeTitleEquals](http://codecept.io/helpers/WebDriverIO/#seetitleequals) - * [seeTextEquals](http://codecept.io/helpers/WebDriverIO/#seetextequals) - * [seeCssPropertiesOnElements](http://codecept.io/helpers/WebDriverIO/#seecsspropertiesonelements) - * [seeAttributesOnElements](http://codecept.io/helpers/WebDriverIO/#seeattributesonelements) - * [grabNumberOfVisibleElements](http://codecept.io/helpers/WebDriverIO/#grabnumberofvisibleelements) - * [waitInUrl](http://codecept.io/helpers/WebDriverIO/#waitinurl) - * [waitUrlEquals](http://codecept.io/helpers/WebDriverIO/#waiturlequals) - * [waitForValue](http://codecept.io/helpers/WebDriverIO/#waitforvalue) - * [waitNumberOfVisibleElements](http://codecept.io/helpers/WebDriverIO/#waitnumberofvisibleelements) - * [switchToNextTab](http://codecept.io/helpers/WebDriverIO/#switchtonexttab) - * [switchToPreviousTab](http://codecept.io/helpers/WebDriverIO/#switchtoprevioustab) - * [closeCurrentTab](http://codecept.io/helpers/WebDriverIO/#closecurrenttab) - * [openNewTab](http://codecept.io/helpers/WebDriverIO/#opennewtab) - * [refreshPage](http://codecept.io/helpers/WebDriverIO/#refreshpage) - * [scrollPageToBottom](http://codecept.io/helpers/WebDriverIO/#scrollpagetobottom) - * [scrollPageToTop](http://codecept.io/helpers/WebDriverIO/#scrollpagetotop) - * [grabBrowserLogs](http://codecept.io/helpers/WebDriverIO/#grabbrowserlogs) -* Use mkdirp to create output directory. #592 by @vkramskikh -* [WebDriverIO] Fixed `seeNumberOfVisibleElements` by @BorisOsipov #574 -* Lots of fixes for promise chain by @APshenkin #568 - * Fix #543- After block not properly executed if Scenario fails - * Expected behavior in promise chains: `_beforeSuite` hooks from helpers -> `BeforeSuite` from test -> `_before` hooks from helpers -> `Before` from test - > Test steps -> `_failed` hooks from helpers (if test failed) -> `After` from test -> `_after` hooks from helpers -> `AfterSuite` from test -> `_afterSuite` hook from helpers. - * if during test we got errors from any hook (in test or in helper) - stop complete this suite and go to another - * if during test we got error from Selenium server - stop complete this suite and go to another - * [WebDriverIO][Protractor] if `restart` option is false - close all tabs expect one in `_after`. - * Complete `_after`, `_afterSuite` hooks even After/AfterSuite from test was failed - * Don't close browser between suites, when `restart` option is false. We should start browser only one time and close it only after all tests. - * Close tabs and clear local storage, if `keepCookies` flag is enabled -* Fix TypeError when using babel-node or ts-node on node.js 7+ #586 by @vkramskikh -* [Nightmare] fixed usage of `_locate` +- Minimal NodeJS version is 6.11.1 LTS +- Use `within` command with generators. +- [Data Driven Tests](http://codecept.io/advanced/#data-driven-tests) introduced. +- Print execution time per step in `--debug` mode. #591 by @APshenkin +- [WebDriverIO][Protractor][Nightmare] Added `disableScreenshots` option to disable screenshots on fail by @Apshenkin +- [WebDriverIO][Protractor][Nightmare] Added `uniqueScreenshotNames` option to generate unique names for screenshots on failure by @Apshenkin +- [WebDriverIO][Nightmare] Fixed click on context; `click('text', '#el')` will throw exception if text is not found inside `#el`. +- [WebDriverIO][Protractor][SeleniumWebdriver] [SmartWait introduced](http://codecept.io/acceptance/#smartwait). +- [WebDriverIO][Protractor][Nightmare]Fixed `saveScreenshot` for PhantomJS, `fullPageScreenshots` option introduced by @HughZurname #549 +- [Appium] helper introduced by @APshenkin +- [REST] helper introduced by @atrevino in #504 +- [WebDriverIO][SeleniumWebdriver] Fixed "windowSize": "maximize" for Chrome 59+ version #560 by @APshenkin +- [Nightmare] Fixed restarting by @APshenkin #581 +- [WebDriverIO] Methods added by @APshenkin: + - [grabCssPropertyFrom](http://codecept.io/helpers/WebDriverIO/#grabcsspropertyfrom) + - [seeTitleEquals](http://codecept.io/helpers/WebDriverIO/#seetitleequals) + - [seeTextEquals](http://codecept.io/helpers/WebDriverIO/#seetextequals) + - [seeCssPropertiesOnElements](http://codecept.io/helpers/WebDriverIO/#seecsspropertiesonelements) + - [seeAttributesOnElements](http://codecept.io/helpers/WebDriverIO/#seeattributesonelements) + - [grabNumberOfVisibleElements](http://codecept.io/helpers/WebDriverIO/#grabnumberofvisibleelements) + - [waitInUrl](http://codecept.io/helpers/WebDriverIO/#waitinurl) + - [waitUrlEquals](http://codecept.io/helpers/WebDriverIO/#waiturlequals) + - [waitForValue](http://codecept.io/helpers/WebDriverIO/#waitforvalue) + - [waitNumberOfVisibleElements](http://codecept.io/helpers/WebDriverIO/#waitnumberofvisibleelements) + - [switchToNextTab](http://codecept.io/helpers/WebDriverIO/#switchtonexttab) + - [switchToPreviousTab](http://codecept.io/helpers/WebDriverIO/#switchtoprevioustab) + - [closeCurrentTab](http://codecept.io/helpers/WebDriverIO/#closecurrenttab) + - [openNewTab](http://codecept.io/helpers/WebDriverIO/#opennewtab) + - [refreshPage](http://codecept.io/helpers/WebDriverIO/#refreshpage) + - [scrollPageToBottom](http://codecept.io/helpers/WebDriverIO/#scrollpagetobottom) + - [scrollPageToTop](http://codecept.io/helpers/WebDriverIO/#scrollpagetotop) + - [grabBrowserLogs](http://codecept.io/helpers/WebDriverIO/#grabbrowserlogs) +- Use mkdirp to create output directory. #592 by @vkramskikh +- [WebDriverIO] Fixed `seeNumberOfVisibleElements` by @BorisOsipov #574 +- Lots of fixes for promise chain by @APshenkin #568 + - Fix #543- After block not properly executed if Scenario fails + - Expected behavior in promise chains: `_beforeSuite` hooks from helpers -> `BeforeSuite` from test -> `_before` hooks from helpers -> `Before` from test - > Test steps -> `_failed` hooks from helpers (if test failed) -> `After` from test -> `_after` hooks from helpers -> `AfterSuite` from test -> `_afterSuite` hook from helpers. + - if during test we got errors from any hook (in test or in helper) - stop complete this suite and go to another + - if during test we got error from Selenium server - stop complete this suite and go to another + - [WebDriverIO][Protractor] if `restart` option is false - close all tabs expect one in `_after`. + - Complete `_after`, `_afterSuite` hooks even After/AfterSuite from test was failed + - Don't close browser between suites, when `restart` option is false. We should start browser only one time and close it only after all tests. + - Close tabs and clear local storage, if `keepCookies` flag is enabled +- Fix TypeError when using babel-node or ts-node on node.js 7+ #586 by @vkramskikh +- [Nightmare] fixed usage of `_locate` Special thanks to **Andrey Pshenkin** for his work on this release and the major improvements. ## 0.6.3 -* Errors are printed in non-verbose mode. Shows "Selenium not started" and other important errors. -* Allowed to set custom test options: +- Errors are printed in non-verbose mode. Shows "Selenium not started" and other important errors. +- Allowed to set custom test options: ```js Scenario('My scenario', { build_id: 123, type: 'slow' }, function (I) ``` + those options can be accessed as `opts` property inside a `test` object. Can be used in custom listeners. -* Added `docs` directory to a package. -* [WebDriverIO][Protractor][SeleniumWebdriver] Bugfix: cleaning session when `restart: false` by @tfiwm #519 -* [WebDriverIO][Protractor][Nightmare] Added second parameter to `saveScreenshot` to allow a full page screenshot. By @HughZurname -* Added suite object to `suite.before` and `suite.after` events by @implico. #496 +- Added `docs` directory to a package. +- [WebDriverIO][Protractor][SeleniumWebdriver] Bugfix: cleaning session when `restart: false` by @tfiwm #519 +- [WebDriverIO][Protractor][Nightmare] Added second parameter to `saveScreenshot` to allow a full page screenshot. By @HughZurname +- Added suite object to `suite.before` and `suite.after` events by @implico. #496 ## 0.6.2 -* Added `config` object to [public API](http://codecept.io/hooks/#api) -* Extended `index.js` to include `actor` and `helpers`, so they could be required: +- Added `config` object to [public API](http://codecept.io/hooks/#api) +- Extended `index.js` to include `actor` and `helpers`, so they could be required: ```js -const actor = require('codeceptjs').actor; +const actor = require('codeceptjs').actor ``` -* Added [example for creating custom runner](http://codecept.io/hooks/#custom-runner) with public API. -* run command to create `output` directory if it doesn't exist -* [Protractor] fixed loading globally installed Protractor -* run-multiple command improvements: - * create output directories for each process - * print process ids in output +- Added [example for creating custom runner](http://codecept.io/hooks/#custom-runner) with public API. +- run command to create `output` directory if it doesn't exist +- [Protractor] fixed loading globally installed Protractor +- run-multiple command improvements: + - create output directories for each process + - print process ids in output ## 0.6.1 -* Fixed loading hooks +- Fixed loading hooks ## 0.6.0 Major release with extension API and parallel execution. -* **Breaking** Removed path argument from `run`. To specify path other than current directory use `--config` or `-c` option: +- **Breaking** Removed path argument from `run`. To specify path other than current directory use `--config` or `-c` option: Instead of: `codeceptjs run tests` use: @@ -3750,51 +3864,50 @@ codeceptjs run -c tests/codecept.json codeceptjs run users_test.js -c tests ``` -* **Command `multiple-run` added**, to execute tests in several browsers in parallel by @APshenkin and @davertmik. [See documentation](http://codecept.io/advanced/#multiple-execution). -* **Hooks API added to extend CodeceptJS** with custom listeners and plugins. [See documentation](http://codecept.io/hooks/#hooks_1). -* [Nightmare][WebDriverIO] `within` can work with iframes by @imvetri. [See documentation](http://codecept.io/acceptance/#iframes). -* [WebDriverIO][SeleniumWebdriver][Protractor] Default browser changed to `chrome` -* [Nightmare] Fixed globally locating `nightmare-upload`. -* [WebDriverIO] added `seeNumberOfVisibleElements` method by @elarouche. -* Exit with non-zero code if init throws an error by @rincedd -* New guides published: - * [Installation](http://codecept.io/installation/) - * [Hooks](http://codecept.io/hooks/) - * [Advanced Usage](http://codecept.io/advanced/) -* Meta packages published: - * [codecept-webdriverio](https://www.npmjs.com/package/codecept-webdriverio) - * [codecept-protractor](https://www.npmjs.com/package/codecept-protractor) - * [codecept-nightmare](https://www.npmjs.com/package/codecept-nightmare) - +- **Command `multiple-run` added**, to execute tests in several browsers in parallel by @APshenkin and @davertmik. [See documentation](http://codecept.io/advanced/#multiple-execution). +- **Hooks API added to extend CodeceptJS** with custom listeners and plugins. [See documentation](http://codecept.io/hooks/#hooks_1). +- [Nightmare][WebDriverIO] `within` can work with iframes by @imvetri. [See documentation](http://codecept.io/acceptance/#iframes). +- [WebDriverIO][SeleniumWebdriver][Protractor] Default browser changed to `chrome` +- [Nightmare] Fixed globally locating `nightmare-upload`. +- [WebDriverIO] added `seeNumberOfVisibleElements` method by @elarouche. +- Exit with non-zero code if init throws an error by @rincedd +- New guides published: + - [Installation](http://codecept.io/installation/) + - [Hooks](http://codecept.io/hooks/) + - [Advanced Usage](http://codecept.io/advanced/) +- Meta packages published: + - [codecept-webdriverio](https://www.npmjs.com/package/codecept-webdriverio) + - [codecept-protractor](https://www.npmjs.com/package/codecept-protractor) + - [codecept-nightmare](https://www.npmjs.com/package/codecept-nightmare) ## 0.5.1 -* [Polish translation](http://codecept.io/translation/#polish) added by @limes. -* Update process exit code so that mocha saves reports before exit by @romanovma. -* [Nightmare] fixed `getAttributeFrom` for custom attributes by @robrkerr -* [Nightmare] Fixed *UnhandledPromiseRejectionWarning error* when selecting the dropdown using `selectOption` by @robrkerr. [Se PR. -* [Protractor] fixed `pressKey` method by @romanovma +- [Polish translation](http://codecept.io/translation/#polish) added by @limes. +- Update process exit code so that mocha saves reports before exit by @romanovma. +- [Nightmare] fixed `getAttributeFrom` for custom attributes by @robrkerr +- [Nightmare] Fixed _UnhandledPromiseRejectionWarning error_ when selecting the dropdown using `selectOption` by @robrkerr. [Se PR. +- [Protractor] fixed `pressKey` method by @romanovma ## 0.5.0 -* Protractor ^5.0.0 support (while keeping ^4.0.9 compatibility) -* Fix 'fullTitle() is not a function' in exit.js by @hubidu. See #388. -* [Nightmare] Fix for `waitTimeout` by @HughZurname. See #391. Resolves #236* Dockerized CodeceptJS setup by @artiomnist. [See reference](https://github.com/codeceptjs/CodeceptJS/blob/master/docker/README.md) +- Protractor ^5.0.0 support (while keeping ^4.0.9 compatibility) +- Fix 'fullTitle() is not a function' in exit.js by @hubidu. See #388. +- [Nightmare] Fix for `waitTimeout` by @HughZurname. See #391. Resolves #236\* Dockerized CodeceptJS setup by @artiomnist. [See reference](https://github.com/codeceptjs/CodeceptJS/blob/master/docker/README.md) ## 0.4.16 -* Fixed steps output synchronization (regression since 0.4.14). -* [WebDriverIO][Protractor][SeleniumWebdriver][Nightmare] added `keepCookies` option to keep cookies between tests with `restart: false`. -* [Protractor] added `waitForTimeout` config option to set default waiting time for all wait* functions. -* Fixed `_test` hook for helpers by @cjhille. +- Fixed steps output synchronization (regression since 0.4.14). +- [WebDriverIO][Protractor][SeleniumWebdriver][Nightmare] added `keepCookies` option to keep cookies between tests with `restart: false`. +- [Protractor] added `waitForTimeout` config option to set default waiting time for all wait\* functions. +- Fixed `_test` hook for helpers by @cjhille. ## 0.4.15 -* Fixed regression in recorder sessions: `oldpromise is not defined`. +- Fixed regression in recorder sessions: `oldpromise is not defined`. ## 0.4.14 -* `_beforeStep` and `_afterStep` hooks in helpers are synchronized. Allows to perform additional actions between steps. +- `_beforeStep` and `_afterStep` hooks in helpers are synchronized. Allows to perform additional actions between steps. Example: fail if JS error occur in custom helper using WebdriverIO: @@ -3824,130 +3937,128 @@ _afterStep() { } ``` -* Fixed `codecept list` and `codecept def` commands. -* Added `I.say` method to print arbitrary comments. +- Fixed `codecept list` and `codecept def` commands. +- Added `I.say` method to print arbitrary comments. ```js -I.say('I am going to publish post'); -I.say('I enter title and body'); -I.say('I expect post is visible on site'); +I.say('I am going to publish post') +I.say('I enter title and body') +I.say('I expect post is visible on site') ``` -* [Nightmare] `restart` option added. `restart: false` allows to run all tests in a single window, disabled by default. By @nairvijays99 -* [Nightmare] Fixed `resizeWindow` command. -* [Protractor][SeleniumWebdriver] added `windowSize` config option to resize window on start. -* Fixed "Scenario.skip causes 'Cannot read property retries of undefined'" by @MasterOfPoppets -* Fixed providing absolute paths for tests in config by @lennym +- [Nightmare] `restart` option added. `restart: false` allows to run all tests in a single window, disabled by default. By @nairvijays99 +- [Nightmare] Fixed `resizeWindow` command. +- [Protractor][SeleniumWebdriver] added `windowSize` config option to resize window on start. +- Fixed "Scenario.skip causes 'Cannot read property retries of undefined'" by @MasterOfPoppets +- Fixed providing absolute paths for tests in config by @lennym ## 0.4.13 -* Added **retries** option `Feature` and `Scenario` to rerun fragile tests: +- Added **retries** option `Feature` and `Scenario` to rerun fragile tests: ```js -Feature('Complex JS Stuff', {retries: 3}); +Feature('Complex JS Stuff', { retries: 3 }) -Scenario('Not that complex', {retries: 1}, (I) => { +Scenario('Not that complex', { retries: 1 }, (I) => { // test goes here -}); +}) ``` -* Added **timeout** option `Feature` and `Scenario` to specify timeout. +- Added **timeout** option `Feature` and `Scenario` to specify timeout. ```js -Feature('Complex JS Stuff', {timeout: 5000}); +Feature('Complex JS Stuff', { timeout: 5000 }) -Scenario('Not that complex', {timeout: 1000}, (I) => { +Scenario('Not that complex', { timeout: 1000 }, (I) => { // test goes here -}); +}) ``` -* [WebDriverIO] Added `uniqueScreenshotNames` option to set unique screenshot names for failed tests. By @APshenkin. See #299 -* [WebDriverIO] `clearField` method improved to accept name/label locators and throw errors. -* [Nightmare][SeleniumWebdriver][Protractor] `clearField` method added. -* [Nightmare] Fixed `waitForElement`, and `waitForVisible` methods. -* [Nightmare] Fixed `resizeWindow` by @norisk-it -* Added italian [translation](http://codecept.io/translation/#italian). +- [WebDriverIO] Added `uniqueScreenshotNames` option to set unique screenshot names for failed tests. By @APshenkin. See #299 +- [WebDriverIO] `clearField` method improved to accept name/label locators and throw errors. +- [Nightmare][SeleniumWebdriver][Protractor] `clearField` method added. +- [Nightmare] Fixed `waitForElement`, and `waitForVisible` methods. +- [Nightmare] Fixed `resizeWindow` by @norisk-it +- Added italian [translation](http://codecept.io/translation/#italian). ## 0.4.12 -* Bootstrap / Teardown improved with [Hooks](http://codecept.io/configuration/#hooks). Various options for setup/teardown provided. -* Added `--override` or `-o` option for runner to dynamically override configs. Valid JSON should be passed: +- Bootstrap / Teardown improved with [Hooks](http://codecept.io/configuration/#hooks). Various options for setup/teardown provided. +- Added `--override` or `-o` option for runner to dynamically override configs. Valid JSON should be passed: ``` codeceptjs run -o '{ "bootstrap": "bootstrap.js"}' codeceptjs run -o '{ "helpers": {"WebDriverIO": {"browser": "chrome"}}}' ``` -* Added [regression tests](https://github.com/codeceptjs/CodeceptJS/tree/master/test/runner) for codeceptjs tests runner. +- Added [regression tests](https://github.com/codeceptjs/CodeceptJS/tree/master/test/runner) for codeceptjs tests runner. ## 0.4.11 -* Fixed regression in 0.4.10 -* Added `bootstrap`/`teardown` config options to accept functions as parameters by @pscanf. See updated [config reference](http://codecept.io/configuration/) #319 +- Fixed regression in 0.4.10 +- Added `bootstrap`/`teardown` config options to accept functions as parameters by @pscanf. See updated [config reference](http://codecept.io/configuration/) #319 ## 0.4.10 -* [Protractor] Protrctor 4.0.12+ support. -* Enabled async bootstrap file by @abachar. Use inside `bootstrap.js`: +- [Protractor] Protrctor 4.0.12+ support. +- Enabled async bootstrap file by @abachar. Use inside `bootstrap.js`: ```js -module.exports = function(done) { +module.exports = function (done) { // async instructions // call done() to continue execution // otherwise call done('error description') } ``` -* Changed 'pending' to 'skipped' in reports by @timja-kainos. See #315 +- Changed 'pending' to 'skipped' in reports by @timja-kainos. See #315 ## 0.4.9 -* [SeleniumWebdriver][Protractor][WebDriverIO][Nightmare] fixed `executeScript`, `executeAsyncScript` to work and return values. -* [Protractor][SeleniumWebdriver][WebDriverIO] Added `waitForInvisible` and `waitForStalenessOf` methods by @Nighthawk14. -* Added `--config` option to `codeceptjs run` to manually specify config file by @cnworks -* [Protractor] Simplified behavior of `amOutsideAngularApp` by using `ignoreSynchronization`. Fixes #278 -* Set exit code to 1 when test fails at `Before`/`After` hooks. Fixes #279 - +- [SeleniumWebdriver][Protractor][WebDriverIO][Nightmare] fixed `executeScript`, `executeAsyncScript` to work and return values. +- [Protractor][SeleniumWebdriver][WebDriverIO] Added `waitForInvisible` and `waitForStalenessOf` methods by @Nighthawk14. +- Added `--config` option to `codeceptjs run` to manually specify config file by @cnworks +- [Protractor] Simplified behavior of `amOutsideAngularApp` by using `ignoreSynchronization`. Fixes #278 +- Set exit code to 1 when test fails at `Before`/`After` hooks. Fixes #279 ## 0.4.8 -* [Protractor][SeleniumWebdriver][Nightmare] added `moveCursorTo` method. -* [Protractor][SeleniumWebdriver][WebDriverIO] Added `manualStart` option to start browser manually in the beginning of test. By @cnworks. [PR#250 -* Fixed `codeceptjs init` to work with nested directories and file masks. -* Fixed `codeceptjs gt` to generate test with proper file name suffix. By @Zougi. -* [Nightmare] Fixed: Error is thrown when clicking on element which can't be locate. By @davetmik -* [WebDriverIO] Fixed `attachFile` for file upload. By @giuband and @davetmik -* [WebDriverIO] Add support for timeouts in config and with `defineTimeouts` method. By @easternbloc #258 and #267 by @davetmik -* Fixed hanging of CodeceptJS when error is thrown by event dispatcher. Fix by @Zougi and @davetmik - +- [Protractor][SeleniumWebdriver][Nightmare] added `moveCursorTo` method. +- [Protractor][SeleniumWebdriver][WebDriverIO] Added `manualStart` option to start browser manually in the beginning of test. By @cnworks. [PR#250 +- Fixed `codeceptjs init` to work with nested directories and file masks. +- Fixed `codeceptjs gt` to generate test with proper file name suffix. By @Zougi. +- [Nightmare] Fixed: Error is thrown when clicking on element which can't be locate. By @davetmik +- [WebDriverIO] Fixed `attachFile` for file upload. By @giuband and @davetmik +- [WebDriverIO] Add support for timeouts in config and with `defineTimeouts` method. By @easternbloc #258 and #267 by @davetmik +- Fixed hanging of CodeceptJS when error is thrown by event dispatcher. Fix by @Zougi and @davetmik ## 0.4.7 -* Improved docs for `BeforeSuite`; fixed its usage with `restart: false` option by @APshenkin. -* Added `Nightmare` to list of available helpers on `init`. -* [Nightmare] Removed double `resizeWindow` implementation. +- Improved docs for `BeforeSuite`; fixed its usage with `restart: false` option by @APshenkin. +- Added `Nightmare` to list of available helpers on `init`. +- [Nightmare] Removed double `resizeWindow` implementation. ## 0.4.6 -* Added `BeforeSuite` and `AfterSuite` hooks to scenario by @APshenkin. See [updated documentation](http://codecept.io/basics/#beforesuite) +- Added `BeforeSuite` and `AfterSuite` hooks to scenario by @APshenkin. See [updated documentation](http://codecept.io/basics/#beforesuite) ## 0.4.5 -* Fixed running `codecept def` command by @jankaspar -* [Protractor][SeleniumWebdriver] Added support for special keys in `pressKey` method. Fixes #216 +- Fixed running `codecept def` command by @jankaspar +- [Protractor][SeleniumWebdriver] Added support for special keys in `pressKey` method. Fixes #216 ## 0.4.4 -* Interactive shell fixed. Start it by running `codeceptjs shell` -* Added `--profile` option to `shell` command to use dynamic configuration. -* Added `--verbose` option to `shell` command for most complete output. +- Interactive shell fixed. Start it by running `codeceptjs shell` +- Added `--profile` option to `shell` command to use dynamic configuration. +- Added `--verbose` option to `shell` command for most complete output. ## 0.4.3 -* [Protractor] Regression fixed to ^4.0.0 support -* Translations included into package. -* `teardown` option added to config (opposite to `bootstrap`), expects a JS file to be executed after tests stop. -* [Configuration](http://codecept.io/configuration/) can be set via JavaScript file `codecept.conf.js` instead of `codecept.json`. It should export `config` object: +- [Protractor] Regression fixed to ^4.0.0 support +- Translations included into package. +- `teardown` option added to config (opposite to `bootstrap`), expects a JS file to be executed after tests stop. +- [Configuration](http://codecept.io/configuration/) can be set via JavaScript file `codecept.conf.js` instead of `codecept.json`. It should export `config` object: ```js // inside codecept.conf.js @@ -3955,39 +4066,40 @@ exports.config = { // contents of codecept.js } ``` -* Added `--profile` option to pass its value to `codecept.conf.js` as `process.profile` for [dynamic configuration](http://codecept.io/configuration#dynamic-configuration). -* Documentation for [StepObjects, PageFragments](http://codecept.io/pageobjects#PageFragments) updated. -* Documentation for [Configuration](http://codecept.io/configuration/) added. + +- Added `--profile` option to pass its value to `codecept.conf.js` as `process.profile` for [dynamic configuration](http://codecept.io/configuration#dynamic-configuration). +- Documentation for [StepObjects, PageFragments](http://codecept.io/pageobjects#PageFragments) updated. +- Documentation for [Configuration](http://codecept.io/configuration/) added. ## 0.4.2 -* Added ability to localize tests with translation #189. Thanks to @abner - * [Translation] ru-RU translation added. - * [Translation] pt-BR translation added. -* [Protractor] Protractor 4.0.4 compatibility. -* [WebDriverIO][SeleniumWebdriver][Protractor] Fixed single browser session mode for `restart: false` -* Fixed using of 3rd party reporters (xunit, mocha-junit-reporter, mochawesome). Added guide. -* Documentation for [Translation](http://codecept.io/translation/) added. -* Documentation for [Reports](http://codecept.io/reports/) added. +- Added ability to localize tests with translation #189. Thanks to @abner + - [Translation] ru-RU translation added. + - [Translation] pt-BR translation added. +- [Protractor] Protractor 4.0.4 compatibility. +- [WebDriverIO][SeleniumWebdriver][Protractor] Fixed single browser session mode for `restart: false` +- Fixed using of 3rd party reporters (xunit, mocha-junit-reporter, mochawesome). Added guide. +- Documentation for [Translation](http://codecept.io/translation/) added. +- Documentation for [Reports](http://codecept.io/reports/) added. ## 0.4.1 -* Added custom steps to step definition list. See #174 by @jayS-de -* [WebDriverIO] Fixed using `waitForTimeout` option by @stephane-ruhlmann. See #178 +- Added custom steps to step definition list. See #174 by @jayS-de +- [WebDriverIO] Fixed using `waitForTimeout` option by @stephane-ruhlmann. See #178 ## 0.4.0 -* **[Nightmare](http://codecept.io/nightmare) Helper** added for faster web testing. -* [Protractor][SeleniumWebdriver][WebDriverIO] added `restart: false` option to reuse one browser between tests (improves speed). -* **Protractor 4.0** compatibility. Please upgrade Protractor library. -* Added `--verbose` option for `run` command to log and print global promise and events. -* Fixed errors with shutting down and cleanup. -* Fixed starting interactive shell with `codeceptjs shell`. -* Fixed handling of failures inside within block +- **[Nightmare](http://codecept.io/nightmare) Helper** added for faster web testing. +- [Protractor][SeleniumWebdriver][WebDriverIO] added `restart: false` option to reuse one browser between tests (improves speed). +- **Protractor 4.0** compatibility. Please upgrade Protractor library. +- Added `--verbose` option for `run` command to log and print global promise and events. +- Fixed errors with shutting down and cleanup. +- Fixed starting interactive shell with `codeceptjs shell`. +- Fixed handling of failures inside within block ## 0.3.5 -* Introduced IDE autocompletion support for Visual Studio Code and others. Added command for generating TypeScript definitions for `I` object. Use it as +- Introduced IDE autocompletion support for Visual Studio Code and others. Added command for generating TypeScript definitions for `I` object. Use it as ``` codeceptjs def @@ -3997,9 +4109,9 @@ to generate steps definition file and include it into tests by reference. By @ka ## 0.3.4 -* [Protractor] version 3.3.0 comptaibility, NPM 3 compatibility. Please update Protractor! -* allows using absolute path for helpers, output, in config and in command line. By @denis-sokolov -* Fixes 'Cannot read property '1' of null in generate.js:44' by @seethislight +- [Protractor] version 3.3.0 comptaibility, NPM 3 compatibility. Please update Protractor! +- allows using absolute path for helpers, output, in config and in command line. By @denis-sokolov +- Fixes 'Cannot read property '1' of null in generate.js:44' by @seethislight ## 0.3.3 @@ -4009,63 +4121,62 @@ Depending on installation type additional modules (webdriverio, protractor, ...) ## 0.3.2 -* Added `codeceptjs list` command which shows all available methods of `I` object. -* [Protractor][SeleniumWebdriver] fixed closing browser instances -* [Protractor][SeleniumWebdriver] `doubleClick` method added -* [WebDriverIO][Protractor][SeleniumWebdriver] `doubleClick` method to locate clickable elements by text, `context` option added. -* Fixed using assert in generator without yields #89 +- Added `codeceptjs list` command which shows all available methods of `I` object. +- [Protractor][SeleniumWebdriver] fixed closing browser instances +- [Protractor][SeleniumWebdriver] `doubleClick` method added +- [WebDriverIO][Protractor][SeleniumWebdriver] `doubleClick` method to locate clickable elements by text, `context` option added. +- Fixed using assert in generator without yields #89 ## 0.3.1 -* Fixed `init` command +- Fixed `init` command ## 0.3.0 **Breaking Change**: webdriverio package removed from dependencies list. You will need to install it manually after the upgrade. Starting from 0.3.0 webdriverio is not the only backend for running selenium tests, so you are free to choose between Protractor, SeleniumWebdriver, and webdriverio and install them. -* **[Protractor] helper added**. Now you can test AngularJS applications by using its official library within the unigied CodeceptJS API! -* **[SeleniumWebdriver] helper added**. You can switch to official JS bindings for Selenium. -* [WebDriverIO] **updated to webdriverio v 4.0** -* [WebDriverIO] `clearField` method added by @fabioel -* [WebDriverIO] added `dragAndDrop` by @fabioel -* [WebDriverIO] fixed `scrollTo` method by @sensone -* [WebDriverIO] fixed `windowSize: maximize` option in config -* [WebDriverIO] `seeElement` and `dontSeeElement` check element for visibility by @fabioel and @davertmik -* [WebDriverIO] `seeElementInDOM`, `dontSeeElementInDOM` added to check element exists on page. -* [WebDriverIO] fixed saving screenshots on failure. Fixes #70 -* fixed `within` block doesn't end in output not #79 - +- **[Protractor] helper added**. Now you can test AngularJS applications by using its official library within the unigied CodeceptJS API! +- **[SeleniumWebdriver] helper added**. You can switch to official JS bindings for Selenium. +- [WebDriverIO] **updated to webdriverio v 4.0** +- [WebDriverIO] `clearField` method added by @fabioel +- [WebDriverIO] added `dragAndDrop` by @fabioel +- [WebDriverIO] fixed `scrollTo` method by @sensone +- [WebDriverIO] fixed `windowSize: maximize` option in config +- [WebDriverIO] `seeElement` and `dontSeeElement` check element for visibility by @fabioel and @davertmik +- [WebDriverIO] `seeElementInDOM`, `dontSeeElementInDOM` added to check element exists on page. +- [WebDriverIO] fixed saving screenshots on failure. Fixes #70 +- fixed `within` block doesn't end in output not #79 ## 0.2.8 -* [WebDriverIO] added `seeNumberOfElements` by @fabioel +- [WebDriverIO] added `seeNumberOfElements` by @fabioel ## 0.2.7 -* process ends with exit code 1 on error or failure #49 -* fixed registereing global Helper #57 -* fixed handling error in within block #50 +- process ends with exit code 1 on error or failure #49 +- fixed registereing global Helper #57 +- fixed handling error in within block #50 ## 0.2.6 -* Fixed `done() was called multiple times` -* [WebDriverIO] added `waitToHide` method by @fabioel -* Added global `Helper` (alias `codecept_helper)`, object use for writing custom Helpers. Generator updated. Changes to #48 +- Fixed `done() was called multiple times` +- [WebDriverIO] added `waitToHide` method by @fabioel +- Added global `Helper` (alias `codecept_helper)`, object use for writing custom Helpers. Generator updated. Changes to #48 ## 0.2.5 -* Fixed issues with using yield inside a test #45 #47 #43 -* Fixed generating a custom helper. Helper class is now accessible with `codecept_helper` var. Fixes #48 +- Fixed issues with using yield inside a test #45 #47 #43 +- Fixed generating a custom helper. Helper class is now accessible with `codecept_helper` var. Fixes #48 ## 0.2.4 -* Fixed accessing helpers from custom helper by @pim. +- Fixed accessing helpers from custom helper by @pim. ## 0.2.3 -* [WebDriverIO] fixed `seeInField` to work with single value elements like: input[type=text], textareas, and multiple: select, input[type=radio], input[type=checkbox] -* [WebDriverIO] fixed `pressKey`, key modifeiers (Control, Command, Alt, Shift) are released after the action +- [WebDriverIO] fixed `seeInField` to work with single value elements like: input[type=text], textareas, and multiple: select, input[type=radio], input[type=checkbox] +- [WebDriverIO] fixed `pressKey`, key modifeiers (Control, Command, Alt, Shift) are released after the action ## 0.2.2 @@ -4075,9 +4186,9 @@ Whenever you need to create `I` object (in page objects, custom steps, but not i ## 0.2.0 -* **within** context hook added -* `--reporter` option supported -* [WebDriverIO] added features and methods: +- **within** context hook added +- `--reporter` option supported +- [WebDriverIO] added features and methods: - elements: `seeElement`, ... - popups: `acceptPopup`, `cancelPopup`, `seeInPopup`,... - navigation: `moveCursorTo`, `scrollTo` @@ -4087,8 +4198,8 @@ Whenever you need to create `I` object (in page objects, custom steps, but not i - form: `seeCheckboxIsChecked`, `selectOption` to support multiple selects - keyboard: `appendField`, `pressKey` - mouse: `rightClick` -* tests added -* [WebDriverIO] proxy configuration added by @petehouston -* [WebDriverIO] fixed `waitForText` method by @roadhump. Fixes #11 -* Fixed creating output dir when it already exists on init by @alfirin -* Fixed loading of custom helpers +- tests added +- [WebDriverIO] proxy configuration added by @petehouston +- [WebDriverIO] fixed `waitForText` method by @roadhump. Fixes #11 +- Fixed creating output dir when it already exists on init by @alfirin +- Fixed loading of custom helpers diff --git a/Dockerfile b/Dockerfile index 445b740c8..7d4f6bc9d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,11 @@ # Download Playwright and its dependencies -FROM mcr.microsoft.com/playwright:v1.39.0 +FROM mcr.microsoft.com/playwright:v1.48.1-noble ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD true # Installing the pre-required packages and libraries RUN apt-get update && \ - apt-get install -y libgtk2.0-0 libgconf-2-4 \ - libasound2 libxtst6 libxss1 libnss3 xvfb + apt-get install -y libgtk2.0-0 \ + libxtst6 libxss1 libnss3 xvfb # Install latest chrome dev package and fonts to support major charsets (Chinese, Japanese, Arabic, Hebrew, Thai and a few others) # Note: this installs the necessary libs to make the bundled version of Chromium that Puppeteer @@ -29,7 +29,7 @@ RUN groupadd -r pptruser && useradd -r -g pptruser -G audio,video pptruser \ COPY . /codecept RUN chown -R pptruser:pptruser /codecept -RUN runuser -l pptruser -c 'npm i --force --loglevel=warn --prefix /codecept' +RUN runuser -l pptruser -c 'npm i --loglevel=warn --prefix /codecept' RUN ln -s /codecept/bin/codecept.js /usr/local/bin/codeceptjs RUN mkdir /tests diff --git a/README.md b/README.md index 68481248b..adfa551a4 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ [![Stand With Ukraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/banner-direct-single.svg)](https://stand-with-ukraine.pp.ua) - - - [](https://join.slack.com/t/codeceptjs/shared_invite/enQtMzA5OTM4NDM2MzA4LWE4MThhN2NmYTgxNTU5MTc4YzAyYWMwY2JkMmZlYWI5MWQ2MDM5MmRmYzZmYmNiNmY5NTAzM2EwMGIwOTNhOGQ) [](https://codecept.discourse.group) [![NPM version][npm-image]][npm-url] [](https://hub.docker.com/r/codeceptjs/codeceptjs) -[![AI features](https://img.shields.io/badge/AI-features?logo=openai&logoColor=white)](https://github.com/codeceptjs/CodeceptJS/edit/3.x/docs/ai.md) [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) +[![AI features](https://img.shields.io/badge/AI-features?logo=openai&logoColor=white)](https://github.com/codeceptjs/CodeceptJS/edit/3.x/docs/ai.md) [![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) Build Status: @@ -28,28 +25,28 @@ It abstracts browser interaction to simple steps that are written from a user's A simple test that verifies the "Welcome" text is present on a main page of a site will look like: ```js -Feature('CodeceptJS demo'); +Feature('CodeceptJS demo') Scenario('check Welcome page on site', ({ I }) => { - I.amOnPage('/'); - I.see('Welcome'); -}); + I.amOnPage('/') + I.see('Welcome') +}) ``` CodeceptJS tests are: -* **Synchronous**. You don't need to care about callbacks or promises or test scenarios which are linear. But, your tests should be linear. -* Written from **user's perspective**. Every action is a method of `I`. That makes test easy to read, write and maintain even for non-tech persons. -* Backend **API agnostic**. We don't know which WebDriver implementation is running this test. +- **Synchronous**. You don't need to care about callbacks or promises or test scenarios which are linear. But, your tests should be linear. +- Written from **user's perspective**. Every action is a method of `I`. That makes test easy to read, write and maintain even for non-tech persons. +- Backend **API agnostic**. We don't know which WebDriver implementation is running this test. CodeceptJS uses **Helper** modules to provide actions to `I` object. Currently, CodeceptJS has these helpers: -* [**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. -* [**TestCafe**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation. -* [**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. +- [**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. +- [**TestCafe**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation. +- [**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. And more to come... @@ -59,17 +56,16 @@ CodeceptJS is a successor of [Codeception](http://codeception.com), a popular fu With CodeceptJS your scenario-driven functional and acceptance tests will be as simple and clean as they can be. You don't need to worry about asynchronous nature of NodeJS or about various APIs of Playwright, Selenium, Puppeteer, TestCafe, etc. as CodeceptJS unifies them and makes them work as they are synchronous. - ## Features - -* πŸͺ„ **AI-powered** with GPT features to assist and heal failing tests. -* β˜• Based on [Mocha](https://mochajs.org/) testing framework. -* πŸ’Ό Designed for scenario driven acceptance testing in BDD-style. -* πŸ’» Uses ES6 natively without transpiler. -* Also plays nice with TypeScript. -* Smart locators: use names, labels, matching text, CSS or XPath to locate elements. -* 🌐 Interactive debugging shell: pause test at any point and try different commands in a browser. -* Easily create tests, pageobjects, stepobjects with CLI generators. + +- πŸͺ„ **AI-powered** with GPT features to assist and heal failing tests. +- β˜• Based on [Mocha](https://mochajs.org/) testing framework. +- πŸ’Ό Designed for scenario driven acceptance testing in BDD-style. +- πŸ’» Uses ES6 natively without transpiler. +- Also plays nice with TypeScript. +- Smart locators: use names, labels, matching text, CSS or XPath to locate elements. +- 🌐 Interactive debugging shell: pause test at any point and try different commands in a browser. +- Easily create tests, pageobjects, stepobjects with CLI generators. ## Installation @@ -106,7 +102,8 @@ npx codeceptjs def . Later you can even automagically update Type Definitions to include your own custom [helpers methods](docs/helpers.md). Note: -- CodeceptJS requires Node.js version `12+` or later. + +- CodeceptJS requires Node.js version `12+` or later. ## Usage @@ -117,18 +114,18 @@ Learn CodeceptJS by examples. Let's assume we have CodeceptJS installed and WebD Let's see how we can handle basic form testing: ```js -Feature('CodeceptJS Demonstration'); +Feature('CodeceptJS Demonstration') Scenario('test some forms', ({ I }) => { - I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation'); - I.fillField('Email', 'hello@world.com'); - I.fillField('Password', secret('123456')); - I.checkOption('Active'); - I.checkOption('Male'); - I.click('Create User'); - I.see('User is valid'); - I.dontSeeInCurrentUrl('/documentation'); -}); + I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation') + I.fillField('Email', 'hello@world.com') + I.fillField('Password', secret('123456')) + I.checkOption('Active') + I.checkOption('Male') + I.click('Create User') + I.see('User is valid') + I.dontSeeInCurrentUrl('/documentation') +}) ``` All actions are performed by `I` object; assertions functions start with `see` function. @@ -173,11 +170,11 @@ The same way you can locate element by name, `CSS` or `XPath` locators in tests: ```js // by name -I.fillField('user_basic[email]', 'hello@world.com'); +I.fillField('user_basic[email]', 'hello@world.com') // by CSS -I.fillField('#user_basic_email', 'hello@world.com'); +I.fillField('#user_basic_email', 'hello@world.com') // don't make us guess locator type, specify it -I.fillField({css: '#user_basic_email'}, 'hello@world.com'); +I.fillField({ css: '#user_basic_email' }, 'hello@world.com') ``` Other methods like `checkOption`, and `click` work in a similar manner. They can take labels or CSS or XPath locators to find elements to interact. @@ -188,9 +185,9 @@ Assertions start with `see` or `dontSee` prefix. In our case we are asserting th However, we can narrow the search to particular element by providing a second parameter: ```js -I.see('User is valid'); +I.see('User is valid') // better to specify context: -I.see('User is valid', '.alert-success'); +I.see('User is valid', '.alert-success') ``` In this case 'User is valid' string will be searched only inside elements located by CSS `.alert-success`. @@ -201,13 +198,13 @@ In case you need to return a value from a webpage and use it directly in test, y They are expected to be used inside `async/await` functions, and their results will be available in test: ```js -Feature('CodeceptJS Demonstration'); +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.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/ +}) ``` The same way you can grab text, attributes, or form values and use them in next test steps. @@ -217,23 +214,24 @@ The same way you can grab text, attributes, or form values and use them in next Common preparation steps like opening a web page, logging in a user, can be placed in `Before` or `Background`: ```js -const { I } = inject(); +const { I } = inject() -Feature('CodeceptJS Demonstration'); +Feature('CodeceptJS Demonstration') -Before(() => { // or Background - I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation'); -}); +Before(() => { + // or Background + I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation') +}) Scenario('test some forms', () => { - I.click('Create User'); - I.see('User is valid'); - I.dontSeeInCurrentUrl('/documentation'); -}); + I.click('Create User') + I.see('User is valid') + I.dontSeeInCurrentUrl('/documentation') +}) Scenario('test title', () => { - I.seeInTitle('Example application'); -}); + I.seeInTitle('Example application') +}) ``` ## PageObjects @@ -249,58 +247,49 @@ It will create a page object file for you and add it to the config. Let's assume we created one named `docsPage`: ```js -const { I } = inject(); +const { I } = inject() module.exports = { fields: { email: '#user_basic_email', - password: '#user_basic_password' + password: '#user_basic_password', }, - submitButton: {css: '#new_user_basic input[type=submit]'}, + submitButton: { css: '#new_user_basic input[type=submit]' }, sendForm(email, password) { - I.fillField(this.fields.email, email); - I.fillField(this.fields.password, password); - I.click(this.submitButton); - } + I.fillField(this.fields.email, email) + I.fillField(this.fields.password, password) + I.click(this.submitButton) + }, } ``` You can easily inject it to test by providing its name in test arguments: ```js -Feature('CodeceptJS Demonstration'); +Feature('CodeceptJS Demonstration') -Before(({ I }) => { // or Background - I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation'); -}); +Before(({ I }) => { + // or Background + I.amOnPage('http://simple-form-bootstrap.plataformatec.com.br/documentation') +}) Scenario('test some forms', ({ I, docsPage }) => { - docsPage.sendForm('hello@world.com','123456'); - I.see('User is valid'); - I.dontSeeInCurrentUrl('/documentation'); -}); + docsPage.sendForm('hello@world.com', '123456') + I.see('User is valid') + I.dontSeeInCurrentUrl('/documentation') +}) ``` When using Typescript, replace `module.exports` with `export` for autocompletion. - ## Contributing - - ### [Contributing Guide](https://github.com/codeceptjs/CodeceptJS/blob/master/.github/CONTRIBUTING.md) - - ### [Code of conduct](https://github.com/codeceptjs/CodeceptJS/blob/master/.github/CODE_OF_CONDUCT.md) - +- ### [Contributing Guide](https://github.com/codeceptjs/CodeceptJS/blob/master/.github/CONTRIBUTING.md) +- ### [Code of conduct](https://github.com/codeceptjs/CodeceptJS/blob/master/.github/CODE_OF_CONDUCT.md) ## Contributors - - - - - - - -
@@ -478,7 +467,6 @@ When using Typescript, replace `module.exports` with `export` for autocompletion
- ## License diff --git a/docs/configuration.md b/docs/configuration.md index 363de25b5..0736c86a0 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -9,34 +9,34 @@ CodeceptJS configuration is set in `codecept.conf.js` file. After running `codeceptjs init` it should be saved in test root. -| Name | Type | Description | -| :------ | :------ | :------ | -| `bootstrap?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute code before](https://codecept.io/bootstrap/) tests are run. Can be either JS module file or async function: ```bootstrap: async () => server.launch(), ``` or ```bootstrap: 'bootstrap.js', ``` | -| `bootstrapAll?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute code before launching tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall) | -| `gherkin?` | { `features`: `string` \| `string`[] ; `steps`: `string`[] } | Enable [BDD features](https://codecept.io/bdd/#configuration). Sample configuration: ```gherkin: { features: "./features/*.feature", steps: ["./step_definitions/steps.js"] } ``` | -| `gherkin.features` | `string` \| `string`[] | load feature files by pattern. Multiple patterns can be specified as array | -| `gherkin.steps` | `string`[] | load step definitions from JS files | -| `grep?` | `string` | Pattern to filter tests by name. This option is useful if you plan to use multiple configs for different environments. To execute only tests with @firefox tag use ```grep: '@firefox' ``` | -| `helpers?` | {} | Enable and configure helpers: ```helpers: { Playwright: { url: 'https://mysite.com', browser: 'firefox' } } ``` | -| `include?` | `any` | Include page objects to access them via dependency injection ```I: "./custom_steps.js", loginPage: "./pages/Login.js", User: "./pages/User.js", ``` Configured modules can be injected by name in a Scenario: ```Scenario('test', { I, loginPage, User }) ``` | -| `mocha?` | `any` | [Mocha test runner options](https://mochajs.org/#configuring-mocha-nodejs), additional [reporters](https://codecept.io/reports/#xml) can be configured here. Example: ```mocha: { "mocha-junit-reporter": { stdout: "./output/console.log", options: { mochaFile: "./output/result.xml", attachments: true //add screenshot for a failed test } } } ``` | -| `noGlobals?` | `boolean` | Disable registering global functions (Before, Scenario, etc). Not recommended | -| `output` | `string` | Where to store failure screenshots, artifacts, etc ```output: './output' ``` | -| `plugins?` | `any` | Enable CodeceptJS plugins. Example: ```plugins: { autoDelay: { enabled: true } } ``` | -| `require?` | `string`[] | [Require additional JS modules](https://codecept.io/configuration/#require) Example: ``` require: ["should"] ``` | -| `teardown?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute code after tests](https://codecept.io/bootstrap/) finished. Can be either JS module file or async function: ```teardown: async () => server.stop(), ``` or ```teardown: 'teardown.js', ``` | -| `teardownAll?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute JS code after finishing tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall) | -| `tests` | `string` | Pattern to locate CodeceptJS tests. Allows to enter glob pattern or an Array of patterns to match tests / test file names. For tests in JavaScript: ```tests: 'tests/**.test.js' ``` For tests in TypeScript: ```tests: 'tests/**.test.ts' ``` | -| `timeout?` | `number` | Set default tests timeout in seconds. Tests will be killed on no response after timeout. ```timeout: 20, ``` | -| `translation?` | `string` | Enable [localized test commands](https://codecept.io/translation/) | -| `maskSensitiveData?` | `boolean` | Enable to mask Sensitive Data in console. | - +| Name | Type | Description | +| :------------------- | :----------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `bootstrap?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute code before](https://codecept.io/bootstrap/) tests are run. Can be either JS module file or async function: `bootstrap: async () => server.launch(), ` or `bootstrap: 'bootstrap.js', ` | +| `bootstrapAll?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute code before launching tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall) | +| `gherkin?` | { `features`: `string` \| `string`[] ; `steps`: `string`[] } | Enable [BDD features](https://codecept.io/bdd/#configuration). Sample configuration: `gherkin: { features: "./features/*.feature", steps: ["./step_definitions/steps.js"] } ` | +| `gherkin.features` | `string` \| `string`[] | load feature files by pattern. Multiple patterns can be specified as array | +| `gherkin.steps` | `string`[] | load step definitions from JS files | +| `grep?` | `string` | Pattern to filter tests by name. This option is useful if you plan to use multiple configs for different environments. To execute only tests with @firefox tag use `grep: '@firefox' ` | +| `helpers?` | {} | Enable and configure helpers: `helpers: { Playwright: { url: 'https://mysite.com', browser: 'firefox' } } ` | +| `include?` | `any` | Include page objects to access them via dependency injection `I: "./custom_steps.js", loginPage: "./pages/Login.js", User: "./pages/User.js", ` Configured modules can be injected by name in a Scenario: `Scenario('test', { I, loginPage, User }) ` | +| `mocha?` | `any` | [Mocha test runner options](https://mochajs.org/#configuring-mocha-nodejs), additional [reporters](https://codecept.io/reports/#xml) can be configured here. Example: `mocha: { "mocha-junit-reporter": { stdout: "./output/console.log", options: { mochaFile: "./output/result.xml", attachments: true //add screenshot for a failed test } } } ` | +| `noGlobals?` | `boolean` | Disable registering global functions (Before, Scenario, etc). Not recommended | +| `output` | `string` | Where to store failure screenshots, artifacts, etc `output: './output' ` | +| `plugins?` | `any` | Enable CodeceptJS plugins. Example: `plugins: { autoDelay: { enabled: true } } ` | +| `require?` | `string`[] | [Require additional JS modules](https://codecept.io/configuration/#require) Example: `require: ["should"]` | +| `teardown?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute code after tests](https://codecept.io/bootstrap/) finished. Can be either JS module file or async function: `teardown: async () => server.stop(), ` or `teardown: 'teardown.js', ` | +| `teardownAll?` | (() => `Promise`<`void`\>) \| `boolean` \| `string` | [Execute JS code after finishing tests in parallel mode](https://codecept.io/bootstrap/#bootstrapall-teardownall) | +| `tests` | `string` | Pattern to locate CodeceptJS tests. Allows to enter glob pattern or an Array of patterns to match tests / test file names. For tests in JavaScript: `tests: 'tests/**.test.js' ` For tests in TypeScript: `tests: 'tests/**.test.ts' ` | +| `timeout?` | `number` | Set default tests timeout in seconds. Tests will be killed on no response after timeout. `timeout: 20, ` | +| `translation?` | `string` | Enable [localized test commands](https://codecept.io/translation/) | +| `maskSensitiveData?` | `boolean` | Enable to mask Sensitive Data in console. | ## Require Requires described module before run. This option is useful for assertion libraries, so you may `--require should` instead of manually invoking `require('should')` within each test file. It can be used with relative paths, e.g. `"require": ["/lib/somemodule"]`, and installed packages. You can register ts-node, so you can use Typescript in tests with ts-node package + ```js exports.config = { tests: './*_test.js', @@ -47,13 +47,15 @@ exports.config = { bootstrap: false, mocha: {}, // require modules - require: ["ts-node/register", "should"] + require: ['ts-node/register', 'should'], } ``` + For array of test pattern + ```js exports.config = { - tests: ['./*_test.js','./sampleTest.js'], + tests: ['./*_test.js', './sampleTest.js'], timeout: 10000, output: '', helpers: {}, @@ -61,21 +63,22 @@ exports.config = { bootstrap: false, mocha: {}, // require modules - require: ["ts-node/register", "should"] + require: ['ts-node/register', 'should'], } ``` + ## Dynamic Configuration - By default `codecept.json` is used for configuration. You can override its values in runtime by using `--override` or `-o` option in command line, passing valid JSON as a value: +By default `codecept.json` is used for configuration. You can override its values in runtime by using `--override` or `-o` option in command line, passing valid JSON as a value: ```sh codeceptjs run -o '{ "helpers": {"WebDriver": {"browser": "firefox"}}}' ``` - You can also switch to JS configuration format for more dynamic options. - Create `codecept.conf.js` file and make it export `config` property. +You can also switch to JS configuration format for more dynamic options. +Create `codecept.conf.js` file and make it export `config` property. - See the config example: +See the config example: ```js exports.config = { @@ -88,8 +91,8 @@ exports.config = { key: process.env.CLOUDSERVICE_KEY, coloredLogs: true, - waitForTimeout: 10000 - } + waitForTimeout: 10000, + }, }, // don't build monolithic configs @@ -97,12 +100,12 @@ exports.config = { include: { I: './src/steps_file.js', loginPage: './src/pages/login_page', - dashboardPage: new DashboardPage() - } + dashboardPage: new DashboardPage(), + }, // here goes config as it was in codecept.conf.ts // .... -}; +} ``` (Don't copy-paste this config, it's just demo) @@ -122,10 +125,10 @@ codeceptjs run --config=./path/to/my/config.js Install it and enable to easily switch to headless/window mode, change window size, etc. ```js -const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure'); +const { setHeadlessWhen, setWindowSize } = require('@codeceptjs/configure') -setHeadlessWhen(process.env.CI); -setWindowSize(1600, 1200); +setHeadlessWhen(process.env.CI) +setWindowSize(1600, 1200) exports.config = { // ... @@ -150,9 +153,8 @@ exports.config = { WebDriver: { url: 'http://localhost:3000', // load value from `profile` - browser: process.env.profile || 'firefox' - - } - } -}; + browser: process.env.profile || 'firefox', + }, + }, +} ``` diff --git a/docs/data.md b/docs/data.md index 6c8bc4288..f1e876a8a 100644 --- a/docs/data.md +++ b/docs/data.md @@ -5,7 +5,7 @@ title: Data Management # Data Management -> This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](https://codecept.io/advanced/#data-drivern-tests) section* +> This chapter describes data management for external sources. If you are looking for using Data Sets in tests, see [Data Driven Tests](https://codecept.io/advanced/#data-drivern-tests) section\* Managing data for tests is always a tricky issue. How isolate data between tests, how to prepare data for different tests, etc. There are different approaches to solve it: @@ -62,30 +62,30 @@ As well as a method for setting headers: `haveRequestHeaders`. Here is a usage example: ```js -let postId = null; +let postId = null -Scenario('check post page', async ({ I }) => { +Scenario('check post page', async ({ I }) => { // valid access token - I.haveRequestHeaders({auth: '1111111'}); + I.haveRequestHeaders({ auth: '1111111' }) // get the first user - let user = await I.sendGetRequest('/api/users/1'); + let user = await I.sendGetRequest('/api/users/1') // create a post and save its Id - postId = await I.sendPostRequest('/api/posts', { author: user.id, body: 'some text' }); + postId = await I.sendPostRequest('/api/posts', { author: user.id, body: 'some text' }) // open browser page of new post - I.amOnPage('/posts/2.html'); - I.see('some text', 'p.body'); -}); + I.amOnPage('/posts/2.html') + I.see('some text', 'p.body') +}) // cleanup created data After(({ I }) => { - I.sendDeleteRequest('/api/posts/'+postId); -}); + I.sendDeleteRequest('/api/posts/' + postId) +}) ``` This can also be used to emulate Ajax requests: ```js -I.sendPostRequest('/update-status', {}, { http_x_requested_with: 'xmlhttprequest' }); +I.sendPostRequest('/update-status', {}, { http_x_requested_with: 'xmlhttprequest' }) ``` > See complete reference on [REST](https://codecept.io/helpers/REST) helper @@ -129,37 +129,31 @@ As well as a method for setting headers: `haveRequestHeaders`. Here is a usage example: ```js -let postData = null; +let postData = null -Scenario('check post page', async ({ I }) => { +Scenario('check post page', async ({ I }) => { // valid access token - I.haveRequestHeaders({auth: '1111111'}); + I.haveRequestHeaders({ auth: '1111111' }) // get the first user - let response = await I.sendQuery('{ user(id:1) { id }}'); - let user = response.data; + let response = await I.sendQuery('{ user(id:1) { id }}') + let user = response.data // create a post and save its Id - response = await I.sendMutation( - 'mutation createPost($input: PostInput!) { createPost(input: $input) { id }}', - { - input : { - author: user.data.id, - body: 'some text', - } + response = await I.sendMutation('mutation createPost($input: PostInput!) { createPost(input: $input) { id }}', { + input: { + author: user.data.id, + body: 'some text', }, - ); - postData = response.data.data['createPost']; + }) + postData = response.data.data['createPost'] // open browser page of new post - I.amOnPage(`/posts/${postData.slug}.html`); - I.see(postData.body, 'p.body'); -}); + I.amOnPage(`/posts/${postData.slug}.html`) + I.see(postData.body, 'p.body') +}) // cleanup created data After(({ I }) => { - I.sendMutation( - 'mutation deletePost($id: ID!) { deletePost(id: $id) }', - { id: postData.id}, - ); -}); + I.sendMutation('mutation deletePost($id: ID!) { deletePost(id: $id) }', { id: postData.id }) +}) ``` > See complete reference on [GraphQL](https://codecept.io/helpers/GraphQL) helper @@ -167,6 +161,7 @@ After(({ I }) => { ## Data Generation with Factories This concept is extended by: + - [ApiDataFactory](https://codecept.io/helpers/ApiDataFactory/) helper, and, - [GraphQLDataFactory](https://codecept.io/helpers/GraphQLDataFactory/) helper. @@ -197,8 +192,8 @@ The way for setting data for a test is as simple as writing: ```js // inside async function -let post = await I.have('post'); -I.haveMultiple('comment', 5, { postId: post.id}); +let post = await I.have('post') +I.haveMultiple('comment', 5, { postId: post.id }) ``` After completing the preparations under 'Data Generation with Factories', create a factory module which will export a factory. @@ -207,12 +202,10 @@ See the example providing a factory for User generation: ```js // factories/post.js -var Factory = require('rosie').Factory; -var faker = require('@faker-js/faker'); +var Factory = require('rosie').Factory +var faker = require('@faker-js/faker') -module.exports = new Factory() - .attr('name', () => faker.person.findName()) - .attr('email', () => faker.internet.email()); +module.exports = new Factory().attr('name', () => faker.person.findName()).attr('email', () => faker.internet.email()) ``` Next is to configure helper to match factories with API: @@ -249,12 +242,10 @@ This way for setting data for a test is as simple as writing: ```js // inside async function -let post = await I.mutateData('createPost'); -I.mutateMultiple('createComment', 5, { postId: post.id}); +let post = await I.mutateData('createPost') +I.mutateMultiple('createComment', 5, { postId: post.id }) ``` - - After completing the preparations under 'Data Generation with Factories', create a factory module which will export a factory. The object built by the factory is sent as the variables object along with the mutation. So make sure it matches the argument type as detailed in the GraphQL schema. You may want to pass a constructor to the factory to achieve that. @@ -263,8 +254,8 @@ See the example providing a factory for User generation: ```js // factories/post.js -var Factory = require('rosie').Factory; -var faker = require('@faker-js/faker'); +var Factory = require('rosie').Factory +var faker = require('@faker-js/faker') module.exports = new Factory((buildObj) => { return { @@ -272,7 +263,7 @@ module.exports = new Factory((buildObj) => { } }) .attr('name', () => faker.person.findName()) - .attr('email', () => faker.internet.email()); + .attr('email', () => faker.internet.email()) ``` Next is to configure helper to match factories with API: @@ -326,10 +317,10 @@ Import `setSharedCookies` function and call it inside a config: ```js // in codecept.conf.js -const { setSharedCookies } = require('@codeceptjs/configure'); +const { setSharedCookies } = require('@codeceptjs/configure') // share cookies between browser helpers and REST/GraphQL -setSharedCookies(); +setSharedCookies() exports.config = {} ``` diff --git a/docs/email.md b/docs/email.md index db8ee3297..2618f1b72 100644 --- a/docs/email.md +++ b/docs/email.md @@ -47,24 +47,24 @@ To create a mailbox use `I.haveNewMailbox()` command: ```js // inside async/await function -const mailbox = await I.haveNewMailbox(); +const mailbox = await I.haveNewMailbox() ``` mailbox object contains: -* `id` - which is used in next commands -* `emailAddress` - randomly generated address of a created mailbox. +- `id` - which is used in next commands +- `emailAddress` - randomly generated address of a created mailbox. > See [MailSlurp's guide](https://www.mailslurp.com/guides/getting-started/#create-email-addresses) for details. Mailbox is opened on creation. If you need more than one mailbox and you want to switch between them use `openMailbox` method: ```js -const mailbox1 = await I.haveNewMailbox(); -const mailbox2 = await I.haveNewMailbox(); +const mailbox1 = await I.haveNewMailbox() +const mailbox2 = await I.haveNewMailbox() // mailbox2 is now default mailbox // switch back to mailbox1 -I.openMailbox(mailbox1); +I.openMailbox(mailbox1) ``` ## Receiving An Email @@ -78,54 +78,55 @@ Use `waitForLatestEmail` function to return the first email from a mailbox: ```js // to wait for default time (10 secs by default) -I.waitForLatestEmail(); +I.waitForLatestEmail() // or specify number of time to wait -I.waitForLatestEmail(30); +I.waitForLatestEmail(30) ``` To specify the exact email to match use `waitForEmailMatching` function: ```js // wait for an email with partial match in subject -I.waitForEmailMatching({ subject: 'Restore password' }); +I.waitForEmailMatching({ subject: 'Restore password' }) // wait 30 seconds for email with exact subject -I.waitForEmailMatching({ subject: '=Forgot password' }, 30); +I.waitForEmailMatching({ subject: '=Forgot password' }, 30) // wait a last email from any address @mysite.com I.waitForEmailMatching({ - from: '@mysite.com', // find anything from mysite - subject: 'Restore password', // with Restore password in subject -}); + from: '@mysite.com', // find anything from mysite + subject: 'Restore password', // with Restore password in subject +}) ``` ## Opening An Email -All wait* functions return a matched email as a result. So you can use it in a test: +All wait\* functions return a matched email as a result. So you can use it in a test: ```js -const email = await I.waitForLatestEmail(); +const email = await I.waitForLatestEmail() ``` + > Please note, that we use `await` to assign email. This should be declared inside async function An `email` object contains the following fields: -* `subject` -* `for` -* `to` -* `body` +- `subject` +- `for` +- `to` +- `body` So you can analyze them inside a test. For instance, you can extract an URL from email body and open it. This is how we can emulate "click on this link" behavior in email: ```js // clicking a link in email -const email = await I.waitForLatestEmail(); +const email = await I.waitForLatestEmail() // extract a link by RegExp -const url = email.body.match(/http(s):\/\/(.*?)\s/)[0]; +const url = email.body.match(/http(s):\/\/(.*?)\s/)[0] // open URL -I.amOnPage(url); +I.amOnPage(url) ``` ## Assertions @@ -133,31 +134,31 @@ I.amOnPage(url); Assertions are performed on the currently opened email. Email is opened on `waitFor` email call, however, you can open an exact email by using `openEmail` function. ```js -const email1 = await I.waitForLatestEmail(); +const email1 = await I.waitForLatestEmail() // test proceeds... -const email2 = await I.waitForLatestEmail(); -I.openEmail(email1); // open previous email +const email2 = await I.waitForLatestEmail() +I.openEmail(email1) // open previous email ``` After opening an email assertion methods are available. -* `seeInEmailSubject` -* `seeEmailIsFrom` -* `seeInEmailBody` -* `dontSeeInEmailBody` -* `seeNumberOfEmailAttachments` -* `seeEmailAttachment` +- `seeInEmailSubject` +- `seeEmailIsFrom` +- `seeInEmailBody` +- `dontSeeInEmailBody` +- `seeNumberOfEmailAttachments` +- `seeEmailAttachment` And here is an example of their usage: ```js I.waitForLatestEmail() -I.seeEmailIsFrom('@mysite.com'); -I.seeInEmailSubject('Awesome Proposal!'); -I.seeInEmailBody('To unsubscribe click here'); -I.seeNumberOfEmailAttachments(2); -I.seeEmailAttachment('Attachment_1.pdf'); // Regular expression. Escape special characters like '(' or ')' in filename. -I.seeEmailAttachment('Attachment_2.pdf'); +I.seeEmailIsFrom('@mysite.com') +I.seeInEmailSubject('Awesome Proposal!') +I.seeInEmailBody('To unsubscribe click here') +I.seeNumberOfEmailAttachments(2) +I.seeEmailAttachment('Attachment_1.pdf') // Regular expression. Escape special characters like '(' or ')' in filename. +I.seeEmailAttachment('Attachment_2.pdf') ``` > More methods are listed in [helper's API reference](https://github.com/codeceptjs/mailslurp-helper/blob/master/README.md#api) @@ -167,7 +168,7 @@ I.seeEmailAttachment('Attachment_2.pdf'); Use `grabAllEmailsFromMailbox` to get all emails from a current mailbox: ```js -const emails = await I.grabAllEmailsFromMailbox(); +const emails = await I.grabAllEmailsFromMailbox() ``` ## Sending an Email @@ -178,6 +179,6 @@ You can also send an email from an active mailbox: I.sendEmail({ to: ['user@site.com'], subject: 'Hello', - body: 'World' -}); + body: 'World', +}) ``` diff --git a/docs/helpers/AI.md b/docs/helpers/AI.md index 96e0dc607..6e086ccde 100644 --- a/docs/helpers/AI.md +++ b/docs/helpers/AI.md @@ -22,11 +22,11 @@ Use it only in development mode. It is recommended to run it only inside pause() This helper should be configured in codecept.conf.{js|ts} -* `chunkSize`: - The maximum number of characters to send to the AI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4. +- `chunkSize`: - The maximum number of characters to send to the AI API at once. We split HTML fragments by 8000 chars to not exceed token limit. Increase this value if you use GPT-4. ### Parameters -* `config` +- `config` ### askForPageObject @@ -37,22 +37,22 @@ Prompt can be customized in a global config file. ```js // create page object for whole page -I.askForPageObject('home'); +I.askForPageObject('home') // create page object with extra prompt -I.askForPageObject('home', 'implement signIn(username, password) method'); +I.askForPageObject('home', 'implement signIn(username, password) method') // create page object for a specific element -I.askForPageObject('home', null, '.detail'); +I.askForPageObject('home', null, '.detail') ``` Asks for a page object based on the provided page name, locator, and extra prompt. #### Parameters -* `pageName` **[string][1]** The name of the page to retrieve the object for. -* `extraPrompt` **([string][1] | null)** An optional extra prompt for additional context or information. -* `locator` **([string][1] | null)** An optional locator to find a specific element on the page. +- `pageName` **[string][1]** The name of the page to retrieve the object for. +- `extraPrompt` **([string][1] | null)** An optional extra prompt for additional context or information. +- `locator` **([string][1] | null)** An optional locator to find a specific element on the page. Returns **[Promise][2]<[Object][3]>** A promise that resolves to the requested page object. @@ -62,7 +62,7 @@ Send a general request to AI and return response. #### Parameters -* `prompt` **[string][1]** +- `prompt` **[string][1]** Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated response from the GPT model. @@ -71,12 +71,12 @@ Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated r Asks the AI GPT language model a question based on the provided prompt within the context of the current page's HTML. ```js -I.askGptOnPage('what does this page do?'); +I.askGptOnPage('what does this page do?') ``` #### Parameters -* `prompt` **[string][1]** The question or prompt to ask the GPT model. +- `prompt` **[string][1]** The question or prompt to ask the GPT model. Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated responses from the GPT model, joined by newlines. @@ -85,18 +85,16 @@ Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated r Asks the AI a question based on the provided prompt within the context of a specific HTML fragment on the current page. ```js -I.askGptOnPageFragment('describe features of this screen', '.screen'); +I.askGptOnPageFragment('describe features of this screen', '.screen') ``` #### Parameters -* `prompt` **[string][1]** The question or prompt to ask the GPT-3.5 model. -* `locator` **[string][1]** The locator or selector used to identify the HTML fragment on the page. +- `prompt` **[string][1]** The question or prompt to ask the GPT-3.5 model. +- `locator` **[string][1]** The locator or selector used to identify the HTML fragment on the page. Returns **[Promise][2]<[string][1]>** A Promise that resolves to the generated response from the GPT model. [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String - [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise - [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object diff --git a/docs/helpers/ApiDataFactory.md b/docs/helpers/ApiDataFactory.md index d76af53e0..8439b1fca 100644 --- a/docs/helpers/ApiDataFactory.md +++ b/docs/helpers/ApiDataFactory.md @@ -28,9 +28,9 @@ Most of web application have API, and it can be used to create and delete test r By combining REST API with Factories you can easily create records for tests: ```js -I.have('user', { login: 'davert', email: 'davert@mail.com' }); -let id = await I.have('post', { title: 'My first post'}); -I.haveMultiple('comment', 3, {post_id: id}); +I.have('user', { login: 'davert', email: 'davert@mail.com' }) +let id = await I.have('post', { title: 'My first post' }) +I.haveMultiple('comment', 3, { post_id: id }) ``` To make this work you need @@ -53,14 +53,14 @@ See the example for Posts factories: ```js // tests/factories/posts.js -const { Factory } = require('rosie'); -const { faker } = require('@faker-js/faker'); +const { Factory } = require('rosie') +const { faker } = require('@faker-js/faker') module.exports = new Factory() - // no need to set id, it will be set by REST API - .attr('author', () => faker.person.findName()) - .attr('title', () => faker.lorem.sentence()) - .attr('body', () => faker.lorem.paragraph()); + // no need to set id, it will be set by REST API + .attr('author', () => faker.person.findName()) + .attr('title', () => faker.lorem.sentence()) + .attr('body', () => faker.lorem.paragraph()) ``` For more options see [rosie documentation][1]. @@ -71,12 +71,12 @@ Then configure ApiDataHelper to match factories and REST API: ApiDataFactory has following config options: -* `endpoint`: base URL for the API to send requests to. -* `cleanup` (default: true): should inserted records be deleted up after tests -* `factories`: list of defined factories -* `returnId` (default: false): return id instead of a complete response when creating items. -* `headers`: list of headers -* `REST`: configuration for REST requests +- `endpoint`: base URL for the API to send requests to. +- `cleanup` (default: true): should inserted records be deleted up after tests +- `factories`: list of defined factories +- `returnId` (default: false): return id instead of a complete response when creating items. +- `headers`: list of headers +- `REST`: configuration for REST requests See the example: @@ -121,19 +121,19 @@ For instance, to set timeout you should add: By default to create a record ApiDataFactory will use endpoint and plural factory name: -* create: `POST {endpoint}/{resource} data` -* delete: `DELETE {endpoint}/{resource}/id` +- create: `POST {endpoint}/{resource} data` +- delete: `DELETE {endpoint}/{resource}/id` Example (`endpoint`: `http://app.com/api`): -* create: POST request to `http://app.com/api/users` -* delete: DELETE request to `http://app.com/api/users/1` +- create: POST request to `http://app.com/api/users` +- delete: DELETE request to `http://app.com/api/users/1` This behavior can be configured with following options: -* `uri`: set different resource uri. Example: `uri: account` => `http://app.com/api/account`. -* `create`: override create options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/create" }` -* `delete`: override delete options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/delete/{id}" }` +- `uri`: set different resource uri. Example: `uri: account` => `http://app.com/api/account`. +- `create`: override create options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/create" }` +- `delete`: override delete options. Expected format: `{ method: uri }`. Example: `{ "post": "/users/delete/{id}" }` Requests can also be overridden with a function which returns [axois request config][4]. @@ -146,11 +146,11 @@ delete: (id) => ({ method: 'delete', url: '/posts', data: { id } }) Requests can be updated on the fly by using `onRequest` function. For instance, you can pass in current session from a cookie. ```js - onRequest: async (request) => { - // using global codeceptjs instance - let cookie = await codeceptjs.container.helpers('WebDriver').grabCookie('session'); - request.headers = { Cookie: `session=${cookie.value}` }; - } +onRequest: async (request) => { + // using global codeceptjs instance + let cookie = await codeceptjs.container.helpers('WebDriver').grabCookie('session') + request.headers = { Cookie: `session=${cookie.value}` } +} ``` ### Responses @@ -158,7 +158,7 @@ Requests can be updated on the fly by using `onRequest` function. For instance, By default `I.have()` returns a promise with a created data: ```js -let client = await I.have('client'); +let client = await I.have('client') ``` Ids of created records are collected and used in the end of a test for the cleanup. @@ -166,11 +166,11 @@ If you need to receive `id` instead of full response enable `returnId` in a help ```js // returnId: false -let clientId = await I.have('client'); +let clientId = await I.have('client') // clientId == 1 // returnId: true -let clientId = await I.have('client'); +let clientId = await I.have('client') // client == { name: 'John', email: 'john@snow.com' } ``` @@ -190,27 +190,27 @@ By default `id` property of response is taken. This behavior can be changed by s ### Parameters -* `config` +- `config` -### _requestCreate +### \_requestCreate Executes request to create a record in API. Can be replaced from a in custom helper. #### Parameters -* `factory` **any** -* `data` **any** +- `factory` **any** +- `data` **any** -### _requestDelete +### \_requestDelete Executes request to delete a record in API Can be replaced from a custom helper. #### Parameters -* `factory` **any** -* `id` **any** +- `factory` **any** +- `id` **any** ### have @@ -218,19 +218,19 @@ Generates a new record using factory and saves API request to store it. ```js // create a user -I.have('user'); +I.have('user') // create user with defined email // and receive it when inside async function -const user = await I.have('user', { email: 'user@user.com'}); +const user = await I.have('user', { email: 'user@user.com' }) // create a user with options that will not be included in the final request -I.have('user', { }, { age: 33, height: 55 }) +I.have('user', {}, { age: 33, height: 55 }) ``` #### Parameters -* `factory` **any** factory to use -* `params` **any?** predefined parameters -* `options` **any?** options for programmatically generate the attributes +- `factory` **any** factory to use +- `params` **any?** predefined parameters +- `options` **any?** options for programmatically generate the attributes Returns **[Promise][5]** @@ -240,28 +240,24 @@ Generates bunch of records and saves multiple API requests to store them. ```js // create 3 posts -I.haveMultiple('post', 3); +I.haveMultiple('post', 3) // create 3 posts by one author -I.haveMultiple('post', 3, { author: 'davert' }); +I.haveMultiple('post', 3, { author: 'davert' }) // create 3 posts by one author with options -I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' }); +I.haveMultiple('post', 3, { author: 'davert' }, { publish_date: '01.01.1997' }) ``` #### Parameters -* `factory` **any** -* `times` **any** -* `params` **any?** -* `options` **any?** +- `factory` **any** +- `times` **any** +- `params` **any?** +- `options` **any?** [1]: https://github.com/rosiejs/rosie - [2]: https://www.npmjs.com/package/faker - [3]: http://codecept.io/helpers/REST/ - [4]: https://github.com/axios/axios#request-config - [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise diff --git a/docs/helpers/Appium.md b/docs/helpers/Appium.md index 7b9fdab62..35271cea2 100644 --- a/docs/helpers/Appium.md +++ b/docs/helpers/Appium.md @@ -32,20 +32,20 @@ Launch the daemon: `appium` This helper should be configured in codecept.conf.ts or codecept.conf.js -* `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here][3] -* `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage -* `host`: (default: 'localhost') Appium host -* `port`: (default: '4723') Appium port -* `platform`: (Android or IOS), which mobile OS to use; alias to desiredCapabilities.platformName -* `restart`: restart browser or app between tests (default: true), if set to false cookies will be cleaned but browser window will be kept and for apps nothing will be changed. -* `desiredCapabilities`: \[], Appium capabilities, see below - * `platformName` - Which mobile OS platform to use - * `appPackage` - Java package of the Android app you want to run - * `appActivity` - Activity name for the Android activity you want to launch from your package. - * `deviceName`: The kind of mobile device or emulator to use - * `platformVersion`: Mobile OS version - * `app` - The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first. - * `browserName`: Name of mobile web browser to automate. Should be an empty string if automating an app instead. +- `appiumV2`: set this to true if you want to run tests with AppiumV2. See more how to setup [here][3] +- `app`: Application path. Local path or remote URL to an .ipa or .apk file, or a .zip containing one of these. Alias to desiredCapabilities.appPackage +- `host`: (default: 'localhost') Appium host +- `port`: (default: '4723') Appium port +- `platform`: (Android or IOS), which mobile OS to use; alias to desiredCapabilities.platformName +- `restart`: restart browser or app between tests (default: true), if set to false cookies will be cleaned but browser window will be kept and for apps nothing will be changed. +- `desiredCapabilities`: \[], Appium capabilities, see below + - `platformName` - Which mobile OS platform to use + - `appPackage` - Java package of the Android app you want to run + - `appActivity` - Activity name for the Android activity you want to launch from your package. + - `deviceName`: The kind of mobile device or emulator to use + - `platformVersion`: Mobile OS version + - `app` - The absolute local path or remote http URL to an .ipa or .apk file, or a .zip containing one of these. Appium will attempt to install this app binary on the appropriate device first. + - `browserName`: Name of mobile web browser to automate. Should be an empty string if automating an app instead. Example Android App: @@ -157,7 +157,7 @@ let browser = this.helpers['Appium'].browser ### Parameters -* `config` +- `config` ### runOnIOS @@ -165,35 +165,38 @@ Execute code only on iOS ```js I.runOnIOS(() => { - I.click('//UIAApplication[1]/UIAWindow[1]/UIAButton[1]'); - I.see('Hi, IOS', '~welcome'); -}); + I.click('//UIAApplication[1]/UIAWindow[1]/UIAButton[1]') + I.see('Hi, IOS', '~welcome') +}) ``` Additional filter can be applied by checking for capabilities. For instance, this code will be executed only on iPhone 5s: ```js -I.runOnIOS({deviceName: 'iPhone 5s'},() => { - // ... -}); +I.runOnIOS({ deviceName: 'iPhone 5s' }, () => { + // ... +}) ``` Also capabilities can be checked by a function. ```js -I.runOnAndroid((caps) => { - // caps is current config of desiredCapabiliites - return caps.platformVersion >= 6 -},() => { - // ... -}); +I.runOnAndroid( + (caps) => { + // caps is current config of desiredCapabiliites + return caps.platformVersion >= 6 + }, + () => { + // ... + }, +) ``` #### Parameters -* `caps` **any** -* `fn` **any** +- `caps` **any** +- `fn` **any** ### runOnAndroid @@ -201,35 +204,38 @@ Execute code only on Android ```js I.runOnAndroid(() => { - I.click('io.selendroid.testapp:id/buttonTest'); -}); + I.click('io.selendroid.testapp:id/buttonTest') +}) ``` Additional filter can be applied by checking for capabilities. For instance, this code will be executed only on Android 6.0: ```js -I.runOnAndroid({platformVersion: '6.0'},() => { - // ... -}); +I.runOnAndroid({ platformVersion: '6.0' }, () => { + // ... +}) ``` Also capabilities can be checked by a function. In this case, code will be executed only on Android >= 6. ```js -I.runOnAndroid((caps) => { - // caps is current config of desiredCapabiliites - return caps.platformVersion >= 6 -},() => { - // ... -}); +I.runOnAndroid( + (caps) => { + // caps is current config of desiredCapabiliites + return caps.platformVersion >= 6 + }, + () => { + // ... + }, +) ``` #### Parameters -* `caps` **any** -* `fn` **any** +- `caps` **any** +- `fn` **any** ### runInWeb @@ -237,9 +243,9 @@ Execute code only in Web mode. ```js I.runInWeb(() => { - I.waitForElement('#data'); - I.seeInCurrentUrl('/data'); -}); + I.waitForElement('#data') + I.seeInCurrentUrl('/data') +}) ``` ### checkIfAppIsInstalled @@ -247,12 +253,12 @@ I.runInWeb(() => { Returns app installation status. ```js -I.checkIfAppIsInstalled("com.example.android.apis"); +I.checkIfAppIsInstalled('com.example.android.apis') ``` #### Parameters -* `bundleId` **[string][5]** String ID of bundled app +- `bundleId` **[string][5]** String ID of bundled app Returns **[Promise][6]<[boolean][7]>** Appium: support only Android @@ -261,12 +267,12 @@ Returns **[Promise][6]<[boolean][7]>** Appium: support only Android Check if an app is installed. ```js -I.seeAppIsInstalled("com.example.android.apis"); +I.seeAppIsInstalled('com.example.android.apis') ``` #### Parameters -* `bundleId` **[string][5]** String ID of bundled app +- `bundleId` **[string][5]** String ID of bundled app Returns **[Promise][6]\** Appium: support only Android @@ -275,12 +281,12 @@ Returns **[Promise][6]\** Appium: support only Android Check if an app is not installed. ```js -I.seeAppIsNotInstalled("com.example.android.apis"); +I.seeAppIsNotInstalled('com.example.android.apis') ``` #### Parameters -* `bundleId` **[string][5]** String ID of bundled app +- `bundleId` **[string][5]** String ID of bundled app Returns **[Promise][6]\** Appium: support only Android @@ -289,12 +295,12 @@ Returns **[Promise][6]\** Appium: support only Android Install an app on device. ```js -I.installApp('/path/to/file.apk'); +I.installApp('/path/to/file.apk') ``` #### Parameters -* `path` **[string][5]** path to apk file +- `path` **[string][5]** path to apk file Returns **[Promise][6]\** Appium: support only Android @@ -303,22 +309,22 @@ Returns **[Promise][6]\** Appium: support only Android Remove an app from the device. ```js -I.removeApp('appName', 'com.example.android.apis'); +I.removeApp('appName', 'com.example.android.apis') ``` Appium: support only Android #### Parameters -* `appId` **[string][5]** -* `bundleId` **[string][5]?** ID of bundle +- `appId` **[string][5]** +- `bundleId` **[string][5]?** ID of bundle ### resetApp Reset the currently running app for current session. ```js -I.resetApp(); +I.resetApp() ``` ### seeCurrentActivityIs @@ -326,12 +332,12 @@ I.resetApp(); Check current activity on an Android device. ```js -I.seeCurrentActivityIs(".HomeScreenActivity") +I.seeCurrentActivityIs('.HomeScreenActivity') ``` #### Parameters -* `currentActivity` **[string][5]** +- `currentActivity` **[string][5]** Returns **[Promise][6]\** Appium: support only Android @@ -340,7 +346,7 @@ Returns **[Promise][6]\** Appium: support only Android Check whether the device is locked. ```js -I.seeDeviceIsLocked(); +I.seeDeviceIsLocked() ``` Returns **[Promise][6]\** Appium: support only Android @@ -350,7 +356,7 @@ Returns **[Promise][6]\** Appium: support only Android Check whether the device is not locked. ```js -I.seeDeviceIsUnlocked(); +I.seeDeviceIsUnlocked() ``` Returns **[Promise][6]\** Appium: support only Android @@ -360,13 +366,13 @@ Returns **[Promise][6]\** Appium: support only Android Check the device orientation ```js -I.seeOrientationIs('PORTRAIT'); +I.seeOrientationIs('PORTRAIT') I.seeOrientationIs('LANDSCAPE') ``` #### Parameters -* `orientation` **(`"LANDSCAPE"` | `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS +- `orientation` **(`"LANDSCAPE"` | `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS Returns **[Promise][6]\** @@ -375,13 +381,13 @@ Returns **[Promise][6]\** Set a device orientation. Will fail, if app will not set orientation ```js -I.setOrientation('PORTRAIT'); +I.setOrientation('PORTRAIT') I.setOrientation('LANDSCAPE') ``` #### Parameters -* `orientation` **(`"LANDSCAPE"` | `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS +- `orientation` **(`"LANDSCAPE"` | `"PORTRAIT"`)** LANDSCAPE or PORTRAITAppium: support Android and iOS ### grabAllContexts @@ -396,7 +402,7 @@ Returns **[Promise][6]<[Array][8]<[string][5]>>** Appium: support Android and iO Retrieve current context ```js -let context = await I.grabContext(); +let context = await I.grabContext() ``` Returns **[Promise][6]<([string][5] | null)>** Appium: support Android and iOS @@ -406,7 +412,7 @@ Returns **[Promise][6]<([string][5] | null)>** Appium: support Android and iOS Get current device activity. ```js -let activity = await I.grabCurrentActivity(); +let activity = await I.grabCurrentActivity() ``` Returns **[Promise][6]<[string][5]>** Appium: support only Android @@ -418,7 +424,7 @@ The actual server value will be a number. However WebdriverIO additional properties to the response object to allow easier assertions. ```js -let con = await I.grabNetworkConnection(); +let con = await I.grabNetworkConnection() ``` Returns **[Promise][6]<{}>** Appium: support only Android @@ -428,7 +434,7 @@ Returns **[Promise][6]<{}>** Appium: support only Android Get current orientation. ```js -let orientation = await I.grabOrientation(); +let orientation = await I.grabOrientation() ``` Returns **[Promise][6]<[string][5]>** Appium: support Android and iOS @@ -438,7 +444,7 @@ Returns **[Promise][6]<[string][5]>** Appium: support Android and iOS Get all the currently specified settings. ```js -let settings = await I.grabSettings(); +let settings = await I.grabSettings() ``` Returns **[Promise][6]<[string][5]>** Appium: support Android and iOS @@ -449,7 +455,7 @@ Switch to the specified context. #### Parameters -* `context` **any** the context to switch to +- `context` **any** the context to switch to ### switchToWeb @@ -458,33 +464,33 @@ If no context is provided switches to the first detected web context ```js // switch to first web context -I.switchToWeb(); +I.switchToWeb() // or set the context explicitly -I.switchToWeb('WEBVIEW_io.selendroid.testapp'); +I.switchToWeb('WEBVIEW_io.selendroid.testapp') ``` #### Parameters -* `context` **[string][5]?** +- `context` **[string][5]?** Returns **[Promise][6]\** ### switchToNative Switches to native context. -By default switches to NATIVE\_APP context unless other specified. +By default switches to NATIVE_APP context unless other specified. ```js -I.switchToNative(); +I.switchToNative() // or set context explicitly -I.switchToNative('SOME_OTHER_CONTEXT'); +I.switchToNative('SOME_OTHER_CONTEXT') ``` #### Parameters -* `context` **any?** (optional, default `null`) +- `context` **any?** (optional, default `null`) Returns **[Promise][6]\** @@ -493,15 +499,15 @@ Returns **[Promise][6]\** Start an arbitrary Android activity during a session. ```js -I.startActivity('io.selendroid.testapp', '.RegisterUserActivity'); +I.startActivity('io.selendroid.testapp', '.RegisterUserActivity') ``` Appium: support only Android #### Parameters -* `appPackage` **[string][5]** -* `appActivity` **[string][5]** +- `appPackage` **[string][5]** +- `appActivity` **[string][5]** Returns **[Promise][6]\** @@ -509,9 +515,9 @@ Returns **[Promise][6]\** Set network connection mode. -* airplane mode -* wifi mode -* data data +- airplane mode +- wifi mode +- data data ```js I.setNetworkConnection(0) // airplane mode off, wifi off, data off @@ -527,7 +533,7 @@ Appium: support only Android #### Parameters -* `value` **[number][10]** The network connection mode bitmask +- `value` **[number][10]** The network connection mode bitmask Returns **[Promise][6]<[number][10]>** @@ -536,12 +542,12 @@ Returns **[Promise][6]<[number][10]>** Update the current setting on the device ```js -I.setSettings({cyberdelia: 'open'}); +I.setSettings({ cyberdelia: 'open' }) ``` #### Parameters -* `settings` **[object][11]** objectAppium: support Android and iOS +- `settings` **[object][11]** objectAppium: support Android and iOS ### hideDeviceKeyboard @@ -549,19 +555,19 @@ Hide the keyboard. ```js // taps outside to hide keyboard per default -I.hideDeviceKeyboard(); -I.hideDeviceKeyboard('tapOutside'); +I.hideDeviceKeyboard() +I.hideDeviceKeyboard('tapOutside') // or by pressing key -I.hideDeviceKeyboard('pressKey', 'Done'); +I.hideDeviceKeyboard('pressKey', 'Done') ``` Appium: support Android and iOS #### Parameters -* `strategy` **(`"tapOutside"` | `"pressKey"`)?** Desired strategy to close keyboard (β€˜tapOutside’ or β€˜pressKey’) -* `key` **[string][5]?** Optional key +- `strategy` **(`"tapOutside"` | `"pressKey"`)?** Desired strategy to close keyboard (β€˜tapOutside’ or β€˜pressKey’) +- `key` **[string][5]?** Optional key ### sendDeviceKeyEvent @@ -569,12 +575,12 @@ Send a key event to the device. List of keys: [https://developer.android.com/reference/android/view/KeyEvent.html][12] ```js -I.sendDeviceKeyEvent(3); +I.sendDeviceKeyEvent(3) ``` #### Parameters -* `keyValue` **[number][10]** Device specific key value +- `keyValue` **[number][10]** Device specific key value Returns **[Promise][6]\** Appium: support only Android @@ -583,7 +589,7 @@ Returns **[Promise][6]\** Appium: support only Android Open the notifications panel on the device. ```js -I.openNotifications(); +I.openNotifications() ``` Returns **[Promise][6]\** Appium: support only Android @@ -597,13 +603,13 @@ application on the device. [See complete documentation][13] ```js -I.makeTouchAction("~buttonStartWebviewCD", 'tap'); +I.makeTouchAction('~buttonStartWebviewCD', 'tap') ``` #### Parameters -* `locator` -* `action` +- `locator` +- `action` Returns **[Promise][6]\** Appium: support Android and iOS @@ -612,14 +618,14 @@ Returns **[Promise][6]\** Appium: support Android and iOS Taps on element. ```js -I.tap("~buttonStartWebviewCD"); +I.tap('~buttonStartWebviewCD') ``` Shortcut for `makeTouchAction` #### Parameters -* `locator` **any** +- `locator` **any** Returns **[Promise][6]\** @@ -628,18 +634,18 @@ Returns **[Promise][6]\** Perform a swipe on the screen or an element. ```js -let locator = "#io.selendroid.testapp:id/LinearLayout1"; -I.swipe(locator, 800, 1200, 1000); +let locator = '#io.selendroid.testapp:id/LinearLayout1' +I.swipe(locator, 800, 1200, 1000) ``` [See complete reference][14] #### Parameters -* `locator` **([string][5] | [object][11])** -* `xoffset` **[number][10]** -* `yoffset` **[number][10]** -* `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) +- `locator` **([string][5] | [object][11])** +- `xoffset` **[number][10]** +- `yoffset` **[number][10]** +- `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) Returns **[Promise][6]\** Appium: support Android and iOS @@ -648,30 +654,30 @@ Returns **[Promise][6]\** Appium: support Android and iOS Perform a swipe on the screen. ```js -I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 }); +I.performSwipe({ x: 300, y: 100 }, { x: 200, y: 100 }) ``` #### Parameters -* `from` **[object][11]** -* `to` **[object][11]** Appium: support Android and iOS +- `from` **[object][11]** +- `to` **[object][11]** Appium: support Android and iOS ### swipeDown Perform a swipe down on an element. ```js -let locator = "#io.selendroid.testapp:id/LinearLayout1"; -I.swipeDown(locator); // simple swipe -I.swipeDown(locator, 500); // set speed -I.swipeDown(locator, 1200, 1000); // set offset and speed +let locator = '#io.selendroid.testapp:id/LinearLayout1' +I.swipeDown(locator) // simple swipe +I.swipeDown(locator, 500) // set speed +I.swipeDown(locator, 1200, 1000) // set offset and speed ``` #### Parameters -* `locator` **([string][5] | [object][11])** -* `yoffset` **[number][10]?** (optional) (optional, default `1000`) -* `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) +- `locator` **([string][5] | [object][11])** +- `yoffset` **[number][10]?** (optional) (optional, default `1000`) +- `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) Returns **[Promise][6]\** Appium: support Android and iOS @@ -680,17 +686,17 @@ Returns **[Promise][6]\** Appium: support Android and iOS Perform a swipe left on an element. ```js -let locator = "#io.selendroid.testapp:id/LinearLayout1"; -I.swipeLeft(locator); // simple swipe -I.swipeLeft(locator, 500); // set speed -I.swipeLeft(locator, 1200, 1000); // set offset and speed +let locator = '#io.selendroid.testapp:id/LinearLayout1' +I.swipeLeft(locator) // simple swipe +I.swipeLeft(locator, 500) // set speed +I.swipeLeft(locator, 1200, 1000) // set offset and speed ``` #### Parameters -* `locator` **([string][5] | [object][11])** -* `xoffset` **[number][10]?** (optional) (optional, default `1000`) -* `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) +- `locator` **([string][5] | [object][11])** +- `xoffset` **[number][10]?** (optional) (optional, default `1000`) +- `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) Returns **[Promise][6]\** Appium: support Android and iOS @@ -699,17 +705,17 @@ Returns **[Promise][6]\** Appium: support Android and iOS Perform a swipe right on an element. ```js -let locator = "#io.selendroid.testapp:id/LinearLayout1"; -I.swipeRight(locator); // simple swipe -I.swipeRight(locator, 500); // set speed -I.swipeRight(locator, 1200, 1000); // set offset and speed +let locator = '#io.selendroid.testapp:id/LinearLayout1' +I.swipeRight(locator) // simple swipe +I.swipeRight(locator, 500) // set speed +I.swipeRight(locator, 1200, 1000) // set offset and speed ``` #### Parameters -* `locator` **([string][5] | [object][11])** -* `xoffset` **[number][10]?** (optional) (optional, default `1000`) -* `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) +- `locator` **([string][5] | [object][11])** +- `xoffset` **[number][10]?** (optional) (optional, default `1000`) +- `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) Returns **[Promise][6]\** Appium: support Android and iOS @@ -718,17 +724,17 @@ Returns **[Promise][6]\** Appium: support Android and iOS Perform a swipe up on an element. ```js -let locator = "#io.selendroid.testapp:id/LinearLayout1"; -I.swipeUp(locator); // simple swipe -I.swipeUp(locator, 500); // set speed -I.swipeUp(locator, 1200, 1000); // set offset and speed +let locator = '#io.selendroid.testapp:id/LinearLayout1' +I.swipeUp(locator) // simple swipe +I.swipeUp(locator, 500) // set speed +I.swipeUp(locator, 1200, 1000) // set offset and speed ``` #### Parameters -* `locator` **([string][5] | [object][11])** -* `yoffset` **[number][10]?** (optional) (optional, default `1000`) -* `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) +- `locator` **([string][5] | [object][11])** +- `yoffset` **[number][10]?** (optional) (optional, default `1000`) +- `speed` **[number][10]** (optional), 1000 by default (optional, default `1000`) Returns **[Promise][6]\** Appium: support Android and iOS @@ -738,22 +744,23 @@ Perform a swipe in selected direction on an element to searchable element. ```js I.swipeTo( - "android.widget.CheckBox", // searchable element - "//android.widget.ScrollView/android.widget.LinearLayout", // scroll element - "up", // direction - 30, - 100, - 500); + 'android.widget.CheckBox', // searchable element + '//android.widget.ScrollView/android.widget.LinearLayout', // scroll element + 'up', // direction + 30, + 100, + 500, +) ``` #### Parameters -* `searchableLocator` **[string][5]** -* `scrollLocator` **[string][5]** -* `direction` **[string][5]** -* `timeout` **[number][10]** -* `offset` **[number][10]** -* `speed` **[number][10]** +- `searchableLocator` **[string][5]** +- `scrollLocator` **[string][5]** +- `direction` **[string][5]** +- `timeout` **[number][10]** +- `offset` **[number][10]** +- `speed` **[number][10]** Returns **[Promise][6]\** Appium: support Android and iOS @@ -763,45 +770,50 @@ Performs a specific touch action. The action object need to contain the action name, x/y coordinates ```js -I.touchPerform([{ +I.touchPerform([ + { action: 'press', options: { x: 100, - y: 200 - } -}, {action: 'release'}]) - -I.touchPerform([{ - action: 'tap', - options: { - element: '1', // json web element was queried before - x: 10, // x offset - y: 20, // y offset - count: 1 // number of touches - } -}]); + y: 200, + }, + }, + { action: 'release' }, +]) + +I.touchPerform([ + { + action: 'tap', + options: { + element: '1', // json web element was queried before + x: 10, // x offset + y: 20, // y offset + count: 1, // number of touches + }, + }, +]) ``` Appium: support Android and iOS #### Parameters -* `actions` **[Array][8]** Array of touch actions +- `actions` **[Array][8]** Array of touch actions ### pullFile Pulls a file from the device. ```js -I.pullFile('/storage/emulated/0/DCIM/logo.png', 'my/path'); +I.pullFile('/storage/emulated/0/DCIM/logo.png', 'my/path') // save file to output dir -I.pullFile('/storage/emulated/0/DCIM/logo.png', output_dir); +I.pullFile('/storage/emulated/0/DCIM/logo.png', output_dir) ``` #### Parameters -* `path` **[string][5]** -* `dest` **[string][5]** +- `path` **[string][5]** +- `dest` **[string][5]** Returns **[Promise][6]<[string][5]>** Appium: support Android and iOS @@ -810,7 +822,7 @@ Returns **[Promise][6]<[string][5]>** Appium: support Android and iOS Perform a shake action on the device. ```js -I.shakeDevice(); +I.shakeDevice() ``` Returns **[Promise][6]\** Appium: support only iOS @@ -827,12 +839,12 @@ See corresponding [webdriverio reference][15]. #### Parameters -* `x` -* `y` -* `duration` -* `radius` -* `rotation` -* `touchCount` +- `x` +- `y` +- `duration` +- `radius` +- `rotation` +- `touchCount` Returns **[Promise][6]\** Appium: support only iOS @@ -844,8 +856,8 @@ See corresponding [webdriverio reference][16]. #### Parameters -* `id` -* `value` +- `id` +- `value` Returns **[Promise][6]\** Appium: support only iOS @@ -854,14 +866,14 @@ Returns **[Promise][6]\** Appium: support only iOS Simulate Touch ID with either valid (match == true) or invalid (match == false) fingerprint. ```js -I.touchId(); // simulates valid fingerprint -I.touchId(true); // simulates valid fingerprint -I.touchId(false); // simulates invalid fingerprint +I.touchId() // simulates valid fingerprint +I.touchId(true) // simulates valid fingerprint +I.touchId(false) // simulates invalid fingerprint ``` #### Parameters -* `match` +- `match` Returns **[Promise][6]\** Appium: support only iOS TODO: not tested @@ -871,7 +883,7 @@ TODO: not tested Close the given application. ```js -I.closeApp(); +I.closeApp() ``` Returns **[Promise][6]\** Appium: support both Android and iOS @@ -882,15 +894,15 @@ Appends text to a input field or textarea. Field is located by name, label, CSS or XPath ```js -I.appendField('#myTextField', 'appended'); +I.appendField('#myTextField', 'appended') // typing secret -I.appendField('password', secret('123456')); +I.appendField('password', secret('123456')) ``` #### Parameters -* `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator -* `value` **[string][5]** text value to append. +- `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator +- `value` **[string][5]** text value to append. Returns **void** automatically synchronized promise through #recorder @@ -902,15 +914,15 @@ Element is located by label or name or CSS or XPath. The second parameter is a context (CSS or XPath locator) to narrow the search. ```js -I.checkOption('#agree'); -I.checkOption('I Agree to Terms and Conditions'); -I.checkOption('agree', '//form'); +I.checkOption('#agree') +I.checkOption('I Agree to Terms and Conditions') +I.checkOption('agree', '//form') ``` #### Parameters -* `field` **([string][5] | [object][11])** checkbox located by label | name | CSS | XPath | strict locator. -* `context` **([string][5]? | [object][11])** (optional, `null` by default) element located by CSS | XPath | strict locator. (optional, default `null`) +- `field` **([string][5] | [object][11])** checkbox located by label | name | CSS | XPath | strict locator. +- `context` **([string][5]? | [object][11])** (optional, `null` by default) element located by CSS | XPath | strict locator. (optional, default `null`) Returns **void** automatically synchronized promise through #recorder @@ -925,23 +937,23 @@ The second parameter is a context (CSS or XPath locator) to narrow the search. ```js // simple link -I.click('Logout'); +I.click('Logout') // button of form -I.click('Submit'); +I.click('Submit') // CSS button -I.click('#form input[type=submit]'); +I.click('#form input[type=submit]') // XPath -I.click('//form/*[@type=submit]'); +I.click('//form/*[@type=submit]') // link in context -I.click('Logout', '#nav'); +I.click('Logout', '#nav') // using strict locator -I.click({css: 'nav a.login'}); +I.click({ css: 'nav a.login' }) ``` #### Parameters -* `locator` **([string][5] | [object][11])** clickable link or button located by text, or any element located by CSS|XPath|strict locator. -* `context` **([string][5]? | [object][11] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`) +- `locator` **([string][5] | [object][11])** clickable link or button located by text, or any element located by CSS|XPath|strict locator. +- `context` **([string][5]? | [object][11] | null)** (optional, `null` by default) element to search in CSS|XPath|Strict locator. (optional, default `null`) Returns **void** automatically synchronized promise through #recorder @@ -950,14 +962,14 @@ Returns **void** automatically synchronized promise through #recorder Verifies that the specified checkbox is not checked. ```js -I.dontSeeCheckboxIsChecked('#agree'); // located by ID -I.dontSeeCheckboxIsChecked('I agree to terms'); // located by label -I.dontSeeCheckboxIsChecked('agree'); // located by name +I.dontSeeCheckboxIsChecked('#agree') // located by ID +I.dontSeeCheckboxIsChecked('I agree to terms') // located by label +I.dontSeeCheckboxIsChecked('agree') // located by name ``` #### Parameters -* `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. +- `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. Returns **void** automatically synchronized promise through #recorder @@ -966,12 +978,12 @@ Returns **void** automatically synchronized promise through #recorder Opposite to `seeElement`. Checks that element is not visible (or in DOM) ```js -I.dontSeeElement('.modal'); // modal is not shown +I.dontSeeElement('.modal') // modal is not shown ``` #### Parameters -* `locator` **([string][5] | [object][11])** located by CSS|XPath|Strict locator. +- `locator` **([string][5] | [object][11])** located by CSS|XPath|Strict locator. Returns **void** automatically synchronized promise through #recorder @@ -981,14 +993,14 @@ Checks that value of input field or textarea doesn't equal to given value Opposite to `seeInField`. ```js -I.dontSeeInField('email', 'user@user.com'); // field by name -I.dontSeeInField({ css: 'form input.email' }, 'user@user.com'); // field by CSS +I.dontSeeInField('email', 'user@user.com') // field by name +I.dontSeeInField({ css: 'form input.email' }, 'user@user.com') // field by CSS ``` #### Parameters -* `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. -* `value` **([string][5] | [object][11])** value to check. +- `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. +- `value` **([string][5] | [object][11])** value to check. Returns **void** automatically synchronized promise through #recorder @@ -998,14 +1010,14 @@ 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 +I.dontSee('Login') // assume we are already logged in. +I.dontSee('Login', '.nav') // no login inside .nav element ``` #### Parameters -* `text` **[string][5]** which is not present. -* `context` **([string][5] | [object][11])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search. (optional, default `null`) +- `text` **[string][5]** which is not present. +- `context` **([string][5] | [object][11])?** (optional) element located by CSS|XPath|strict locator in which to perfrom search. (optional, default `null`) Returns **void** automatically synchronized promise through #recorder @@ -1016,19 +1028,19 @@ Field is located by name, label, CSS, or XPath. ```js // by label -I.fillField('Email', 'hello@world.com'); +I.fillField('Email', 'hello@world.com') // by name -I.fillField('password', secret('123456')); +I.fillField('password', secret('123456')) // by CSS -I.fillField('form#login input[name=username]', 'John'); +I.fillField('form#login input[name=username]', 'John') // or by strict locator -I.fillField({css: 'form#login input[name=username]'}, 'John'); +I.fillField({ css: 'form#login input[name=username]' }, 'John') ``` #### Parameters -* `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. -* `value` **([string][5] | [object][11])** text value to fill. +- `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. +- `value` **([string][5] | [object][11])** text value to fill. Returns **void** automatically synchronized promise through #recorder @@ -1038,12 +1050,12 @@ Retrieves all texts from an element located by CSS or XPath and returns it to te Resumes test execution, so **should be used inside async with `await`** operator. ```js -let pins = await I.grabTextFromAll('#pin li'); +let pins = await I.grabTextFromAll('#pin li') ``` #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. Returns **[Promise][6]<[Array][8]<[string][5]>>** attribute value @@ -1053,14 +1065,14 @@ Retrieves a text from an element located by CSS or XPath and returns it to test. Resumes test execution, so **should be used inside async with `await`** operator. ```js -let pin = await I.grabTextFrom('#pin'); +let pin = await I.grabTextFrom('#pin') ``` If multiple elements found returns first element. #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. Returns **[Promise][6]<[string][5]>** attribute value @@ -1070,12 +1082,12 @@ Grab number of visible elements by locator. Resumes test execution, so **should be used inside async function with `await`** operator. ```js -let numOfElements = await I.grabNumberOfVisibleElements('p'); +let numOfElements = await I.grabNumberOfVisibleElements('p') ``` #### Parameters -* `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator. +- `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator. Returns **[Promise][6]<[number][10]>** number of visible elements @@ -1088,13 +1100,13 @@ Resumes test execution, so **should be used inside async with `await`** operator If more than one element is found - attribute of first element is returned. ```js -let hint = await I.grabAttributeFrom('#tooltip', 'title'); +let hint = await I.grabAttributeFrom('#tooltip', 'title') ``` #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. -* `attr` **[string][5]** attribute name. +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `attr` **[string][5]** attribute name. Returns **[Promise][6]<[string][5]>** attribute value @@ -1105,13 +1117,13 @@ Retrieves an array of attributes from elements located by CSS or XPath and retur Resumes test execution, so **should be used inside async with `await`** operator. ```js -let hints = await I.grabAttributeFromAll('.tooltip', 'title'); +let hints = await I.grabAttributeFromAll('.tooltip', 'title') ``` #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. -* `attr` **[string][5]** attribute name. +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `attr` **[string][5]** attribute name. Returns **[Promise][6]<[Array][8]<[string][5]>>** attribute value @@ -1121,12 +1133,12 @@ Retrieves an array of value from a form located by CSS or XPath and returns it t Resumes test execution, so **should be used inside async function with `await`** operator. ```js -let inputs = await I.grabValueFromAll('//form/input'); +let inputs = await I.grabValueFromAll('//form/input') ``` #### Parameters -* `locator` **([string][5] | [object][11])** field located by label|name|CSS|XPath|strict locator. +- `locator` **([string][5] | [object][11])** field located by label|name|CSS|XPath|strict locator. Returns **[Promise][6]<[Array][8]<[string][5]>>** attribute value @@ -1137,12 +1149,12 @@ Resumes test execution, so **should be used inside async function with `await`** If more than one element is found - value of first element is returned. ```js -let email = await I.grabValueFrom('input[name=email]'); +let email = await I.grabValueFrom('input[name=email]') ``` #### Parameters -* `locator` **([string][5] | [object][11])** field located by label|name|CSS|XPath|strict locator. +- `locator` **([string][5] | [object][11])** field located by label|name|CSS|XPath|strict locator. Returns **[Promise][6]<[string][5]>** attribute value @@ -1152,12 +1164,12 @@ Saves a screenshot to ouput folder (set in codecept.conf.ts or codecept.conf.js) Filename is relative to output folder. ```js -I.saveScreenshot('debug.png'); +I.saveScreenshot('debug.png') ``` #### Parameters -* `fileName` **[string][5]** file name to save. +- `fileName` **[string][5]** file name to save. Returns **[Promise][6]\** @@ -1166,15 +1178,15 @@ Returns **[Promise][6]\** Scroll element into viewport. ```js -I.scrollIntoView('#submit'); -I.scrollIntoView('#submit', true); -I.scrollIntoView('#submit', { behavior: "smooth", block: "center", inline: "center" }); +I.scrollIntoView('#submit') +I.scrollIntoView('#submit', true) +I.scrollIntoView('#submit', { behavior: 'smooth', block: 'center', inline: 'center' }) ``` #### Parameters -* `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator. -* `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][7])** either alignToTop=true|false or scrollIntoViewOptions. See [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][17]. +- `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator. +- `scrollIntoViewOptions` **(ScrollIntoViewOptions | [boolean][7])** either alignToTop=true|false or scrollIntoViewOptions. See [https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView][17]. Returns **void** automatically synchronized promise through #recorderSupported only for web testing @@ -1183,14 +1195,14 @@ Returns **void** automatically synchronized promise through #recorderSupported o Verifies that the specified checkbox is checked. ```js -I.seeCheckboxIsChecked('Agree'); -I.seeCheckboxIsChecked('#agree'); // I suppose user agreed to terms -I.seeCheckboxIsChecked({css: '#signup_form input[type=checkbox]'}); +I.seeCheckboxIsChecked('Agree') +I.seeCheckboxIsChecked('#agree') // I suppose user agreed to terms +I.seeCheckboxIsChecked({ css: '#signup_form input[type=checkbox]' }) ``` #### Parameters -* `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. +- `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. Returns **void** automatically synchronized promise through #recorder @@ -1200,12 +1212,12 @@ Checks that a given Element is visible Element is located by CSS or XPath. ```js -I.seeElement('#modal'); +I.seeElement('#modal') ``` #### Parameters -* `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator. +- `locator` **([string][5] | [object][11])** located by CSS|XPath|strict locator. Returns **void** automatically synchronized promise through #recorder @@ -1215,16 +1227,16 @@ Checks that the given input field or textarea equals to given value. For fuzzy locators, fields are matched by label text, the "name" attribute, CSS, and XPath. ```js -I.seeInField('Username', 'davert'); -I.seeInField({css: 'form textarea'},'Type your comment here'); -I.seeInField('form input[type=hidden]','hidden_value'); -I.seeInField('#searchform input','Search'); +I.seeInField('Username', 'davert') +I.seeInField({ css: 'form textarea' }, 'Type your comment here') +I.seeInField('form input[type=hidden]', 'hidden_value') +I.seeInField('#searchform input', 'Search') ``` #### Parameters -* `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. -* `value` **([string][5] | [object][11])** value to check. +- `field` **([string][5] | [object][11])** located by label|name|CSS|XPath|strict locator. +- `value` **([string][5] | [object][11])** value to check. Returns **void** automatically synchronized promise through #recorder @@ -1234,15 +1246,15 @@ 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 -I.see('Register', {css: 'form.register'}); // use strict locator +I.see('Welcome') // text welcome on a page +I.see('Welcome', '.content') // text inside .content div +I.see('Register', { css: 'form.register' }) // use strict locator ``` #### Parameters -* `text` **[string][5]** expected on page. -* `context` **([string][5]? | [object][11])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text. (optional, default `null`) +- `text` **[string][5]** expected on page. +- `context` **([string][5]? | [object][11])** (optional, `null` by default) element located by CSS|Xpath|strict locator in which to search for text. (optional, default `null`) Returns **void** automatically synchronized promise through #recorder @@ -1253,24 +1265,24 @@ Field is searched by label | name | CSS | XPath. Option is selected by visible text or by value. ```js -I.selectOption('Choose Plan', 'Monthly'); // select by label -I.selectOption('subscription', 'Monthly'); // match option by text -I.selectOption('subscription', '0'); // or by value -I.selectOption('//form/select[@name=account]','Premium'); -I.selectOption('form select[name=account]', 'Premium'); -I.selectOption({css: 'form select[name=account]'}, 'Premium'); +I.selectOption('Choose Plan', 'Monthly') // select by label +I.selectOption('subscription', 'Monthly') // match option by text +I.selectOption('subscription', '0') // or by value +I.selectOption('//form/select[@name=account]', 'Premium') +I.selectOption('form select[name=account]', 'Premium') +I.selectOption({ css: 'form select[name=account]' }, 'Premium') ``` Provide an array for the second argument to select multiple options. ```js -I.selectOption('Which OS do you use?', ['Android', 'iOS']); +I.selectOption('Which OS do you use?', ['Android', 'iOS']) ``` #### Parameters -* `select` **([string][5] | [object][11])** field located by label|name|CSS|XPath|strict locator. -* `option` **([string][5] | [Array][8]\)** visible text or value of option. +- `select` **([string][5] | [object][11])** field located by label|name|CSS|XPath|strict locator. +- `option` **([string][5] | [Array][8]\)** visible text or value of option. Returns **void** automatically synchronized promise through #recorderSupported only for web testing @@ -1280,14 +1292,14 @@ Waits for element to be present on page (by default waits for 1sec). Element can be located by CSS or XPath. ```js -I.waitForElement('.btn.continue'); -I.waitForElement('.btn.continue', 5); // wait for 5 secs +I.waitForElement('.btn.continue') +I.waitForElement('.btn.continue', 5) // wait for 5 secs ``` #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. -* `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait (optional, default `null`) +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `sec` **[number][10]?** (optional, `1` by default) time in seconds to wait (optional, default `null`) Returns **void** automatically synchronized promise through #recorder @@ -1297,13 +1309,13 @@ Waits for an element to become visible on a page (by default waits for 1sec). Element can be located by CSS or XPath. ```js -I.waitForVisible('#popup'); +I.waitForVisible('#popup') ``` #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. -* `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`) +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`) Returns **void** automatically synchronized promise through #recorder @@ -1313,13 +1325,13 @@ Waits for an element to be removed or become invisible on a page (by default wai Element can be located by CSS or XPath. ```js -I.waitForInvisible('#popup'); +I.waitForInvisible('#popup') ``` #### Parameters -* `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. -* `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`) +- `locator` **([string][5] | [object][11])** element located by CSS|XPath|strict locator. +- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`) Returns **void** automatically synchronized promise through #recorder @@ -1330,48 +1342,32 @@ Element can be located by CSS or XPath. Narrow down search results by providing context. ```js -I.waitForText('Thank you, form has been submitted'); -I.waitForText('Thank you, form has been submitted', 5, '#modal'); +I.waitForText('Thank you, form has been submitted') +I.waitForText('Thank you, form has been submitted', 5, '#modal') ``` #### Parameters -* `text` **[string][5]** to wait for. -* `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`) -* `context` **([string][5] | [object][11])?** (optional) element located by CSS|XPath|strict locator. (optional, default `null`) +- `text` **[string][5]** to wait for. +- `sec` **[number][10]** (optional, `1` by default) time in seconds to wait (optional, default `1`) +- `context` **([string][5] | [object][11])?** (optional) element located by CSS|XPath|strict locator. (optional, default `null`) Returns **void** automatically synchronized promise through #recorder [1]: http://codecept.io/helpers/WebDriver/ - [2]: https://appium.io/docs/en/2.1/ - [3]: https://codecept.io/mobile/#setting-up - [4]: https://github.com/appium/appium/blob/master/packages/appium/docs/en/guides/caps.md - [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String - [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise - [7]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean - [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array - [9]: https://webdriver.io/docs/api/chromium/#setnetworkconnection - [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number - [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - [12]: https://developer.android.com/reference/android/view/KeyEvent.html - [13]: http://webdriver.io/api/mobile/touchAction.html - [14]: http://webdriver.io/api/mobile/swipe.html - [15]: http://webdriver.io/api/mobile/rotate.html - [16]: http://webdriver.io/api/mobile/setImmediateValue.html - [17]: https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView diff --git a/docs/helpers/Detox.md b/docs/helpers/Detox.md index 4d5c46204..bfe37c6aa 100644 --- a/docs/helpers/Detox.md +++ b/docs/helpers/Detox.md @@ -6,7 +6,6 @@ title: Detox # Detox - ## Detox @@ -81,15 +80,15 @@ It's important to specify a package name under `require` section and current det 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 @@ -97,27 +96,27 @@ Appends text into the field. A field can be located by text, accessibility id, id. ```js -I.appendField('name', 'davert'); +I.appendField('name', 'davert') ``` #### Parameters -* `field` **([string][5] | [object][6])** -* `value` **[string][5]** +- `field` **([string][5] | [object][6])** +- `value` **[string][5]** ### checkIfElementExists Checks if an element exists. ```js -I.checkIfElementExists('~edit'); // located by accessibility id -I.checkIfElementExists('~edit', '#menu'); // element inside #menu +I.checkIfElementExists('~edit') // located by accessibility id +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 @@ -125,12 +124,12 @@ Clears a text field. A field can be located by text, accessibility id, id. ```js -I.clearField('~name'); +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 @@ -142,17 +141,17 @@ The second parameter is a context (id | type | accessibility id) to narrow the s Same as [tap][7] ```js -I.click('Login'); // locate by text -I.click('~nav-1'); // locate by accessibility label -I.click('#user'); // locate by id -I.click('Login', '#nav'); // locate by text inside #nav -I.click({ ios: 'Save', android: 'SAVE' }, '#main'); // different texts on iOS and Android +I.click('Login') // locate by text +I.click('~nav-1') // locate by accessibility label +I.click('#user') // locate by id +I.click('Login', '#nav') // locate by text inside #nav +I.click({ ios: 'Save', android: 'SAVE' }, '#main') // different texts on iOS and Android ``` #### 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 @@ -160,15 +159,15 @@ Performs click on element with horizontal and vertical offset. An element is located by text, id, accessibility id. ```js -I.clickAtPoint('Save', 10, 10); -I.clickAtPoint('~save', 10, 10); // locate by accessibility id +I.clickAtPoint('Save', 10, 10) +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 @@ -176,15 +175,15 @@ Checks text not to be visible. Use second parameter to narrow down the search. ```js -I.dontSee('Record created'); -I.dontSee('Record updated', '#message'); -I.dontSee('Record deleted', '~message'); +I.dontSee('Record created') +I.dontSee('Record updated', '#message') +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 @@ -192,14 +191,14 @@ Checks that element is not visible. Use second parameter to narrow down the search. ```js -I.dontSeeElement('~edit'); // located by accessibility id -I.dontSeeElement('~edit', '#menu'); // element inside #menu +I.dontSeeElement('~edit') // located by accessibility id +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 @@ -207,14 +206,14 @@ Checks that element not exists. Use second parameter to narrow down the search. ```js -I.dontSeeElementExist('~edit'); // located by accessibility id -I.dontSeeElementExist('~edit', '#menu'); // element inside #menu +I.dontSeeElementExist('~edit') // located by accessibility id +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 @@ -222,22 +221,22 @@ Fills in text field in an app. A field can be located by text, accessibility id, id. ```js -I.fillField('Username', 'davert'); -I.fillField('~name', 'davert'); -I.fillField({ android: 'NAME', ios: 'name' }, 'davert'); +I.fillField('Username', 'davert') +I.fillField('~name', 'davert') +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 Goes back on Android ```js -I.goBack(); // on Android only +I.goBack() // on Android only ``` ### grabPlatform @@ -245,7 +244,7 @@ I.goBack(); // on Android only Grab the device platform ```js -const platform = await I.grabPlatform(); +const platform = await I.grabPlatform() ``` ### installApp @@ -254,7 +253,7 @@ Installs a configured application. Application is installed by default. ```js -I.installApp(); +I.installApp() ``` ### launchApp @@ -262,7 +261,7 @@ I.installApp(); Launches an application. If application instance already exists, use [relaunchApp][9]. ```js -I.launchApp(); +I.launchApp() ``` ### longPress @@ -270,16 +269,16 @@ I.launchApp(); Taps an element and holds for a requested time. ```js -I.longPress('Login', 2); // locate by text, hold for 2 seconds -I.longPress('~nav', 1); // locate by accessibility label, hold for second -I.longPress('Update', 2, '#menu'); // locate by text inside #menu, hold for 2 seconds +I.longPress('Login', 2) // locate by text, hold for 2 seconds +I.longPress('~nav', 1) // locate by accessibility label, hold for second +I.longPress('Update', 2, '#menu') // locate by text inside #menu, hold for 2 seconds ``` #### 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 @@ -290,24 +289,24 @@ Set the number of taps in second argument. Optionally define the context element by third argument. ```js -I.multiTap('Login', 2); // locate by text -I.multiTap('~nav', 2); // locate by accessibility label -I.multiTap('#user', 2); // locate by id -I.multiTap('Update', 2, '#menu'); // locate by id +I.multiTap('Login', 2) // locate by text +I.multiTap('~nav', 2) // locate by accessibility label +I.multiTap('#user', 2) // locate by id +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 Relaunches an application. ```js -I.relaunchApp(); +I.relaunchApp() ``` ### runOnAndroid @@ -316,14 +315,14 @@ Execute code only on Android ```js I.runOnAndroid(() => { - I.click('Button'); - I.see('Hi, Android'); -}); + I.click('Button') + I.see('Hi, Android') +}) ``` #### Parameters -* `fn` **[Function][10]** a function which will be executed on android +- `fn` **[Function][10]** a function which will be executed on android ### runOnIOS @@ -331,62 +330,62 @@ Execute code only on iOS ```js I.runOnIOS(() => { - I.click('Button'); - I.see('Hi, IOS'); -}); + I.click('Button') + I.see('Hi, IOS') +}) ``` #### Parameters -* `fn` **[Function][10]** a function which will be executed on iOS +- `fn` **[Function][10]** a function which will be executed on iOS ### saveScreenshot Saves a screenshot to the output dir ```js -I.saveScreenshot('main-window.png'); +I.saveScreenshot('main-window.png') ``` #### Parameters -* `name` **[string][5]** +- `name` **[string][5]** ### scrollDown Scrolls to the bottom of an element. ```js -I.scrollDown('#container'); +I.scrollDown('#container') ``` #### Parameters -* `locator` **([string][5] | [object][6])** +- `locator` **([string][5] | [object][6])** ### scrollLeft Scrolls to the left of an element. ```js -I.scrollLeft('#container'); +I.scrollLeft('#container') ``` #### Parameters -* `locator` **([string][5] | [object][6])** +- `locator` **([string][5] | [object][6])** ### scrollRight Scrolls to the right of an element. ```js -I.scrollRight('#container'); +I.scrollRight('#container') ``` #### Parameters -* `locator` **([string][5] | [object][6])** +- `locator` **([string][5] | [object][6])** ### scrollToElement @@ -394,22 +393,22 @@ 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 Scrolls to the top of an element. ```js -I.scrollUp('#container'); +I.scrollUp('#container') ``` #### Parameters -* `locator` **([string][5] | [object][6])** +- `locator` **([string][5] | [object][6])** ### see @@ -417,15 +416,15 @@ Checks text to be visible. Use second parameter to narrow down the search. ```js -I.see('Record created'); -I.see('Record updated', '#message'); -I.see('Record deleted', '~message'); +I.see('Record created') +I.see('Record updated', '#message') +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 @@ -433,14 +432,14 @@ Checks for visibility of an element. Use second parameter to narrow down the search. ```js -I.seeElement('~edit'); // located by accessibility id -I.seeElement('~edit', '#menu'); // element inside #menu +I.seeElement('~edit') // located by accessibility id +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 @@ -448,21 +447,21 @@ Checks for existence of an element. An element can be visible or not. Use second parameter to narrow down the search. ```js -I.seeElementExists('~edit'); // located by accessibility id -I.seeElementExists('~edit', '#menu'); // element inside #menu +I.seeElementExists('~edit') // located by accessibility id +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 Switches device to landscape orientation ```js -I.setLandscapeOrientation(); +I.setLandscapeOrientation() ``` ### setPortraitOrientation @@ -470,7 +469,7 @@ I.setLandscapeOrientation(); Switches device to portrait orientation ```js -I.setPortraitOrientation(); +I.setPortraitOrientation() ``` ### shakeDevice @@ -478,7 +477,7 @@ I.setPortraitOrientation(); Shakes the device. ```js -I.shakeDevice(); +I.shakeDevice() ``` ### swipeDown @@ -487,13 +486,13 @@ Performs a swipe up inside an element. Can be `slow` or `fast` swipe. ```js -I.swipeUp('#container'); +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 @@ -501,13 +500,13 @@ Performs a swipe up inside an element. Can be `slow` or `fast` swipe. ```js -I.swipeUp('#container'); +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 @@ -515,13 +514,13 @@ Performs a swipe up inside an element. Can be `slow` or `fast` swipe. ```js -I.swipeUp('#container'); +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 @@ -529,13 +528,13 @@ Performs a swipe up inside an element. Can be `slow` or `fast` swipe. ```js -I.swipeUp('#container'); +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 @@ -547,17 +546,17 @@ The second parameter is a context element to narrow the search. Same as [click][11] ```js -I.tap('Login'); // locate by text -I.tap('~nav-1'); // locate by accessibility label -I.tap('#user'); // locate by id -I.tap('Login', '#nav'); // locate by text inside #nav -I.tap({ ios: 'Save', android: 'SAVE' }, '#main'); // different texts on iOS and Android +I.tap('Login') // locate by text +I.tap('~nav-1') // locate by accessibility label +I.tap('#user') // locate by id +I.tap('Login', '#nav') // locate by text inside #nav +I.tap({ ios: 'Save', android: 'SAVE' }, '#main') // different texts on iOS and Android ``` #### 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 @@ -567,14 +566,14 @@ Element can be located by its label The second parameter is a context (id | type | accessibility id) to narrow the search. ```js -I.tapByLabel('Login'); // locate by text -I.tapByLabel('Login', '#nav'); // locate by text inside #nav +I.tapByLabel('Login') // locate by text +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 @@ -582,84 +581,74 @@ Taps return key. A field can be located by text, accessibility id, id. ```js -I.tapReturnKey('Username'); -I.tapReturnKey('~name'); -I.tapReturnKey({ android: 'NAME', ios: 'name' }); +I.tapReturnKey('Username') +I.tapReturnKey('~name') +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 Waits for number of seconds ```js -I.wait(2); // waits for 2 seconds +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 Waits for an element to exist on page. ```js -I.waitForElement('#message', 1); // wait for 1 second +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 Waits for an element to be visible on page. ```js -I.waitForElementVisible('#message', 1); // wait for 1 second +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 Waits an elmenet to become not visible. ```js -I.waitToHide('#message', 2); // wait for 2 seconds +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 - [2]: https://wix.github.io/Detox/docs/introduction/project-setup - [3]: https://wix.github.io/Detox/docs/introduction/project-setup#step-5-build-the-app - [4]: https://codecept.io - [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String - [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - [7]: #tap - [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number - [9]: #relaunchApp - [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function - [11]: #click diff --git a/docs/helpers/ExpectHelper.md b/docs/helpers/ExpectHelper.md index 3a0659b29..3a437f48e 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 cd3d1351a..d85220a3f 100644 --- a/docs/helpers/FileSystem.md +++ b/docs/helpers/FileSystem.md @@ -15,10 +15,10 @@ Helper for testing filesystem. Can be easily used to check file structures: ```js -I.amInPath('test'); -I.seeFile('codecept.js'); -I.seeInThisFile('FileSystem'); -I.dontSeeInThisFile("WebDriver"); +I.amInPath('test') +I.seeFile('codecept.js') +I.seeInThisFile('FileSystem') +I.dontSeeInThisFile('WebDriver') ``` ## Configuration @@ -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,18 +57,18 @@ Checks that file found by `seeFile` doesn't include text. #### Parameters -* `text` **[string][1]** -* `encoding` **[string][1]** +- `text` **[string][1]** +- `encoding` **[string][1]** ### grabFileNames Returns file names in current directory. ```js -I.handleDownloads(); -I.click('Download Files'); -I.amInPath('output/downloads'); -const downloadedFileNames = I.grabFileNames(); +I.handleDownloads() +I.click('Download Files') +I.amInPath('output/downloads') +const downloadedFileNames = I.grabFileNames() ``` ### seeFile @@ -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,24 +94,24 @@ 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 Checks that file with a name including given text exists in the current directory. ```js -I.handleDownloads(); -I.click('Download as PDF'); -I.amInPath('output/downloads'); -I.seeFileNameMatching('.pdf'); +I.handleDownloads() +I.click('Download as PDF') +I.amInPath('output/downloads') +I.seeFileNameMatching('.pdf') ``` #### Parameters -* `text` **[string][1]** +- `text` **[string][1]** ### seeInThisFile @@ -119,24 +119,24 @@ Checks that file found by `seeFile` includes a text. #### Parameters -* `text` **[string][1]** -* `encoding` **[string][1]** +- `text` **[string][1]** +- `encoding` **[string][1]** ### waitForFile Waits for the file to be present in the current directory. ```js -I.handleDownloads('downloads/largeFilesName.txt'); -I.click('Download large File'); -I.amInPath('output/downloads'); -I.waitForFile('largeFilesName.txt', 10); // wait 10 seconds for file +I.handleDownloads('downloads/largeFilesName.txt') +I.click('Download large File') +I.amInPath('output/downloads') +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,9 +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 - [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number diff --git a/docs/helpers/GraphQL.md b/docs/helpers/GraphQL.md index 7aa35c637..2daed8d04 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 @@ -38,33 +38,33 @@ Send GraphQL requests by accessing `_executeQuery` method: ```js this.helpers['GraphQL']._executeQuery({ - url, - data, -}); + url, + data, +}) ``` ## Methods ### Parameters -* `config` +- `config` -### _executeQuery +### \_executeQuery Executes query via axios call #### Parameters -* `request` **[object][2]** +- `request` **[object][2]** -### _prepareGraphQLRequest +### \_prepareGraphQLRequest 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,27 +126,21 @@ Send query to GraphQL endpoint over http. Returns a response as a promise. ```js - -const response = await I.sendQuery('{ users { name email }}'); +const response = await I.sendQuery('{ users { name email }}') // with variables -const response = await I.sendQuery( - 'query getUser($id: ID) { user(id: $id) { name email }}', - { id: 1 }, -) -const user = response.data.data; +const response = await I.sendQuery('query getUser($id: ID) { user(id: $id) { name email }}', { id: 1 }) +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 [1]: https://github.com/axios/axios - [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String diff --git a/docs/helpers/GraphQLDataFactory.md b/docs/helpers/GraphQLDataFactory.md index 277cf2cd6..616a72404 100644 --- a/docs/helpers/GraphQLDataFactory.md +++ b/docs/helpers/GraphQLDataFactory.md @@ -28,9 +28,9 @@ If a web application has GraphQL support, it can be used to create and delete te By combining GraphQL with Factories you can easily create records for tests: ```js -I.mutateData('createUser', { name: 'davert', email: 'davert@mail.com' }); -let user = await I.mutateData('createUser', { name: 'davert'}); -I.mutateMultiple('createPost', 3, {post_id: user.id}); +I.mutateData('createUser', { name: 'davert', email: 'davert@mail.com' }) +let user = await I.mutateData('createUser', { name: 'davert' }) +I.mutateMultiple('createPost', 3, { post_id: user.id }) ``` To make this work you need @@ -53,17 +53,17 @@ See the example for Users factories: ```js // tests/factories/users.js -const { Factory } = require('rosie').Factory; -const { faker } = require('@faker-js/faker'); +const { Factory } = require('rosie').Factory +const { faker } = require('@faker-js/faker') // Used with a constructor function passed to Factory, so that the final build // object matches the necessary pattern to be sent as the variables object. module.exports = new Factory((buildObj) => ({ - input: { ...buildObj }, + input: { ...buildObj }, })) - // 'attr'-id can be left out depending on the GraphQl resolvers - .attr('name', () => faker.person.findName()) - .attr('email', () => faker.interact.email()) + // 'attr'-id can be left out depending on the GraphQl resolvers + .attr('name', () => faker.person.findName()) + .attr('email', () => faker.interact.email()) ``` For more options see [rosie documentation][1]. @@ -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,27 +121,27 @@ 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 Requests can be updated on the fly by using `onRequest` function. For instance, you can pass in current session from a cookie. ```js - onRequest: async (request) => { - // using global codeceptjs instance - let cookie = await codeceptjs.container.helpers('WebDriver').grabCookie('session'); - request.headers = { Cookie: `session=${cookie.value}` }; - } +onRequest: async (request) => { + // using global codeceptjs instance + let cookie = await codeceptjs.container.helpers('WebDriver').grabCookie('session') + request.headers = { Cookie: `session=${cookie.value}` } +} ``` ### Responses @@ -149,7 +149,7 @@ Requests can be updated on the fly by using `onRequest` function. For instance, By default `I.mutateData()` returns a promise with created data as specified in operation query string: ```js -let client = await I.mutateData('createClient'); +let client = await I.mutateData('createClient') ``` Data of created records are collected and used in the end of a test for the cleanup. @@ -158,27 +158,27 @@ Data of created records are collected and used in the end of a test for the clea ### Parameters -* `config` +- `config` -### _requestCreate +### \_requestCreate Executes request to create a record to the GraphQL endpoint. 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 +### \_requestDelete Executes request to delete a record to the GraphQL endpoint. 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 @@ -186,16 +186,16 @@ Generates a new record using factory, sends a GraphQL mutation to store it. ```js // create a user -I.mutateData('createUser'); +I.mutateData('createUser') // create user with defined email // and receive it when inside async function -const user = await I.mutateData('createUser', { email: 'user@user.com'}); +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 @@ -203,24 +203,20 @@ Generates bunch of records and sends multiple GraphQL mutation requests to store ```js // create 3 users -I.mutateMultiple('createUser', 3); +I.mutateMultiple('createUser', 3) // create 3 users of same age -I.mutateMultiple('createUser', 3, { age: 25 }); +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 - [2]: https://www.npmjs.com/package/faker - [3]: http://codecept.io/helpers/GraphQL/ - [4]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String - [5]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number diff --git a/docs/helpers/JSONResponse.md b/docs/helpers/JSONResponse.md index 8cc350f6a..e0099e3dd 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 @@ -61,26 +61,26 @@ If you plan to add custom assertions it is recommended to create a helper that w ```js // inside custom helper -const response = this.helpers.JSONResponse.response; +const response = this.helpers.JSONResponse.response ``` ## Methods ### Parameters -* `config` +- `config` ### dontSeeResponseCodeIs Checks that response code is not equal to the provided one ```js -I.dontSeeResponseCodeIs(500); +I.dontSeeResponseCodeIs(500) ``` #### Parameters -* `code` **[number][1]** +- `code` **[number][1]** ### dontSeeResponseContainsJson @@ -89,7 +89,7 @@ Checks for deep inclusion of a provided json in a response data. ```js // response.data == { data: { user: 1 } } -I.dontSeeResponseContainsJson({ user: 2 }); +I.dontSeeResponseContainsJson({ user: 2 }) ``` If an array is received, checks that no element of array contains json: @@ -97,24 +97,24 @@ If an array is received, checks that no element of array contains json: ```js // response.data == [{ user: 1 }, { user: 3 }] -I.dontSeeResponseContainsJson({ user: 2 }); +I.dontSeeResponseContainsJson({ user: 2 }) ``` #### Parameters -* `json` **[object][2]** +- `json` **[object][2]** ### seeResponseCodeIs Checks that response code is equal to the provided one ```js -I.seeResponseCodeIs(200); +I.seeResponseCodeIs(200) ``` #### Parameters -* `code` **[number][1]** +- `code` **[number][1]** ### seeResponseCodeIsClientError @@ -134,7 +134,7 @@ Checks that the response code is 2xx Use it instead of seeResponseCodeIs(200) if server can return 204 instead. ```js -I.seeResponseCodeIsSuccessful(); +I.seeResponseCodeIsSuccessful() ``` ### seeResponseContainsJson @@ -144,7 +144,7 @@ Checks for deep inclusion of a provided json in a response data. ```js // response.data == { user: { name: 'jon', email: 'jon@doe.com' } } -I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }); +I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }) ``` If an array is received, checks that at least one element contains JSON @@ -152,12 +152,12 @@ If an array is received, checks that at least one element contains JSON ```js // response.data == [{ user: { name: 'jon', email: 'jon@doe.com' } }] -I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }); +I.seeResponseContainsJson({ user: { email: 'jon@doe.com' } }) ``` #### Parameters -* `json` **[object][2]** +- `json` **[object][2]** ### seeResponseContainsKeys @@ -166,7 +166,7 @@ Checks for deep inclusion of a provided json in a response data. ```js // response.data == { user: { name: 'jon', email: 'jon@doe.com' } } -I.seeResponseContainsKeys(['user']); +I.seeResponseContainsKeys(['user']) ``` If an array is received, check is performed for each element of array: @@ -174,12 +174,12 @@ If an array is received, check is performed for each element of array: ```js // response.data == [{ user: 'jon' }, { user: 'matt'}] -I.seeResponseContainsKeys(['user']); +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 @@ -232,23 +232,18 @@ Use it to perform custom checks of response data ```js I.seeResponseValidByCallback(({ data, status, expect }) => { - expect(status).to.eql(200); - expect(data).keys.to.include(['user', 'company']); -}); + expect(status).to.eql(200) + expect(data).keys.to.include(['user', 'company']) +}) ``` #### Parameters -* `fn` **[function][6]** +- `fn` **[function][6]** [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number - [2]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - [3]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array - [4]: https://joi.dev - [5]: https://joi.dev/api/ - [6]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function diff --git a/docs/helpers/MockRequest.md b/docs/helpers/MockRequest.md index 3fd179964..f25d4ca9d 100644 --- a/docs/helpers/MockRequest.md +++ b/docs/helpers/MockRequest.md @@ -6,7 +6,6 @@ title: MockRequest # MockRequest - ## MockRequest @@ -17,9 +16,9 @@ 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. @@ -27,16 +26,16 @@ To use in passthrough mode set rules to mock requests and they will be automatic ```js // default mode -I.mockRequest('GET', '/api/users', '[]'); +I.mockRequest('GET', '/api/users', '[]') ``` In record-replay mode start mocking to make HTTP requests recorded/replayed, and stop when you don't need to block requests anymore: ```js // record or replay all XHR for /users page -I.startMocking(); -I.amOnPage('/users'); -I.stopMocking(); +I.startMocking() +I.amOnPage('/users') +I.stopMocking() ``` ### Installations @@ -83,7 +82,7 @@ helpers: { } ``` -*** +--- **TROUBLESHOOTING**: Puppeteer does not mock requests in headless mode: @@ -104,7 +103,7 @@ Solution: update Puppeteer config to include `--disable-web-security` arguments: }, ``` -*** +--- #### With WebDriver @@ -129,17 +128,17 @@ 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. ```js I.startMocking(); // optionally I.mockRequest('/google-analytics/*path', 200); -// return an empty successful response +// return an empty successful response I.mockRequest('GET', '/api/users', 200); // mock users api I.mockServer(server => { @@ -184,18 +183,18 @@ I.startMocking('users') // record requests under 'users' name Use `I.mockServer()` to customize which requests should be recorded and under which name: ```js -I.startMocking(); +I.startMocking() I.mockServer((server) => { // mock request only from ap1.com and api2.com and // store recording into two different files - server.any('https://api1.com/*').passthrough(false).recordingName('api1'); - server.any('https://api2.com/*').passthrough(false).recordingName('api2'); -}); + server.any('https://api1.com/*').passthrough(false).recordingName('api1') + server.any('https://api2.com/*').passthrough(false).recordingName('api2') +}) ``` 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,14 +204,14 @@ To stop request recording/replaying use `I.stopMocking()`. ### Parameters -* `config` +- `config` ### flushMocking Waits for all requests handled by MockRequests to be resolved: ```js -I.flushMocking(); +I.flushMocking() ``` ### mockRequest @@ -220,24 +219,24 @@ I.flushMocking(); Mock response status ```js -I.mockRequest('GET', '/api/users', 200); -I.mockRequest('ANY', '/secretsRoutes/*', 403); -I.mockRequest('POST', '/secrets', { secrets: 'fakeSecrets' }); -I.mockRequest('GET', '/api/users/1', 404, 'User not found'); +I.mockRequest('GET', '/api/users', 200) +I.mockRequest('ANY', '/secretsRoutes/*', 403) +I.mockRequest('POST', '/secrets', { secrets: 'fakeSecrets' }) +I.mockRequest('GET', '/api/users/1', 404, 'User not found') ``` Multiple requests ```js -I.mockRequest('GET', ['/secrets', '/v2/secrets'], 403); +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 @@ -247,34 +246,33 @@ Use PollyJS [Server Routes API][12] to declare mocks via callback function: I.mockServer((server) => { // basic usage server.get('/api/v2/users').intercept((req, res) => { - res.sendStatus(200).json({ users }); - }); + res.sendStatus(200).json({ users }) + }) // passthrough requests to "/api/v2" - server.get('/api/v1').passthrough(); -}); + server.get('/api/v1').passthrough() +}) ``` In record replay mode you can define which routes should be recorded and where to store them: ```js -I.startMocking('mock'); +I.startMocking('mock') I.mockServer((server) => { - // record requests from cdn1.com and save them to data/recording/xml - server.any('https://cdn1.com/*').passthrough(false).recordingName('xml'); - + server.any('https://cdn1.com/*').passthrough(false).recordingName('xml') + // record requests from cdn2.com and save them to data/recording/svg - server.any('https://cdn2.com/*').passthrough(false).recordingName('svg'); + server.any('https://cdn2.com/*').passthrough(false).recordingName('svg') // record requests from /api and save them to data/recording/mock (default) - server.any('/api/*').passthrough(false); -}); + server.any('/api/*').passthrough(false) +}) ``` #### Parameters -* `configFn` +- `configFn` ### passthroughMocking @@ -282,7 +280,7 @@ Forces passthrough mode for mocking. Requires mocking to be started. ```js -I.passthroughMocking(); +I.passthroughMocking() ``` ### recordMocking @@ -291,7 +289,7 @@ Forces record mode for mocking. Requires mocking to be started. ```js -I.recordMocking(); +I.recordMocking() ``` ### replayMocking @@ -300,7 +298,7 @@ Forces replay mode for mocking. Requires mocking to be started. ```js -I.replayMocking(); +I.replayMocking() ``` ### startMocking @@ -313,31 +311,31 @@ If inside one test you plan to record/replay requests in several places, provide ```js // start mocking requests for a test -I.startMocking(); +I.startMocking() // start mocking requests for main page -I.startMocking('main-page'); +I.startMocking('main-page') // do actions -I.stopMocking(); -I.startMocking('login-page'); +I.stopMocking() +I.startMocking('login-page') ``` To update [PollyJS configuration][14] use secon argument: ```js // change mode -I.startMocking('comments', { mode: 'replay' }); +I.startMocking('comments', { mode: 'replay' }) // override config I.startMocking('users-loaded', { - recordFailedRequests: true + recordFailedRequests: true, }) ``` #### Parameters -* `title` **any** (optional, default `'Test'`) -* `config` (optional, default `{}`) +- `title` **any** (optional, default `'Test'`) +- `config` (optional, default `{}`) ### stopMocking @@ -345,33 +343,20 @@ Stops mocking requests. Must be called to save recorded requests into faile. ```js -I.stopMocking(); +I.stopMocking() ``` [1]: https://netflix.github.io/pollyjs/#/configuration?id=mode - [2]: https://netflix.github.io/pollyjs/#/configuration?id=configuration - [3]: https://netflix.github.io/pollyjs/#/examples?id=rest-persister - [4]: #startMocking - [5]: #mockRequest - [6]: #mockServer - [7]: #stopMocking - [8]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String - [9]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array - [10]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number - [11]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - [12]: https://netflix.github.io/pollyjs/#/server/overview - [13]: https://netflix.github.io/pollyjs/#/api?id=recordingname - [14]: https://netflix.github.io/pollyjs/#/configuration diff --git a/docs/helpers/Nightmare.md b/docs/helpers/Nightmare.md index ce1deb302..7ad9c48eb 100644 --- a/docs/helpers/Nightmare.md +++ b/docs/helpers/Nightmare.md @@ -22,28 +22,28 @@ 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 +### \_locate Locate elements by different locator types, including strict locator. Should be used in custom helpers. @@ -55,17 +55,17 @@ client-side function: ```js // get an inner text of an element -let browser = this.helpers['Nightmare'].browser; -let value = this.helpers['Nightmare']._locate({name: 'password'}).then(function(els) { - return browser.evaluate(function(el) { - return codeceptjs.fetchElement(el).value; - }, els[0]); -}); +let browser = this.helpers['Nightmare'].browser +let value = this.helpers['Nightmare']._locate({ name: 'password' }).then(function (els) { + return browser.evaluate(function (el) { + return codeceptjs.fetchElement(el).value + }, els[0]) +}) ``` #### Parameters -* `locator` +- `locator` ### amOnPage @@ -73,15 +73,15 @@ 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 +I.amOnPage('/') // opens main page of website +I.amOnPage('https://github.com') // opens github +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 @@ -91,15 +91,15 @@ Appends text to a input field or textarea. Field is located by name, label, CSS or XPath ```js -I.appendField('#myTextField', 'appended'); +I.appendField('#myTextField', 'appended') // typing secret -I.appendField('password', secret('123456')); +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 @@ -110,14 +110,14 @@ Path to file is relative current codecept directory (where codecept.conf.ts or c File will be uploaded to remote system (if tests are running remotely). ```js -I.attachFile('Avatar', 'data/avatar.jpg'); -I.attachFile('form input[name=avatar]', 'data/avatar.jpg'); +I.attachFile('Avatar', 'data/avatar.jpg') +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]) @@ -129,15 +129,15 @@ Element is located by label or name or CSS or XPath. The second parameter is a context (CSS or XPath locator) to narrow the search. ```js -I.checkOption('#agree'); -I.checkOption('I Agree to Terms and Conditions'); -I.checkOption('agree', '//form'); +I.checkOption('#agree') +I.checkOption('I Agree to Terms and Conditions') +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 @@ -147,28 +147,28 @@ Clears a cookie by name, if none provided clears all cookies. ```js -I.clearCookie(); -I.clearCookie('test'); // Playwright currently doesn't support clear a particular cookie name +I.clearCookie() +I.clearCookie('test') // Playwright currently doesn't support clear a particular cookie name ``` #### Parameters -* `cookie` **[string][3]?** (optional, `null` by default) cookie name +- `cookie` **[string][3]?** (optional, `null` by default) cookie name ### clearField Clears a `