Code Monkey home page Code Monkey logo

vue-cli-plugin-codeceptjs-playwright's Introduction

vue-cli-plugin-e2e-codeceptjs-playwright

Hey, how about some end 2 end testing for your Vue apps? ๐Ÿค”

Let's do it together! Vue, CodeceptJS & Playwright and myself. ๐Ÿค—

Browser testing would be more fun. Just see it! ๐Ÿ˜

I.amOnPage('/');
I.click('My Component Button');
I.see('My Component');
I.say('I am happy!');
// that's right, this is a valid test! 

How to try it?

Requirements:

  • NodeJS >= 14.* as required by playwright
  • NPM / Yarn
  • Vue CLI installed globally

Note:

  • CodeceptJS requires Node.js version 8.9.1+ or later.
  • To use the parallel test execution, requiring Node.js version 11.7 or later.
  • NodeJS >= 14.* as required by playwright
npm i vue-cli-plugin-codeceptjs-playwright --save-dev

This will install CodeceptJS, CodeceptUI & Playwright.

To add CodeceptJS to your project, invoke the installer:

vue invoke vue-cli-plugin-codeceptjs-playwright

You will be asked about installing a demo component. If you start a fresh project it is recommended to agree and install a demo component, so you could see tests passing.

Running Tests

We added npm scripts:

  • test:e2e - will execute tests with an opened browser . If you installed test component, and started a test server, running this command will show you a browser window passed test.
    • Use --headless option to run browser with headless mode
    • Use --serve option to start a dev server before tests

Examples:

npm run test:e2e 
npm run test:e2e -- --headless
npm run test:e2e -- --serve 

This command is a wrapper for codecept run --steps. You can use the Run arguments and options here.

  • test:e2e:parallel - will execute tests headlessly in parallel processes (workers). By default, runs tests in 2 workers.
    • Use an argument to set number of workers
    • Use --serve option to start dev server before running

Examples:

npm run test:e2e:parallel
npm run test:e2e:parallel -- 3
npm run test:e2e:parallel -- 3 --serve

This command is a wrapper for codecept run-workers 2. You can use the Run arguments and options here.

  • test:e2e:open - this opens interactive web test runner. So you could see, review & run your tests from a browser.

npm run test:e2e:open

Directory Structure

Generator has created these files:

codecept.conf.js          ๐Ÿ‘ˆ codeceptjs config
jsconfig.json             ๐Ÿ‘ˆ enabling type definitons
tests
โ”œโ”€โ”€ e2e
โ”‚ย ย  โ”œโ”€โ”€ app_test.js       ๐Ÿ‘ˆ demo test, edit it!
โ”‚ย ย  โ”œโ”€โ”€ output            ๐Ÿ‘ˆ temp directory for screenshots, reports, etc
โ”‚ย ย  โ””โ”€โ”€ support
โ”‚ย ย      โ””โ”€โ”€ steps_file.js ๐Ÿ‘ˆ common steps
โ””โ”€โ”€ steps.d.ts            ๐Ÿ‘ˆ type definitions

If you agreed to create a demo component, you will also see TestMe component in src/components folder.

How to write tests?

Enjoy testing!

Testing is simple & fun, enjoy it!

With โค CodeceptJS Team

vue-cli-plugin-codeceptjs-playwright

vue-cli-plugin-codeceptjs-playwright's People

Contributors

kobenguyent avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.