LambdaTestAutomation Testing ● AngularJS Test Automation: Perform AngularJS Automated Testing using Cloud Selenium Grid

AngularJS Test Automation: Perform AngularJS Automated Testing using Cloud Selenium Grid

Developed by AngularJS team, Karma is a Javascript test runner that helps to evaluate your source code across different browsers on the basis of your test code. The results are displayed using CLI to represent the test’s pass/fail status on various browsers. To know more refer to the Karma’s official website.


LambdaTest Selenium Automation Grid is a cloud-based, scalable Selenium testing platform which enables you to run your automation scripts on 2000+ different browsers and operating systems. You can now run your JavaScript Selenium automated test cases on a scalable Selenium infrastructure that is running real browsers and real operating systems.

This topic will help you demonstrate:

  • How to perform AngularJS automated testing on Lambdatest Selenium grid with Karma test runner?
  • How to test your locally hosted pages using AngularJS test automation?
  • How to run your test cases in parallel using AngularJS test automation to reduce build times?
  • How to leverage LambdaTest’s Advanced capabilities for AngularJS test automation?

Prerequisites For Running Karma With Our Online Selenium Grid

In order to perform your karma tests with LambdaTest, you would need the below things to be already set up:

  1. Global Dependencies
    • Make sure to use the latest version of JavaScript.
    • A Git or GitHub repository
    • Download and install node.js and node package manager or npm.

      To install node.js with homebrew use the below command.

    • If you have npm already installed, you may want to upgrade it to latest version. Here the code you can run in your terminal to upgrade npm.

  2. LambdaTest Authentication Credentials
  3. Be aware of your LambdaTest authentication credentials i.e. your LambdaTest username, access key and HubURL. You need to set them up as your environment variables. You can retrieve them from your LambdaTest automation dashboard by clicking on the key icon near the help button.

    • For Linux/Mac:

    • For Windows:

Setting Up The Environment for AngularJS Test Automation

You need to clone our GitHub repository which demonstrates a sample of Karma-Angular.

After cloning, you need to navigate to the cloned directory and install project dependencies using the below command:

The example mentioned below would help you to execute your AngularJS automation testing on Google Chrome.

Perform AngularJS Automated Testing with Karma Test Runner

Navigate to the directory where you cloned the sample of Karma-Angular and run the following command.

or you could also run the test using:

Browser Launcher Configuration

If you look at karma.conf.js file you will find that we are passing browser, browser version, and operating system information, along with LambdaTest Selenium grid capabilities via capabilities object. The capabilities object in the above code is defined as:

The most important capabilities to understand here are ‘browserName’, ‘version’, and ‘platform’. They define which browser environment you wish to run the test on. Rest of the capabilities are important in test management and debugging. We have an inbuilt Capabilities Generator tool as well that you use to generate capabilities code for your test suite.

Testing Locally Hosted Projects using Angular Test Automation

To help you perform cross browser testing of your locally stored web pages, LambdaTest provides an SSH(Secure Shell) tunnel connection with the name Lambda Tunnel. With Lambda Tunnel, you can perform AngularJS automated testing with Karma test runner to perform automated cross browser testing on browsers offered by online Selenium grid at LambdaTest. So you make sure how well your changes look, even before your customers. Curious to know more about Lambda Tunnel?

Follow our documentation on Lambda Tunnel to know it all. OS specific instructions to download and setup tunnel binary can be found at the following links.

Once, the tunnel is successfully set up. You can add the below code to your capabilities for testing internal servers on your network.

Important Note: Some Safari & IE browsers, doesn’t support automatic resolution of the URL string “localhost”. Therefore if you test on URLs like "http://localhost/" or "http://localhost:8080" etc, you would get an error in these browsers. A possible solution is to use "" or replace the string “localhost” with machine IP address. For example, if you wanted to test "http://localhost/dashboard" or, and your machine IP is you can instead test on "" or "".

Avoid Timeouts With psuedoActivityInternal

To make sure our machines are not holding for long due to some incorrect test, we have come up with a restriction on the number of seconds that our machine is kept reserved for you. In cases, where our servers fail to retrieve a request from your local machine for more than 90 seconds, then your tests are aborted from the queue with the error message related to Timeouts.

If you wish to avoid such timeouts, you need to make use of the below parameter:

Note: psuedoActivityInternal is presented as a default parameter with a value set to 0. Make sure to provide a value more than 0 in order to avoid the timeouts.

Perform AngularJS automation testing with Karma test runner & increase your test coverage using LambdaTest’s online Selenium Grid. Happy Testing!