Introducing Evinced Support for LambdaTest

Anyone doing functional tests is interested in getting as much value as possible from them. One way to really up your game is to add accessibility testing as well.

Effective today, we’ve made that even easier. We’re announcing native support for LambdaTest inside our Selenium SDK products.

If you don’t know, LambdaTest is a hugely successful cross-browser testing platform known for fast, reliable test execution and orchestration. Their Selenium grid allows for automated testing across 3,000 browsers and operating systems.

How this helps

If you have used other accessibility integrations with Selenium, you know that you have to add an accessibility scan after every significant interaction on the page. So an end-to-end test might require 10 separate scans…and dozens of separate reports that somebody has to manage.

But Evinced’s auto-testing SDK, and its Selenium integration, changes all that. With us, you don’t need to alter individual test code, and you get one consolidated, helpful report (complete with fix recommendations) at the end. Plus our computer vision approach allows us to find critical accessibility bugs that used to require manual testing.

Setting up a test

So with our LambdaTest support, you can get all this AND run your tests across their impressive Selenium grid, quickly and intelligently.

Let’s take a look at how easy it is to do.

First, let’s take a look at our LambdaTest example test:

//imports...

public class LamdaTest {
    private String testName;
    public static final String demoPage = "https://demo.evinced.com/";
    private RemoteWebDriver webDriver;
    private String Status = "failed";

    @BeforeMethod
    public void setup(Method m, ITestContext ctx) throws MalformedURLException {
      String username = System.getenv("LT_USERNAME");
      String authkey = System.getenv("LT_ACCESS_KEY");
      String hub = "@hub.lambdatest.com/wd/hub";

      DesiredCapabilities caps = new DesiredCapabilities();
      caps.setCapability("platform", "Windows 10");
      caps.setCapability("browserName", "Chrome");
      caps.setCapability("version", "92.0");
      caps.setCapability("resolution", "1024x768");
      caps.setCapability("build", "TestNG With Java");
      caps.setCapability("name", m.getName() + this.getClass().getName());
      caps.setCapability("plugin", "git-testng");
      String[] Tags = new String[] { "Feature", "Magicleap", "Severe" };
      caps.setCapability("tags", Tags);
      webDriver = new RemoteWebDriver(new URL("https://" + username + ":" + authkey + hub), caps);
    }
    
    @After
    public void tearDown() {
        webDriver.quit();
    }
    
    @Test
    public void evincedTrvlTest() {
        webDriver.get(demoPage);
        // Click "Your New Home" dropdown
        driver.findElement(By.cssSelector("div.filter-container > div:nth-child(1) > div > div.dropdown.line")).click();
        // Click "Where" dropdown
        webDriver.findElement(By.cssSelector("div.filter-container > div:nth-child(2) > div > div.dropdown.line")).click();
        // Click "When" date picker
        webDriver.findElement(By.cssSelector(".react-date-picker")).click();
        // Click on the "Search" Button
        webDriver.findElement(By.className("search-btn")).click();
        // Assert we have navigated to the results page
        Assert.assertEquals("Page two | Evinced, Demos site", driver.getTitle());
    }
}

Take a look at the @Before method above. This is where we will want to initiate the EvincedWebDriver class by passing in the RemoteWebDriver instance webDriver that has created a Selenium session on the LambdaTest cloud. (Check out the LambdaTest capabilities generator for all the information needed to select a testing environment.)

We can then start the Evinced engine using the evStart() method in line 24 below. It’s worth emphasizing that once this is called, the engine will continuously run in the background, tracking all DOM changes as the tests execute, and collecting accessibility violations along the way.

private EvincedWebDriver driver;

  @BeforeMethod
  public void setup(Method m, ITestContext ctx) throws MalformedURLException {
  
      String username = System.getenv("LT_USERNAME");
      String authkey = System.getenv("LT_ACCESS_KEY");
      String hub = "@hub.lambdatest.com/wd/hub";
  
      DesiredCapabilities caps = new DesiredCapabilities();
      caps.setCapability("platform", "Windows 10");
      caps.setCapability("browserName", "Chrome");
      caps.setCapability("version", "92.0");
      caps.setCapability("resolution", "1024x768");
      caps.setCapability("build", "TestNG With Java");
      caps.setCapability("name", m.getName() + this.getClass().getName());
      caps.setCapability("plugin", "git-testng");
      String[] Tags = new String[] { "Feature", "Magicleap", "Severe" };
      caps.setCapability("tags", Tags);
  
      webDriver = new RemoteWebDriver(new URL("https://" + username + ":" + authkey + hub), caps);
      driver = new EvincedWebDriver(webDriver);
      driver.manage().timeouts().implicitlyWait(20, TimeUnit.SECONDS);
      driver.evStart();
  }

Last, we need to tell the engine when to stop and generate the accessibility reports. We can do that in the @After method. A Report object is created when we stop the Evinced engine using the evStop() method. Once the engine is stopped, we’ll then be able to export the accessibility report as a JSON or HTML report (or both!).

@After
public void tearDown() {
    // Stop the Evinced engine and generate the report object
    Report report = driver.evStop();
    // Export the report - JSON
    EvincedReporter.writeEvResultsToFile("Evinced-LambdaTest-A11y-JSONReport", report, EvincedReporter.FileFormat.JSON);
    // Export the report - HTML
    EvincedReporter.writeEvResultsToFile("Evinced-LambdaTest-A11y-HTMLReport", report, EvincedReporter.FileFormat.HTML);
    driver.quit();
}

Running a test

We are now ready to execute our test. Here, we are running it on a test site, and this is what the results look like when done:

Results of running a Selenium test utilizing Lambdatest inside Evinced

Not only do we gain all of the additional insights provided by LambdaTest such as videos, logs, screenshots, and HAR file to make debugging our functional test quicker and easier, but we also get a detailed Evinced HTML and/or JSON accessibility report containing all issues found, severity levels, descriptions, effect on end users, and actionable information on how to resolve the issues.

Detailed Evinced report for accessibility issues from the Selenium test run

If you’re using LambdaTest already, this is a no-brainer, and if you’re not, feel free to check them out. We’re pretty sure that once you start testing accessibility this way, you’ll never way to turn back the clock.