-
-
Save evandrocoan/280ecaffa82eea9c4d5edc3382a2802c to your computer and use it in GitHub Desktop.
A Selenium test to check if a sound is playing / has played
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Test(testName = "Listen for Sound", description = "Check that, when clicking the 'A' key, a sound is played", groups = {"01Drums"}) | |
public void soundPlayTest() throws InterruptedException { | |
driver.findElement(By.xpath("/html/body/div[2]/div[1]")).click(); | |
WebElement aKey = driver.findElement(By.xpath("/html/body/div/div[1]")); | |
Actions builder = new Actions(driver); | |
Action sendAKey = builder.moveToElement(aKey).sendKeys("A").build(); | |
sendAKey.perform(); | |
Thread.sleep(1000); | |
WebElement audio = driver.findElement(By.tagName("audio")); | |
Assert.assertNotEquals(audio.getAttribute("currentTime"), "0"); | |
// Assert.assertTrue(Boolean.parseBoolean(audio.getAttribute("ended"))); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment