Search in sources :

Example 6 with RunAsClient

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));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 7 with RunAsClient

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());
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 8 with RunAsClient

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));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 9 with RunAsClient

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));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 10 with RunAsClient

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));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)62 Test (org.junit.Test)61 URL (java.net.URL)49 WebElement (org.openqa.selenium.WebElement)34 QName (javax.xml.namespace.QName)9 Service (javax.xml.ws.Service)9 Bus (org.apache.cxf.Bus)9 OperateOnDeployment (org.jboss.arquillian.container.test.api.OperateOnDeployment)9 WrapThreadContextClassLoader (org.jboss.as.test.integration.ws.WrapThreadContextClassLoader)9 IOException (java.io.IOException)6 ActAsServiceIface (org.jboss.as.test.integration.ws.wsse.trust.actas.ActAsServiceIface)6 OnBehalfOfServiceIface (org.jboss.as.test.integration.ws.wsse.trust.onbehalfof.OnBehalfOfServiceIface)6 HttpResponse (org.apache.http.HttpResponse)5 HttpGet (org.apache.http.client.methods.HttpGet)5 ServiceIface (org.jboss.as.test.integration.ws.wsse.trust.service.ServiceIface)5 ModelNode (org.jboss.dmr.ModelNode)5 InSequence (org.jboss.arquillian.junit.InSequence)4 Response (javax.ws.rs.core.Response)3 HashMap (java.util.HashMap)2 Hashtable (java.util.Hashtable)2