diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..8d73c79df --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,39 @@ +name: build +on: + pull_request: + branches: + - 3.x + types: + - opened + - synchronize + +jobs: + test: + runs-on: ubuntu-18.04 + strategy: + matrix: + node-version: [14.x] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + - run: npm install + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + - run: npm run def + - run: npm run dtslint + - run: npm version prerelease --preid=rc --force + - run: git status + - run: git push origin HEAD:${{ env.GITHUB_HEAD_REF_SLUG }} && git push --tags + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..62fe8823b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: publish +on: + release: + types: [created] + +jobs: + test: + runs-on: ubuntu-18.04 + strategy: + matrix: + node-version: [14.x] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + - run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + - run: npm install + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + - run: npm run def + - run: npm run dtslint + - run: npm publish --access public \ No newline at end of file diff --git a/.github/workflows/publish_manual.yml b/.github/workflows/publish_manual.yml new file mode 100644 index 000000000..c54a9e853 --- /dev/null +++ b/.github/workflows/publish_manual.yml @@ -0,0 +1,42 @@ +name: Manual publish + +on: + workflow_dispatch: + inputs: + version: + default: "" + description: "Set build version" + +jobs: + test: + runs-on: ubuntu-18.04 + strategy: + matrix: + node-version: [14.x] + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + - run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc + - run: | + git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" + git config --global user.name "github-actions[bot]" + - run: npm install + env: + PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: true + PUPPETEER_SKIP_CHROMIUM_DOWNLOAD: true + - name: Inject slug/short variables + uses: rlespinasse/github-slug-action@v3.x + - run: | + USER_INPUT=${{ github.event.inputs.version }} + NAME=${USER_INPUT:-"alfa-${{ env.GITHUB_REF_NAME_SLUG_URL }}-${{ env.GITHUB_SHA_SHORT }}"} + echo $NAME + npm config set preid $NAME + - run: npm run def + - run: npm run dtslint + - run: npm version prerelease --no-git-tag-version + - run: npm publish --access public \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 30151ecf4..1bbca6d4d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -141,7 +141,6 @@ 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 ## 3.3.2 diff --git a/README.md b/README.md index 197119f17..16a61bd4c 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,18 @@ -[![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] -[![StandWithUkraine](https://raw.githubusercontent.com/vshymanskyy/StandWithUkraine/main/badges/StandWithUkraine.svg)](https://github.com/vshymanskyy/StandWithUkraine/blob/main/docs/README.md) Build Status: -[![Playwright Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/playwright.yml) -[![Puppeteer Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/puppeteer.yml) -[![WebDriver Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/webdriver.yml) -[![Appium Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/appium.yml) -[![TestCafe Tests](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml/badge.svg)](https://github.com/codeceptjs/CodeceptJS/actions/workflows/testcafe.yml) +[![Playwright Tests](https://github.com/gaainf/CodeceptJS/actions/workflows/playwright.yml/badge.svg)](https://github.com/gaainf/CodeceptJS/actions/workflows/playwright.yml) +[![Puppeteer Tests](https://github.com/gaainf/CodeceptJS/actions/workflows/puppeteer.yml/badge.svg)](https://github.com/gaainf/CodeceptJS/actions/workflows/puppeteer.yml) +[![WebDriver Tests](https://github.com/gaainf/CodeceptJS/actions/workflows/webdriver.yml/badge.svg)](https://github.com/gaainf/CodeceptJS/actions/workflows/webdriver.yml) +[![Appium Tests](https://github.com/gaainf/CodeceptJS/actions/workflows/appium.yml/badge.svg)](https://github.com/gaainf/CodeceptJS/actions/workflows/appium.yml) +[![TestCafe Tests](https://github.com/gaainf/CodeceptJS/actions/workflows/testcafe.yml/badge.svg)](https://github.com/gaainf/CodeceptJS/actions/workflows/testcafe.yml) -# CodeceptJS [![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7)](https://stand-with-ukraine.pp.ua) +# CodeceptJS -Reference: [Helpers API](https://github.com/codeceptjs/CodeceptJS/tree/master/docs/helpers) +Reference: [Helpers API](https://github.com/gaainf/CodeceptJS/tree/master/docs/helpers) ## Supercharged E2E Testing @@ -40,13 +37,13 @@ CodeceptJS tests are: 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 protocol. -* [**TestCafe**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation. -* [**Nightmare**](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - uses Electron and NightmareJS to run tests. -* [**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/gaainf/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/gaainf/CodeceptJS/blob/master/docs/helpers/Puppeteer.md) - uses Google Chrome's Puppeteer for fast headless testing. +* [**WebDriver**](https://github.com/gaainf/CodeceptJS/blob/master/docs/helpers/WebDriver.md) - uses [webdriverio](http://webdriver.io/) to run tests via WebDriver protocol. +* [**TestCafe**](https://github.com/gaainf/CodeceptJS/blob/master/docs/helpers/TestCafe.md) - cheap and fast cross-browser test automation. +* [**Nightmare**](https://github.com/gaainf/CodeceptJS/blob/master/docs/helpers/Nightmare.md) - uses Electron and NightmareJS to run tests. +* [**Appium**](https://github.com/gaainf/CodeceptJS/blob/master/docs/helpers/Appium.md) - for **mobile testing** with Appium +* [**Detox**](https://github.com/gaainf/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... @@ -69,7 +66,7 @@ You don't need to worry about asynchronous nature of NodeJS or about various API ## Install ```sh -npm i codeceptjs --save +npm i codeceptjs@npm:@gaainf/codeceptjs ``` Move to directory where you'd like to have your tests (and codeceptjs config) stored, and execute @@ -128,7 +125,7 @@ Scenario('test some forms', ({ I }) => { ``` All actions are performed by I object; assertions functions start with `see` function. -In this examples all methods of `I` are taken from WebDriver helper, see [reference](https://github.com/codeceptjs/CodeceptJS/blob/master/docs/helpers/WebDriver.md) to learn how to use them. +In this examples all methods of `I` are taken from WebDriver helper, see [reference](https://github.com/gaainf/CodeceptJS/blob/master/docs/helpers/WebDriver.md) to learn how to use them. Let's execute this test with `run` command. Additional option `--steps` will show us the running process. We recommend use `--steps` or `--debug` during development. @@ -285,8 +282,8 @@ 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/gaainf/CodeceptJS/blob/master/.github/CONTRIBUTING.md) + - ### [Code of conduct](https://github.com/gaainf/CodeceptJS/blob/master/.github/CODE_OF_CONDUCT.md) ## Contributors @@ -331,11 +328,5 @@ Thanks all to those who are and will have contributing to this awesome project! MIT Β© [CodeceptJS Team](http://codecept.io) -[npm-image]: https://badge.fury.io/js/codeceptjs.svg -[npm-url]: https://npmjs.org/package/codeceptjs -[travis-image]: https://travis-ci.org/Codeception/codeceptjs.svg?branch=master -[travis-url]: https://travis-ci.org/Codeception/codeceptjs -[daviddm-image]: https://david-dm.org/Codeception/codeceptjs.svg?theme=shields.io -[daviddm-url]: https://david-dm.org/Codeception/codeceptjs -[coveralls-image]: https://coveralls.io/repos/Codeception/codeceptjs/badge.svg -[coveralls-url]: https://coveralls.io/r/Codeception/codeceptjs +[npm-image]: https://badge.fury.io/js/@gaainf%2Fcodeceptjs.svg +[npm-url]: https://npmjs.org/package/@gaainf/codeceptjs diff --git a/docs/changelog.md b/docs/changelog.md index d1d4e3788..fb4e42730 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -150,7 +150,6 @@ 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 ## 3.3.2 diff --git a/lib/cli.js b/lib/cli.js index 83da4c6e5..4c9ae0a51 100644 --- a/lib/cli.js +++ b/lib/cli.js @@ -19,7 +19,7 @@ class Cli extends Base { if (opts.debug) level = 2; if (opts.verbose) level = 3; output.level(level); - output.print(`CodeceptJS v${require('./codecept').version()} ${output.standWithUkraine()}`); + output.print(`CodeceptJS v${require('./codecept').version()}`); output.print(`Using test root "${global.codecept_dir}"`); const showSteps = level >= 1; diff --git a/lib/command/run-workers.js b/lib/command/run-workers.js index 9dafc4a97..c578c39e4 100644 --- a/lib/command/run-workers.js +++ b/lib/command/run-workers.js @@ -25,7 +25,7 @@ module.exports = async function (workerCount, options) { const numberOfWorkers = parseInt(workerCount, 10); - output.print(`CodeceptJS v${require('../codecept').version()} ${output.standWithUkraine()}`); + output.print(`CodeceptJS v${require('../codecept').version()}`); output.print(`Running tests in ${output.styles.bold(numberOfWorkers)} workers...`); output.print(); diff --git a/lib/helper/Playwright.js b/lib/helper/Playwright.js index d07220b1f..806e913d4 100644 --- a/lib/helper/Playwright.js +++ b/lib/helper/Playwright.js @@ -407,8 +407,15 @@ class Playwright extends Helper { } async _before() { + /** + * Bug with retryFailedStep. + * It doesn't use our custom config and doesn't change amount of retryes + * https://github.com/codeceptjs/CodeceptJS/issues/3268 + * https://github.com/codeceptjs/CodeceptJS/issues/2829 + */ recorder.retry({ - retries: 5, + retries: 2, + factor: 1, when: err => { if (!err || typeof (err.message) !== 'string') { return false; diff --git a/lib/helper/Puppeteer.js b/lib/helper/Puppeteer.js index 36fe1130d..0bf69f1a1 100644 --- a/lib/helper/Puppeteer.js +++ b/lib/helper/Puppeteer.js @@ -276,9 +276,16 @@ class Puppeteer extends Helper { } async _before() { + /** + * Bug with retryFailedStep. + * It doesn't use our custom config and doesn't change amount of retryes + * https://github.com/codeceptjs/CodeceptJS/issues/3268 + * https://github.com/codeceptjs/CodeceptJS/issues/2829 + */ this.sessionPages = {}; recorder.retry({ - retries: 3, + retries: 2, + factor: 1, when: err => { if (!err || typeof (err.message) !== 'string') { return false; diff --git a/lib/output.js b/lib/output.js index b20830fd8..6562b389e 100644 --- a/lib/output.js +++ b/lib/output.js @@ -26,10 +26,6 @@ module.exports = { /** @type {number} */ stepShift: 0, - standWithUkraine() { - return `#${colors.bold.yellow('StandWith')}${colors.bold.cyan('Ukraine')}`; - }, - /** * Set or return current verbosity level * @param {number} [level] diff --git a/lib/plugin/retryFailedStep.js b/lib/plugin/retryFailedStep.js index 645eacdc7..bcf2e45fe 100644 --- a/lib/plugin/retryFailedStep.js +++ b/lib/plugin/retryFailedStep.js @@ -2,7 +2,13 @@ const event = require('../event'); const recorder = require('../recorder'); const defaultConfig = { - retries: 3, + /** + * Bug with retryFailedStep. + * It doesn't use our custom config and doesn't change amount of retryes + * https://github.com/codeceptjs/CodeceptJS/issues/3268 + * https://github.com/codeceptjs/CodeceptJS/issues/2829 + */ + retries: 2, defaultIgnoredSteps: [ 'amOnPage', 'wait*', @@ -11,7 +17,7 @@ const defaultConfig = { 'run*', 'have*', ], - factor: 1.5, + factor: 1, ignoredSteps: [], }; diff --git a/package.json b/package.json index 952aba338..a3dc01077 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { - "name": "codeceptjs", - "version": "3.3.7", + "name": "@gaainf/codeceptjs", + "version": "3.3.7-rc.10", "description": "Supercharged End 2 End Testing Framework for NodeJS", "keywords": [ "acceptance", @@ -33,7 +33,7 @@ "bin": { "codeceptjs": "./bin/codecept.js" }, - "repository": "Codeception/codeceptjs", + "repository": "gaainf/codeceptjs", "scripts": { "build": "tsc -p ./", "json-server": "./node_modules/json-server/bin/index.js test/data/rest/db.json -p 8010 --watch -m test/data/rest/headers.js",