arturoromeroslc / e2e

Testing you app in the cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Lambda-E2E

End-to-End Testing using Puppeteer and Lambda. Lambda executes every n minutes via Cloudwatch events. This was dicussed over two years ago

As developers we are committed to delivering a high level of product quality to our customers.

In the past, I have used Selenium for running end-to-end tests. Stability issues with that setup resulted led to my poor adoption.

Test like end-to-end (E2E) tests, take more time to author, but give you much more confidence that the application will work as the user expects, since they replicate scenarios similar to how a user would use the application in real life.

To make E2E testing an essential part of the developer workflow and help deliver a quality experience to our customers, we will focus on a few key principles:

Developer Experience

  • Make end-to-end tests simple to run and debug
  • Push test failure notifications to our engineers
  • Leverage open source libraries

Actionability

  • Push test reports to engineers
  • Clearly highlight failures and suite stability through notifications and reporting
  • Test failures to be actionable
  • Make it as straightforward for new engineers to learn

Scalability

  • Run tests quickly and reliably
  • Run as many test as we wanted in parallel

Introducing an end-to-end testing system using Puppeteer, Lambda, and AWS CDK.

Writing Tests in Puppeteer

  • Puppeteer is a Headless Chrome Node API, which controls a version of the Chrome browser.
  • Built on top of the Chrome DevTools Protocol
  • Event-driven architecture
  • High quality documentation & strong community of maintenance
  • Ability to test against different page viewports and network conditions

Drawbacks

cross-browser testing.

  • We found that many of our bugs were non-browser specific. Given the other methods we currently use for catching browser-specific bugs (not writing browser-specific code, better linting, JavaScript and CSS polyfills, smoke-testing on other browsers we support), we felt comfortable with this decision. Additional considerations included estimating migration time and setting up training for engineers to adapt from Selenium.

Build

To build this app, you need to be in this example's root folder. Then run the following:

npm install -g aws-cdk
npm install
npm run package

This will install the necessary CDK, then this example's dependencies, and then build your TypeScript files and your CloudFormation template, and zip the lambda handler code.

Deploy

Run cdk deploy. This will deploy / redeploy your Stack to your AWS Account.

After the deployment you will see the API's URL, which represents the url you can then use.

Synthesize Cloudformation Template

To see the Cloudformation template generated by the CDK, run cdk synth, then check the output file in the "cdk.out" directory.

About

Testing you app in the cloud


Languages

Language:JavaScript 59.5%Language:TypeScript 40.5%