Automation Testing With Selenium And Jest


Developed by Facebook, Jest is a JavaScript testing library for React web-applications. With Jest, you can perform snapshot testing to help you comprehend the state of your react trees which are transforming over time. It provides an excellent combination of a test runner & an assertion library. You can make use of built-in code coverage reports for figuring out the areas the files that aren’t a part of your test code. There is also a built-in mocking library. Jest also works with Typescript.

LambdaTest now integrates with Jest to boost your go-to-market delivery. Perform automated cross browser testing with LambdaTest to ensure your development code renders seamlessly through an on-cloud Selenium Grid providing 2000+ real browsers running through machines. Perform automation testing in parallel using LambdaTest’s Selenium Grid to drastically trim down your test cycles.

Prerequisites


  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:

Setup For Running Jest Integration With Selenium Grid.


Check our GitHub repository for Jest and Selenium WebDriver Code Sample.

Step 1: Navigate to the cloned directory.

Step 2:Install dependencies using npm install.

Step 3:In you command prompt/ terminal, route the pointer to the folder test.

Running Tests Using Jest On LambdaTest Selenium Grid


Execute the below command to run a single test:

Sample Code:

Test Your Locally Hosted Jest Scripts With LambdaTest


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 execute a test of your locally hosted Jest scripts on cloud to perform automated cross browser testing on 2000+ browsers offered by Selenium Grid on 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. Set tunnel value to true in test capabilities.

Execute the below command for running your locally hosted test cases:

Sample code for local testing:

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 “localhost.lambdatest.com” 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 192.168.2.6 you can instead test on “http://192.168.2.6/dashboard” or “http://localhost.lambdatest.com/dashboard”.

Fast track your automated cross browser testing process by executing your test cases using Jest on LambdaTest Selenium Grid. Happy testing!

Running Groovy Script In Katalon With LambdaTest Selenium Grid

As you perform testing with Katalon Studio, you can write or edit test automation scripts in the Script mode using Groovy programming language. This tutorial will help you run your Groovy script in Katalon with LambdaTest Selenium Grid.

Step 1: Open your Katalon Studio instance & go to Test explorer from the left side-bar.

Step 2: Right click on Test Listener folder & click on new listener.

Step 3: Name the new listener & paste the below code in the new listener.

That is all. Now, you can effortlessly run Groovy Scripts in Katalon for triggering your tests over LambdaTest cloud based cross browser testing platform. Happy testing! 🙂

Bamboo Integration With LambdaTest


Launched on 20 February 2007, Bamboo by Atlassian has become a worldwide adopted CI CD tool. With Bamboo Server, you can generate multi-level build plans with the ease of defining triggers to specific builds post commits. You could also assign crucial builds or deployments to a colleague. Bamboo is free for open-source projects.

LambdaTest provides an integration with Bamboo, using which you can perform cross browser testing on a cloud-based Selenium Grid consisting 2000+ real browsers, for both desktop & mobile. You can perform tests directly from your respective Bamboo server, so you could perform browser compatibility testing as soon as you commmit changes to your build. If you are running short on release window, then you can scale your tests as per you need. LambdaTest offers parallel testing to help you run multiple test cases, simultaneously. Now, you can chop down your release cycles and ship faster by integrating your LambdaTest account with your Bamboo CI CD server.

Prerequisites


  • You would need a Bamboo Server installed.
  • A GIT repository.
  • LambdaTest Authentication Credentials
  • 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:
      $ export LT_USERNAME= {your lambdatest username}
      $ export LT_ACCESS_KEY= {your lambdatest access_key}
    • For Windows:
      $ set LT_USERNAME= {your lambdatest username}
      $ set LT_ACCESS_KEY= {your lambdatest access_key}

Integrating LambdaTest With Bamboo Server


Step 1: Deploy your Bamboo server & login as an administrator.

Step 2: Create a new plan with Default stage & job.

Step 3: After creating a new job, we would need to add 3 tasks.

Add 3 Tasks

Step 4: To create your first task “Source Code Checkout”, you need to fetch the relevant Git repository.

Step 5: Task number two would require to you install the required package for npm.

Install npm package

Step 6: To create your third task, you would need to configure the below script for running a Protractor test.

Step 7: Now, you need to save the plan & run it. As you run the test you will find the below logs in Bamboo highlighting that the test was successfully executed on LambdaTest Selenium Grid.

Running Multiple Tests In Parallel


Parallel Testing is one of the most demanding features of LambdaTest Selenium Grid. By parallel testing, you can run more than one test case, simultaneously. So you can execute a single test scenario across different browsers or could run different test scenarios across the same browser but with different browser versions. Wondering how many parallel test cases can you run? That depends entirely on the number of concurrent session under your opted plan.

In order to run parallel tests using Bamboo integration with LambdaTest. You need to change the script in Step 6 as below.

Monitor and analyze your test result on the LambdaTest Automation Dashboard.

Deploy your code in a reliable manner at scale using Bamboo integration with LambdaTest, and ensure it looks robust across every browser to provide a seamless user experience to all your visitors. Happy Testing! 🙂

Real-time Testing Troubleshooting


Real-Time Testing allows you to perform live-interactive cross browser testing of your website on more than 2000+ real browsers & browser versions running on various operating systems in the cloud. LambdaTest provides you real-time testing experience by virtual machines hosted on our cloud servers.

We have observed that in certain scenarios, users face issues while connecting to our Selenium Grid. This document will help you troubleshoot such scenarios.

Why Real-Time Testing Is Failing?


It might be possible the WebSockets are either blocked on your network or on your local browsers, which are used to access the LambdaTest platform. You can validate if the website is blocked using the below link:
https://www.websocket.org/echo.html

In case your website is blocked, we request you to ask your network admin to open up the web sockets for LambdaTest platform.

For better performance of the LambdaTest platform, we recommend using the latest Google Chrome browser version to access the platform.

Integrate Azure Pipelines With LambdaTest


Azure Pipelines is a service presented by Azure DevOps to help projects ship faster with the help of a robust pipeline. With Azure Pipelines you can easily generate a build, test it before deploying the changes live in any language you are comfortable with i.e. Node.js, Python, Java, PHP, Ruby, C/C++, .NET etc. The platform offers unlimited CI/CD minutes for open-source projects, along with 10 free parallel jobs. Azure pipelines offers great cross-platform support using which you can run jobs in parallel across Windows, macOS, Linux.

LambdaTest now integrates with Azure to boost your go-to-market delivery. Perform automated cross browser testing with LambdaTest to ensure your development code renders seamlessly through an online Selenium grid providing 2000+ real browsers running through machines, on the cloud. Perform automation testing in parallel with LambdaTest’s Selenium grid to drastically trim down your test cycles.

Pre-requisite


  1. An Azure CI account.
  2. A Git or GitHub repository.
  3. LambdaTest Authentication Credentials
  4. 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:

Integrating LambdaTest with Azure Pipelines


First and foremost, you need to clone our GitHub repository for downloading the relevant code needed to integrate Azure Pipelines with LambdaTest.

Step 1: First and foremost, we need to create a project. Populate the relevant fields as you wish and hit the create button.

Create a project

Step 2: Now, Azure Pipelines will ask you about the location of your code. If you have your code repository in GitHub then select the option for GitHub from the values.

Step 3: After you choose an option for your code repository, you will be asked to login. Post login, you need to choose the particular repository. The repository will pick the azure-pipelines.yml file.

Step 4: Executing the above file will run the script in LambdaTest Grid successfully. See the below image of the output.

Parallel Testing


For running the test in parallel, replace protractor single.conf.js with protractor parallel.conf.js in same YML file.

Monitor and analyze your test result on the LambdaTest Automation Dashboard.

Deploy your code in a reliable manner at scale using Azure integration with LambdaTest, and ensure it looks robust across every browser to provide a seamless user experience to all your visitors. Happy Testing!

Lambda Tunnel Modifiers


This document will help you understand all the modifiers/arguments used with Lambda Tunnel to help you test your locally hosted web pages.

Command
Example
Description
-key
abcd1234efgh
Access key of the user.
-port
8080
(optional) Local port to connect tunnel.
-proxy-host
WonderProxy
Full hostname for the proxy you’d like to use.
-proxy-pass
WonderProxy_Pass
WonderProxy password of the user.
-proxy-port
22
The port declared by you for fetching the proxy.
-proxy-user
WonderProxy_Username
WonderProxy username of the user.
-tunnelName
admin12
(optional) Name of the tunnel.
-user
abc@lambdatest.com
Registered email ID of the user.

TeamCity Integration With LambdaTest


Developed by JetBrains, TeamCity is Java-based build management to help you with continuous integration and continuous deployment. With TeamCity, you can deploy your automated pipeline quicker, pacing your go-to-market launch.

LambdaTest now integrates with TeamCity to boost your go-to-market delivery. Perform automated cross browser testing with LambdaTest to ensure your development code renders seamlessly through an online Selenium grid providing 2000+ real browsers running through machines, on the cloud. Perform automation testing in parallel with LambdaTest’s Selenium grid to drastically trim down your test cycles.

Prerequisites


  • TeamCity server along with one TeamCity Agent installed.
  • Make sure team city Agent has Node and Protractor installed
  • A GIT repository.
  • LambdaTest Authentication Credentials
  • 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:
      $ export LT_USERNAME= {your lambdatest username}
      $ export LT_ACCESS_KEY= {your lambdatest access_key}
    • For Windows:
      $ set LT_USERNAME= {your lambdatest username}
      $ set LT_ACCESS_KEY= {your lambdatest access_key}

Integrating LambdaTest with TeamCity


Step 1: Go to your TeamCity server URL.

Step 2: Go to Administration and create a new project manually.

create a new project manually

Step 3: After filing details and click on the Create button.

Step 4: Create a new VCS root using the below form. Required inputs are: Git Repo URL into Fetch URL and Authentication method is password where you need to pass your git username/ password.

Create a new VCS root

Step 5: Fill details, test connection and click on the Create button.

Step 6: Go to the General Settings screen for the added project. Now, create a build configuration.

build configuration

Step 7: Go to Build Step page and add a build step as below.
add a build step

Step 8: Save build step and go to Parameters and create two environment variables as below where LT_USERNAME and LT_ACCESS_KEY will be your authentication credentials for LambdaTest.

Environment Variables

Step 9: Go to Project Dashboard and Run your project. Now, notice the status of test running successfully on LambdaTest Grid with the below log.

LambdaTest Log

Running Test in Parallel


Parallel Testing is one of the most demanding features of LambdaTest Selenium Grid. By parallel testing, you can run more than one test case, simultaneously. This means that Parallel testing would allow you to execute numerous automation test cases altogether. So you execute a single test scenario across different browsers or could run different test scenarios across the same browser but with different browser versions.

Clone our GitHub repository for TeamCity to execute your first parallel test of TeamCity + LambdaTest Integration.

After you clone our GitHub repository, execute the below command in cmd/terminal.

The above command will trigger the execution of below code for performing parallel testing at LambdaTest Selenium Grid.

Kudos! Now you can Deploy your code in a reliable manner at scale using TeamCity integration with LambdaTest, and ensure it looks robust across every browser to provide a seamless user experience to all your visitors. Happy Testing! 🙂

White-listing Proxy With LambdaTest


If you are accessing the internet through a firewall-protected network then you may face an issue in connecting with LambdaTest. You may encounter the below error messages:

In such scenarios, you may need to whitelist LambdaTest domain. Whitelisting is a process which conveys your firewall-protected network to allow access for a set of IP addresses, IP range, or an entire domain trusted by you. Whitelisting is a security procedure to help users access a website or web-app which is considered to be non-malicious by their network security team.

You can relay the below domain to your network security team, asking them to whitelist it so you could connect with LambdaTest from your firewall protected network.

Protocol

Ports

Source

Destination

TCP

80, 443, 22

All LambdaTest Clients

*.lambdatest.com

In case of any queries or special request related to whitelisting, just give us a shout.

Changing Individual Test Details


There may be times when you wish to manipulate individual test details from your automation test build while performing automation testing with Selenium Grid on LambdaTest. This document will help you perform basic test operations for a particular test you wish to update.

Marking Test Status As Pass Or Fail


While performing automation testing with Selenium on LambdaTest Selenium Grid, you may face a scenario where a test that you declared as fail in your local instance may turn out to be completed successfully at LambdaTest. Don’t worry though! We understand how imperative it is to flag an automation test as either “pass” or “fail” depending upon your testing requirement with respect to the validation of expected behaviour.

If you wish to mark a test status as fail/pass at LambdaTest then you can do so by executing the below code:

  • To mark test status to fail.
  • To mark test status to pass.

Renaming Your Test


Sometimes, you may wish to rename your test, after placing it under execution. You can do that with the help of below code:

Semaphore CI Integration With LambdaTest


Semaphore is a hosted continuous integration and deployment service used for testing and deploying software projects hosted on GitHub and BitBucket. While open source projects can use Semaphore for free in its full capacity, free use for private projects is limited to 100 builds per month.

LambdaTest now integrates with Semaphore CI to boost your go-to-market delivery. Perform automated cross browser testing, hand in hand with your CI/CD pipeline and ensure your web-app renders seamlessly on more than 2000 real browsers and browser versions. Using LambdaTest Selenium Grid, you can fully automate your continuous testing process and trim down your test cycles, significantly.

Prerequisites For Integrating Semaphore CI With LambdaTest


We will be performing demonstration by using the Protractor framework

  1. Global Dependencies
    • 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
    • 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.

Integrating LambdaTest With Semaphore CI


A few changes in the .semaphore/semaphore.yml is all you need for integrating LambdaTest With Semaphore CI. The These changes would include replacing the environment variables such as access key, username, grid config and so on, according to your test configurations.

Here is a sample config file for integrating your LambdaTest account with your Semaphore CI instacnce. You can also find the below code at our GitHub repository of Semaphore.

LambdaTest offers a Selenium Desired Capabilities Generator to fetch coded values for your desired test configurations.
For Instance, if you select the below configurations:

Fields
Selected Values
Operating System
Windows 8.1
Browser
Mozilla Firefox
Browser Version
62.0
Resolution
1280×1024
Selenium Version
3.11.0

Then Capabilities Generator at LambdaTest will provide you with the below program:

For more information, refer to our documentation on Selenium Automation Capabilities.

Testing Locally Hosted or Privately Hosted Projects


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 execute a test server inside your Semaphore CI build container to perform automated cross browser testing on browsers offered by Selenium grid on 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.

Now, let us take an example of Semaphore.yml for Lambda Tunnel.

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

Parallel Testing


Parallel Testing is one of the most demanding features of LambdaTest Selenium Grid. By parallel testing, you can run more than one test case, simultaneously. This means that Parallel testing would allow you to execute numerous automation test cases altogether. So you execute a single test scenario across different browsers or could run different test scenarios across the same browser but with different browser versions.

To perform automation testing in parallel on Windows use the below command.

Monitor and analyze your test result on the LambdaTest Automation Dashboard. Deploy your code in a reliable manner at scale using Semaphore CI integration with LambdaTest, and ensure it looks robust across every browser to provide a seamless user experience to all your visitors. Happy Testing!