Skip to content

Files

Latest commit

 

History

History
181 lines (138 loc) · 8.36 KB

selenium-hyprerexecute-accessibility-tests.md

File metadata and controls

181 lines (138 loc) · 8.36 KB
id title hide_title sidebar_label description keywords url site_name slug
selenium-hyprerexecute-accessibility-tests
Automation Tests with Accessibility Tool using Selenium
false
Selenium
Use LambdaTest Accessibility DevTools to detect and report accessibility issues with automation, following WCAG guidelines, in your selenium tests
LambdaTest
Accessibility
Testing
selenium
Automation
Accessibility Testing Settings
LambdaTest
selenium-hyprerexecute-accessibility-tests/

import CodeBlock from '@theme/CodeBlock'; import {YOUR_LAMBDATEST_USERNAME, YOUR_LAMBDATEST_ACCESS_KEY} from "@site/src/component/keys"; import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem';

<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify({ "@context": "https://schema.org", "@type": "BreadcrumbList", "itemListElement": [{ "@type": "ListItem", "position": 1, "name": "Home", "item": "https://www.lambdatest.com" },{ "@type": "ListItem", "position": 2, "name": "Support", "item": "https://www.lambdatest.com/support/docs/" },{ "@type": "ListItem", "position": 3, "name": "Cypress Accessibility Testing", "item": "https://www.lambdatest.com/support/docs/selenium-hyprerexecute-accessibility-tests/" }] }) }} ></script>

This document provides a detailed, step-by-step way to execute your accessibility tests using LambdaTest's Accessibility Tool on HyperExecute. :::note This documentation is applicable for all supported languages for Selenium framework.

Please reach out to our <span className="doc__lt" onClick={() => window.openLTChatWidget()}>support team to enable the Accessibility feature for your organization. :::

Prerequisites

To run the Tests on HyperExecute from your Local System, you are required:

Step-by-Step Guide to Trigger Your Test

Step 1: Configure Your Test Suite

You can use your own Selenium project to configure and test it. For demo purposes, we are using the TestNG sample repository.

:::tip Sample repo Download or Clone the code sample for the TestNG from the LambdaTest GitHub repository to run the tests on the HyperExecute.

<img loading="lazy" src={require('../assets/images/icons/github.png').default} alt="Image" className="doc_img"/> View on GitHub :::

If you are using your own project, make sure you update the Hub endpoint in your tests file. By setting up the Hub endpoint, you establish the communication channel between your tests and the browser nodes, enabling effective test distribution and execution.

Configure the desired capabilities based on your test requirements. For example:

DesiredCapabilities capabilities = new DesiredCapabilities();
capabilities.setCapability("browserName", "chrome");
capabilities.setCapability("version", "70.0");
capabilities.setCapability("platform", "win10"); // If this cap isn't specified, it will just get the any available one
capabilities.setCapability("build", "LambdaTestSampleApp");
capabilities.setCapability("name", "LambdaTestJavaSample");

You can also use dev and beta browser versions. To generate capabilities for your test requirements, you can use our inbuilt 🔗 Capabilities Generator Tool.

Step 2: Setup the CLI in your Test Suite

After cloning / downloading the sample repo, you need to setup the CLI and the environment variables.

Download the HyperExecute CLI

The CLI is used for triggering the tests on HyperExecute. It is recommend to download the CLI binary on the host system and keep it in the root directory of the suite to perform the tests on HyperExecute.

You can download the CLI for your desired platform from the below mentioned links:

Platform HyperExecute CLI
Windows https://downloads.lambdatest.com/hyperexecute/windows/hyperexecute.exe
MacOS https://downloads.lambdatest.com/hyperexecute/darwin/hyperexecute
Linux https://downloads.lambdatest.com/hyperexecute/linux/hyperexecute

Setup Environment Variable

Now, you need to export your environment variables LT_USERNAME and LT_ACCESS_KEY that are available in the LambdaTest Profile page.

Run the below mentioned commands in your terminal to setup the CLI and the environment variables.

{`export LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}" export LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}
{`set LT_USERNAME="${ YOUR_LAMBDATEST_USERNAME()}" set LT_ACCESS_KEY="${ YOUR_LAMBDATEST_ACCESS_KEY()}"`}

Step 3: Add the Capabilities to enable the Accessibility

To generate the accessibility reports, add a capability accessibility: true in your test files. You can also define some advanced capabilities like accessibility.wcagVersion, accessibility.bestPractice, and accessibility.needsReview as shown below:

capabilities.setCapability("accessibility", true); // Enable accessibility testing
capabilities.setCapability("accessibility.wcagVersion", "wcag21a"); // Specify WCAG version (e.g., WCAG 2.1 Level A)
capabilities.setCapability("accessibility.bestPractice", false); // Exclude best practice issues from results
capabilities.setCapability("accessibility.needsReview", true); // Include issues that need review

Step 4: Configure your YAML file

Configure your YAML file as per your use cases using key value pairs. In this sample YAML file, we have mentioned:

  • version of the YAML file
  • Timeouts for executing your project
  • Mode of execution is Autosplit. You can also opt for Matrix or Hybrid mode.
  • Pre and Post commands
  • Reports and Artefacts that will be generated after the completion of tests
  • and other necessary YAML Parameters
https://github.com/LambdaTest/testng-selenium-hyperexecute-sample/blob/main/yaml/linux/v2/testng_hyperexecute_autosplit_sample.yaml

Step 5: Execute your Test Suite

NOTE : In case of MacOS, if you get a permission denied warning while executing CLI, simply run chmod u+x ./hyperexecute to allow permission. In case you get a security popup, allow it from your System PreferencesSecurity & PrivacyGeneral tab.

Run the below command in your terminal at the root folder of the project:

./hyperexecute --config RELATIVE_PATH_OF_YOUR_YAML_FILE

OR use this command if you have not exported your username and access key in the step 2.

{`./hyperexecute --user ${ YOUR_LAMBDATEST_USERNAME()} --key ${ YOUR_LAMBDATEST_ACCESS_KEY()} --config RELATIVE_PATH_OF_YOUR_YAML_FILE `}

Step 6: Monitor the Test Execution

Visit the HyperExecute Dashboard and check your Job status.

<img loading="lazy" src={require('../assets/images/accessibility-testing/hyp-selenium.gif').default} alt="automation-dashboard" className="doc_img"/>