diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml new file mode 100644 index 0000000..194cc8d --- /dev/null +++ b/.github/workflows/npm-publish.yml @@ -0,0 +1,30 @@ +# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions +name: Publish npm Package + +on: + push: + branches: + - master + - main + +jobs: + publish-npm: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 20 + registry-url: https://registry.npmjs.org/ + - run: git config --global user.name "GitHub CD bot" + - run: git config --global user.email "github-cd-bot@example.com" + - run: npx semantic-release + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # push the version changes to GitHub + - run: git add package.json && git commit -m'update version' && git push + env: + # The secret is passed automatically. Nothing to configure. + github-token: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 244969f..62307f5 100644 --- a/.gitignore +++ b/.gitignore @@ -104,3 +104,7 @@ dist # TernJS port file .tern-port + +#IDE +.vscode +.idea diff --git a/Readme.md b/Readme.md index 0f980b6..9f706e2 100644 --- a/Readme.md +++ b/Readme.md @@ -1,6 +1,6 @@ # Create CodeceptJS 🚀 -Create CodeceptJS project easily, having all dependencies installed with one command. +One command to create a fresh CodeceptJS project or add CodeceptJS to an existing project. ``` ____ ____ _____ ____ _____ _____ ____ ____ ____ _____ ____ _____ ____ _____ _ ____ @@ -11,40 +11,33 @@ Create CodeceptJS project easily, having all dependencies installed with one com ``` - -This script will install all required depdnedncies for CodeceptJS project. It is not required to use `create-codeceptjs` on any project, you can install them on your own, but it is very easy to start from scratch. -![](https://user-images.githubusercontent.com/220264/87477444-c986b580-c630-11ea-9af4-f383e02dfa2d.gif) - -This script will also update `scripts` section of `package.json` so you could execute tests faster without learning Codeceptjs commands. - -## Installation +![](https://user-images.githubusercontent.com/220264/93864416-88182380-fccd-11ea-97fe-3d948e6697c6.gif) -No installation needed 🤗 +This script will also add several commands to the `scripts` section of your `package.json`, so you can just execute tests without the need to learn custom CodeceptJS commands. ## Usage - -Install CodeceptJS + Playwright into current project +To install CodeceptJS + Playwright into your current project run ``` -npx create-codeceptjs +npx create-codeceptjs . ``` -Install CodeceptJS into "tests" directory +To install CodeceptJS + Playwright into the "tests" directory run ``` npx create-codeceptjs tests ``` -Install CodeceptJS + webdriverio: +To install CodeceptJS + WebdriverIO run ``` npx create-codeceptjs --webdriverio ``` -Install CodeceptJS + webdriverio into "tests" directory +To install CodeceptJS + WebdriverIO into "tests" directory ``` npx create-codeceptjs tests --webdriverio @@ -52,8 +45,21 @@ npx create-codeceptjs tests --webdriverio Supported options: -* `--puppeteer` - install puppeteer as default helper -* `--testcafe` - install testcafe as default helper -* `--yarn` - yes, we support yarn too! +* `--puppeteer` - installs Puppeteer as default helper +* `--webdriverio` - installs WebdriverIO as default helper +* `--testcafe` - installs TestCafe as default helper +* `--use-yarn` - yes, we support yarn too! +* `--force`, - accept an incorrect (and potentially broken) dependency resolution when installing with NPM + +## NPM Scripts + +This command appends following scripts to package.json file: + * `codeceptjs` - runs tests + * `codeceptjs:headless` - runs tests in headless mode + * `codeceptjs:ui` - runs tests via CodeceptUI + + * `codeceptjs:demo` - runs tests from demo application + * `codeceptjs:demo:headless` - runs tests in headless mode from demo + * `codeceptjs:demo:ui` - opens CodeceptUI for demo application diff --git a/index.js b/index.js index 3a20fc3..45bcbd7 100755 --- a/index.js +++ b/index.js @@ -8,14 +8,14 @@ const semver = require('semver'); const spawn = require('cross-spawn'); const enginePackages = { - puppeteer: ['puppeteer@5'], + puppeteer: ['puppeteer@21.1.1'], playwright: ['playwright@1'], testcafe: ['testcafe@1'], - webdriverio: ['webdriverio@6'], + webdriverio: ['webdriverio@8'], }; const codeceptPackages = [ - 'codeceptjs@3.0.0-beta.4', + 'codeceptjs@3', '@codeceptjs/ui', '@codeceptjs/examples', '@codeceptjs/configure' @@ -39,9 +39,10 @@ console.log(' 🔌 Supercharged End 2 End Testing 🌟'); let projectName; let useYarn; +let packageJson; const program = new commander.Command('Create CodeceptJS') - .version(packageJson.version) + .version(fs.readJSONSync(path.join(__dirname, 'package.json')).version) .arguments('[project]') .usage(`${chalk.green('[project]')} [options]`) .action(name => { @@ -55,11 +56,13 @@ const program = new commander.Command('Create CodeceptJS') .option('--template