use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.
the class ViewAccessScopedWebAppTest method testForward.
@Test
@RunAsClient
public void testForward() throws Exception {
driver.get(new URL(contextPath, "page1.xhtml").toString());
WebElement inputFieldX = driver.findElement(By.id("testForm1:valueInputX"));
inputFieldX.sendKeys("abc");
WebElement inputFieldY = driver.findElement(By.id("testForm1:valueInputY"));
inputFieldY.sendKeys("xyz");
WebElement button = driver.findElement(By.id("testForm1:next"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("valueX"), "abc").apply(driver));
button = driver.findElement(By.id("testForm2:back"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("valueOutputX"), "abc").apply(driver));
Assert.assertFalse(ExpectedConditions.textToBePresentInElement(By.id("valueOutputY"), "xyz").apply(driver));
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.
the class WindowMaxCountTest method maxWindowPerSessionTest.
@Test
@RunAsClient
public void maxWindowPerSessionTest() throws MalformedURLException {
// PAGE 1 - REQUEST 1
driver.get(new URL(contextPath, "windowcount.xhtml").toString());
// click once
WebElement button = driver.findElement(By.id("form:count"));
button.click();
WebElement value = driver.findElement(By.id("form:value"));
Assert.assertEquals("1", value.getText());
driver.get(driver.getCurrentUrl());
// click twice
button = driver.findElement(By.id("form:count"));
button.click();
value = driver.findElement(By.id("form:value"));
Assert.assertEquals("2", value.getText());
String page1 = driver.getCurrentUrl();
// PAGE 2 - REQUEST 2
driver.get(new URL(contextPath, "windowcount.xhtml").toString());
// click once
button = driver.findElement(By.id("form:count"));
button.click();
value = driver.findElement(By.id("form:value"));
Assert.assertEquals("1", value.getText());
driver.get(driver.getCurrentUrl());
// click twice
button = driver.findElement(By.id("form:count"));
button.click();
value = driver.findElement(By.id("form:value"));
Assert.assertEquals("2", value.getText());
// PAGE 3 - REQUEST 3 to force the oldest (page 1) WindowScope to drop
driver.get(new URL(contextPath, "windowcount.xhtml").toString());
// click once
button = driver.findElement(By.id("form:count"));
button.click();
value = driver.findElement(By.id("form:value"));
Assert.assertEquals("1", value.getText());
driver.get(driver.getCurrentUrl());
// click twice
button = driver.findElement(By.id("form:count"));
button.click();
value = driver.findElement(By.id("form:value"));
Assert.assertEquals("2", value.getText());
String page3 = driver.getCurrentUrl();
// PAGE 1 - REQUEST 4 on previous PAGE 1 page (value should get dropped to 0)
driver.get(new URL(page1).toString());
// click once
button = driver.findElement(By.id("form:count"));
button.click();
value = driver.findElement(By.id("form:value"));
// Value should return to 1
Assert.assertEquals("1", value.getText());
// PAGE 3 - REQUEST 5 on previous PAGE 3 page (page 1 and page 3 should be the two active pages)
driver.get(new URL(page3).toString());
button = driver.findElement(By.id("form:count"));
// click once
button.click();
value = driver.findElement(By.id("form:value"));
// Value should continue to 3
Assert.assertEquals("3", value.getText());
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.
the class WindowScopedContextTest method testWindowId.
@Test
@RunAsClient
public void testWindowId() throws Exception {
System.out.println("contextpath= " + contextPath);
//X comment this in if you like to debug the server
//X I've already reported ARQGRA-213 for it
//X Thread.sleep(600000L);
driver.get(new URL(contextPath, "page.xhtml").toString());
WebElement inputField = driver.findElement(By.id("test:valueInput"));
inputField.sendKeys("23");
WebElement button = driver.findElement(By.id("test:saveButton"));
button.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("valueOutput"), "23").apply(driver));
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.
the class InjectionDroneTest method testValidatorWithError.
@Test
@RunAsClient
public void testValidatorWithError() throws MalformedURLException {
driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString());
WebElement convertedValue = driver.findElement(By.id("validator:stringValue"));
convertedValue.sendKeys("Wrong Value");
WebElement testConveterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConveterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("validator:errorMessage"), "Not a valid value").apply(driver));
}
use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.
the class InjectionDroneTest method testValidator.
@Test
@RunAsClient
public void testValidator() throws MalformedURLException {
driver.get(new URL(contextPath, "testValidatorConverter.xhtml").toString());
WebElement convertedValue = driver.findElement(By.id("validator:stringValue"));
convertedValue.sendKeys("DeltaSpike");
WebElement testConveterButton = driver.findElement(By.id("validator:testValidatorButton"));
testConveterButton.click();
Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("messages"), "Worked").apply(driver));
}
Aggregations