ButtonElement button = buttons.get(0);
button.click();
// ensure dialog opened
waitForElementPresent(By.className("v-window"));
WindowElement window = $(WindowElement.class).first();
// ensure correct attributes
assertEquals("alertdialog", window.getAttribute("role"));
WebElement header = window.findElement(By.className("v-window-header"));
assertEquals(header.getAttribute("id"),
window.getAttribute("aria-labelledby"));
WebElement label = window.findElement(By.className("v-label"));
assertEquals(label.getAttribute("id"),
window.getAttribute("aria-describedby"));
List<WebElement> wButtons = window.findElements(By
.className("v-button"));
assertEquals("button", wButtons.get(0).getAttribute("role"));
assertEquals("button", wButtons.get(1).getAttribute("role"));
// close dialog
wButtons.get(0).click();
// ensure dialog closed
List<WindowElement> windows = $(WindowElement.class).all();
assertTrue(windows.isEmpty());
// check additional description (second checkbox on the page)
List<CheckBoxElement> checkBoxes = $(CheckBoxElement.class).all();
WebElement input = checkBoxes.get(1).findElement(By.tagName("input"));
// ensure that not checked yet
assertEquals(null, input.getAttribute("checked"));
input.click();
// ensure that checked now
assertEquals("true", input.getAttribute("checked"));
// open alert dialog
button = $(ButtonElement.class).first();
button.click();
waitForElementPresent(By.className("v-window"));
// ensure correct attributes
window = $(WindowElement.class).first();
List<WebElement> labels = window.findElements(By.className("v-label"));
assertEquals(labels.get(0).getAttribute("id") + " "
+ labels.get(1).getAttribute("id"),
window.getAttribute("aria-describedby"));
// close dialog
wButtons = window.findElements(By.className("v-button"));
wButtons.get(0).click();
// ensure dialog closed
windows = $(WindowElement.class).all();
assertTrue(windows.isEmpty());
// add prefix and postfix
List<TextFieldElement> textFields = $(TextFieldElement.class).all();
textFields.get(0).sendKeys("Important");
textFields.get(1).sendKeys(" - do ASAP");
// open alert dialog
button = $(ButtonElement.class).first();
button.click();
waitForElementPresent(By.className("v-window"));
// ensure the assistive spans have been added to the header
window = $(WindowElement.class).first();
header = window.findElement(By.className("v-window-header"));
List<WebElement> assistiveElements = header.findElements(By
.className("v-assistive-device-only"));
assertEquals("Important",
assistiveElements.get(0).getAttribute("innerHTML"));
assertEquals(" - do ASAP",