Giter VIP home page Giter VIP logo

terraform's Introduction

Set Up a Selenium Grid with Terraform

Introduction

This is a terraform project to set up a selenium grid in aws using fargate.

Setup

Prerequisite: valid AWS installation and configuration.

  • To install terraform with the following commands:

    OSX: brew install terraform
    Windows: choco install terraform

  • Clone this repo

  • Create a new file terraform.tfvars in terrafom directory and make sure it's in the gitignore file

  • For this project, we will use AWS as the cloud provider. Please generate a pair of AWS_ACCESS_KEY and AWS_SECRET_KEY and save them to terraform.tfvars like below:

    AWS_ACCESS_KEY = "XXXXXXXXXXX"
    AWS_SECRET_KEY = "XXXXXXXXXXXXXXXXXXX"
    
  • Log in to your AWS console

  • You are all set.

Steps

1. Initialize, Plan and Apply

terraform init
terraform plan
terraform apply

2. AWS concole

Click on ECS then you should see the cluster selenium-cluster. If you click on the cluster, you can check the running services selenium-service. Then, please go to the Tasks tab and click on the running task.

Notice, you should be able to see the Public IP address under Network. Also, under Containers there are selenium hub, firefox and chrome node.

3. Selenium Hub & Nodes

Open a new tab in the browser, then go to this link: http://[Public IP Address]:4444/grid/console. Please replace [Public IP Address] with the public IP address of your selenium task.

Now you should see a firefox node and a chrome node in the browser.

4. Run tests with Selenium Grid

Check if you have node installed by running node -v. If not, please install node.

Install or export java version "1.8.0_172".

In the terminal, cd into the test directory and run command npm install to install the dependencies.

There is a sample selenium webdriver test in grid-test.js. Please open this in your IDE and replace XXXX with the public IP address being used earlier.

Once it's done, type node grid-test.js in the terminal to run the test.

When the test is running, the firefox or chrome node will become grey which indicates that this node is being used.

5. Destroy

Don't forget to destroy your demo instances. Issue the following command terraform destroy to clean the AWS provider.

terraform's People

Contributors

ecs-digital-dominic-test-org avatar xin00163 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

terraform's Issues

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.