Skip to content

mhipszki/ltg-workshop-2018

Repository files navigation

LTG Jest Workshop 28/06/2018

In the constantly changing world of front-end development, the logic that traditionally resided in backend applications is shifting towards the UI, and automated tests need to be written in a different manner to test them.

This leads us to questions like:

  • How can we shorten the feedback cycle when changing the code?
  • How can we make UI testing more effective?
  • Mocha, Jasmine, Karma, Chai, Expect.js, etc. - which JavaScript testing framework should I use?
  • Are there other options today, besides the good old Selenium / Webdriver for end-to-end testing?

In this workshop, we will answer all of these questions, and will find the resolution in Jest, the open source testing platform from Facebook, which has come a long way since its inception. Jest provides a fantastic user experience, with instant feedback and remarkable performance, out-of-the-box mocking, code coverage support, sandboxing, etc., as well as running tests in parallel. It also has a special feature: snapshot testing and also plays nicely with other testing libraries beside being highly extendable via its plugin system.

Whether your focus is more on end-to-end or unit level testing, Jest can help you remove unnecessary noise from your daily work by unifying test automation across the whole testing pyramid, from unit through integration to end-to-end level, allowing you to use a single language, API and tooling.

During this workshop, we will work with Jest and the headless Chrome-based Puppeteer to write, manage, and own all of our automated tests, written in a single language: JavaScript.

Jest

  • simple unit tests
  • using mocks, spies
  • timer mocks
  • async
  • snapshots

Puppeteer

  • generate screenshot
  • save page as PDF
  • set viewport size
  • fill and submit forms
  • setting timeout

How to start

Prereqs

  • Node.js 8+ (use nvm)
  • npm i -g yarn create-react-app

Install project dependencies

yarn

Run scripts

Start the app:

yarn start

Run the unit tests:

yarn test

Run the e2e tests:

yarn test-e2e

About

LTG Jest/Puppeteer workshop

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published