Skip to content

Instantly share code, notes, and snippets.

@SarahElson
Last active June 13, 2024 21:51
Speed Up Accessibility Testing With LambdaTest And Evinced
//imports...
public class LambdaTest {
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);
}
@AfterMethod
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());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment