Skip to content

An example of how to run protractor test on AWS Fargate (ECS Fargate)

License

Notifications You must be signed in to change notification settings

innomizetech/protractor-ecs-fargate-example

Repository files navigation

Overview

An example of how to run protractor test on AWS Fargate (ECS Fargate).

Prerequisites

  • npm and Node.js 10.16.0 are prerequisites to have

Install Packages

npm i -g aws-cdk ts-node
npm install

Configuration

In case if you want to load some variables before running test, then:

  • Uncomment line #6 of the protractor.config.ts file
  • You have to create a ".env" file based on the .env.example file
cp .env.example .env

Run Tests

Before running Protractor test on your local machine, you need to update and start webdriver

npm run webdriver:update && npm run webdriver:start

Test all specs with chrome and firefox browsers

npm test

Run with chrome browser only

npm run test:chrome

Or you can run with firefox

npm run test:firefox

Run test in headless mode

npm run test:headless

Deploy

Deploy CDK app to your AWS

cd infra
cdk deploy

Once the CDK deploy command is finished, you can run ECS task to start protractor test.

Create the cdk.outputs.json in the infra directory likes below:

{
  "ProtractorFargateStack.region": "us-east-2",
  "ProtractorFargateStack.clusterName": "ProtractorFargateStack-ProtractorE2EClusterD3252608-117VTZR3YHQ83",
  "ProtractorFargateStack.subnets": [
    "subnet-xxxxxxxxxxxxxxxxx",
    "subnet-xxxxxxxxxxxxxxxxx",
    "subnet-xxxxxxxxxxxxxxxxx"
  ],
  "ProtractorFargateStack.securityGroups": ["sg-xxxxxxxxxxxxxxxxx"],
  "ProtractorFargateStack.reportBucketName": "protractor-e2e-example"
}

Then running the test-runner.ts helper file to load specs and start ECS tasks. For each spec in the src/specs directory, we will start a ECS tasks.

ts-node test-runner.ts

About

An example of how to run protractor test on AWS Fargate (ECS Fargate)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published