Git Product home page Git Product logo

cypress-lambda's Introduction

Cypress on AWS Lambda

This repo demonstrates how to run Cypress on AWS Lambda, executing each spec file in parallel.

The blog post, part 1 walks through the nitty gritty of getting a single Cypress spec running on Lambda (see branch part-1 for where this leaves off).

Part 2 contains details on invoking a Lambda function for each spec file and collecting the results in an mochawesome report.

Warning this is a prototype and it hasn't been battle-tested.

How do I use this?

Requirements: docker, terraform, nodejs >= 8

First build the image to gather dependencies

cd lambda
docker build . -t cypress-lambda

Extract dependencies from container

./deps.sh

Invoke Lambda handler locally

Verify that the handler invocation works when run locally with docker-lambda's: nodejs8.10 runtime, a dockerized replica of the AWS Lambda execution environment:

docker run --rm -v "$PWD":/var/task:ro lambci/lambda:nodejs8.10

Deploy it

Back in the project root:

touch lambda.zip
terraform init
terraform apply

(You'll have to change a couple things in lambda.tf for your situation, such as the s3 bucket name, which is globally unique)

Invoke it

In the project root, first:

npm install

And then:

npm test

This will invoke the deployed Lambda function once for each spec file, collect individual mochawesome JSON reports for each Lambda invocation, merge together the JSON reports, and produce a single mochawesome HTML report.

Use your own tests

So right now this is using the cypress kitchensink example; you'll want to put your own tests in lambda/cypress/integration and then go through all the steps above again.

cypress-lambda's People

Contributors

leonfs avatar stuartsan avatar

Watchers

 avatar  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.