Home

Awesome

vue-cli-plugin-e2e-codeceptjs

Hey, how about some end 2 end testing for your Vue apps? šŸ¤”

Let's do it together! Vue, me, CodeceptJS & Puppeteer. šŸ¤—

Browser testing was never that simple. 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:

npm i vue-cli-plugin-codeceptjs-puppeteer --save-dev

This will install CodeceptJS, CodeceptUI & Puppeteer with Chrome browser.

To add CodeceptJS to your project invoke installer:

vue invoke vue-cli-plugin-codeceptjs-puppeteer

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:

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.

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.

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