2019-03-25 04:19:43 +07:00
|
|
|
import SeleniumWebDriver, { WebDriver } from "selenium-webdriver";
|
2019-03-25 05:29:46 +07:00
|
|
|
import VerifyHasAppeared from "./VerifyHasAppeared";
|
2019-03-25 04:19:43 +07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Verify if a button with given content exists in the DOM.
|
|
|
|
* @param driver The selenium web driver.
|
|
|
|
* @param content The content of the button to find in the DOM.
|
|
|
|
*/
|
|
|
|
export default async function(driver: WebDriver, content: string) {
|
2019-03-25 05:29:46 +07:00
|
|
|
try {
|
|
|
|
await VerifyHasAppeared(driver, SeleniumWebDriver.By.xpath("//button[text()='" + content + "']"));
|
|
|
|
} catch (err) {
|
|
|
|
throw new Error(`Button with content "${content}" should have appeared.`);
|
|
|
|
}
|
2019-03-25 04:19:43 +07:00
|
|
|
}
|