All Projects → PauloGoncalvesBH → running-playwright-on-aws-lambda

PauloGoncalvesBH / running-playwright-on-aws-lambda

Licence: GPL-3.0 license
Running hundreds of Playwright E2E tests in a few seconds with AWS Lambda

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to running-playwright-on-aws-lambda

flock
Flock: A Low-Cost Streaming Query Engine on FaaS Platforms
Stars: ✭ 232 (+3.11%)
Mutual labels:  lambda-functions
aws-lambda-decorators
A set of Python decorators to simplify AWS lambda development
Stars: ✭ 19 (-91.56%)
Mutual labels:  lambda-functions
Mystral
Mystral (pronounced "ˈMistrəl") is an efficient library to deal with relational databases quickly.
Stars: ✭ 13 (-94.22%)
Mutual labels:  lambda-functions
browser-automation-api
Browser automation API for repetitive web-based tasks, with a friendly user interface. You can use it to scrape content or do many other things like capture a screenshot, generate pdf, extract content or execute custom Puppeteer, Playwright functions.
Stars: ✭ 24 (-89.33%)
Mutual labels:  playwright
yap
Open source API Gateway on GraphQL for serverless. Less code, safer API. 💪
Stars: ✭ 105 (-53.33%)
Mutual labels:  lambda-functions
playwright-vscode
Playwright Test Visual Studio Code integration
Stars: ✭ 144 (-36%)
Mutual labels:  playwright
jsitemapgenerator
Java sitemap generator. This library generates a web sitemap, can ping Google, generate RSS feed, robots.txt and more with friendly, easy to use Java 8 functional style of programming
Stars: ✭ 38 (-83.11%)
Mutual labels:  lambda-functions
playwright-testing-library
🔍 Find elements in Playwright with queries from Testing Library
Stars: ✭ 160 (-28.89%)
Mutual labels:  playwright
java-core
Collections of solutions for micro-tasks created while building modules as part of project. Also has very fun stuffs :)
Stars: ✭ 35 (-84.44%)
Mutual labels:  lambda-functions
axe-playwright
♿: Custom commands for Playwright to run accessibility (a11y) checks with axe-core
Stars: ✭ 88 (-60.89%)
Mutual labels:  playwright
playwright-jest-examples
Demonstrates the usage of Playwright (cross-browser automation library in Node.js) in combination with Jest on GitHub Actions to test various setups.
Stars: ✭ 79 (-64.89%)
Mutual labels:  playwright
playwright-jest-boilerplate
No description or website provided.
Stars: ✭ 16 (-92.89%)
Mutual labels:  playwright
playwright-session
Visual Debugger for Playwright automation.
Stars: ✭ 39 (-82.67%)
Mutual labels:  playwright
Trendr App
Twitter Trends history explorer app. Trending topics can be explored by date and location. Backend served with Lambda Function (NodeJS) from AWS. Frontend made with VueJS. Twitter API queried with a Python script from Google Colab. MongoDB database.
Stars: ✭ 17 (-92.44%)
Mutual labels:  lambda-functions
Recorder
A browser extension that generates Cypress, Playwright and Puppeteer test scripts from your interactions 🖱 ⌨
Stars: ✭ 277 (+23.11%)
Mutual labels:  playwright
terraform-aws-lambda-function
A Terraform module for deploying and managing Lambda functions on Amazon Web Services (AWS). https://aws.amazon.com/lambda/
Stars: ✭ 37 (-83.56%)
Mutual labels:  lambda-functions
browser-pool
A Node.js library to easily manage and rotate a pool of web browsers, using any of the popular browser automation libraries like Puppeteer, Playwright, or SecretAgent.
Stars: ✭ 71 (-68.44%)
Mutual labels:  playwright
qa-automation-base
There are basic projects for automation frameworks based on Kotlin/Java and TypeScript for the backend, frontend, and mobile.
Stars: ✭ 45 (-80%)
Mutual labels:  playwright
Cezanne
🎣 Serverless Image Generation Function
Stars: ✭ 29 (-87.11%)
Mutual labels:  lambda-functions
lorem-ipsum-generator-generator
🎰 Generate a lorem ipsum generator site using Mercury Web Parser
Stars: ✭ 27 (-88%)
Mutual labels:  lambda-functions

Running hundreds of Playwright tests in a few seconds with AWS Lambda

Give the repository a star , it encourages me to create advanced software quality content 100% free

This project has a playwright implementation so that it is consumed via AWS Lambda, allowing to parallelize the execution of all files and making the execution much faster.

The success of this implementation demonstrates that, in scenarios where E2E testing is needed to validate critical behaviors that are not possible in another type of test, it is possible to use AWS Lambda to run this same test on all Pull Requests, not just a few times in day.

Result

With playwright on serverless it was possible to run 110 files, with 221 tests, in less than 25 seconds. This same test running without parallelization would take 23 minutes.

To see the execution in detail, you can access the pipeline log by clicking here.

The gif below demonstrates the execution:

Gif showing playwright execution

Pricing

Running hundreds of Lambda functions that last a few seconds has little impact on the final cost.

AWS Lambda Price:

The AWS Lambda free usage tier includes 1M free requests per month and 400,000 GB-seconds of compute time per month.

Source: https://aws.amazon.com/lambda/pricing/

Application diagram

Diagram

CloudWatch metrics

Below are some important CloudWatch metrics.

110 lambda functions were invoked, however my account has a limit of 50 parallel executions, which made the total execution double in time.

The average time that a lambda function takes to run is 7 seconds, which is less than the total of 23 seconds that takes to run the test.

However 23 seconds is a quiet time to wait when running an E2E test in a pipeline. I think we both agree that it's better than 23 minutes.

Parallel executions

Limited to 50.

Parallel runs limited to 50

Invocations

1 invocation per test file in ./tests/E2E.

Number of calls equal to 110, 1 per test file

Duration

The longest running lambda function was 10.2 seconds, less than half of the total execution time of all functions.

With a higher concurrent execution we would have better results in total time.

Duration showing the longest lambda was 10.2 seconds

More information

To understand how tests are run and AWS Lambda is built I recommend accessing the pipelines in ./.github/workflows/ and the Makefile.

Run locally (without using AWS Lambda)

Acess the directory ./tests and execute:

npm ci

Run the test with:

npm test

LICENSE GNU General Public License v3.0

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].