Search in sources :

Example 31 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.

the class ViewConfigTestDrone method testNavigationActionWithoutError.

@Test
@RunAsClient
public void testNavigationActionWithoutError() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    WebElement button = driver.findElement(By.id("destination:pb002ActionWithoutError"));
    button.click();
    Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"), "You arrived at overview page").apply(driver));
    // Was redirected ?
    Assert.assertTrue(driver.getCurrentUrl().contains("overview.xhtml"));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 32 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.

the class NavigationParameterTest method testNavigationActionWithParameter.

@Test
@RunAsClient
public void testNavigationActionWithParameter() throws MalformedURLException {
    //first click
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    WebElement button = driver.findElement(By.id("parameter:pb004ActionMethod"));
    button.click();
    //second click
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    button = driver.findElement(By.id("parameter:pb004ActionMethod"));
    button.click();
    Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("simplePageConfig"), "You arrived at simplePageConfig page").apply(driver));
    Assert.assertTrue(driver.getCurrentUrl().contains("cv="));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 33 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project deltaspike by apache.

the class NavigationParameterTest method testNavigationActionOverview.

@Test
@RunAsClient
public void testNavigationActionOverview() throws MalformedURLException {
    driver.get(new URL(contextPath, "origin.xhtml").toString());
    WebElement button = driver.findElement(By.id("parameter:pb005Overview"));
    button.click();
    Assert.assertTrue(ExpectedConditions.textToBePresentInElement(By.id("overviewPage"), "You arrived at overview page").apply(driver));
    System.out.println(driver.getCurrentUrl());
    Assert.assertTrue(driver.getCurrentUrl().contains("param1=staticValue2"));
    Assert.assertTrue(driver.getCurrentUrl().contains("param2=aValue"));
}
Also used : WebElement(org.openqa.selenium.WebElement) URL(java.net.URL) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test)

Example 34 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project quickstart by wildfly.

the class ContactRegistrationIT method shouldCreateAndDeleteAContact.

@Test
@RunAsClient
@InSequence(6)
public void shouldCreateAndDeleteAContact(@ArquillianResource URL contextPath) throws JAXBException {
    Contact contact = createContactInstance("Jason", "Smith", "jason@mailinator.com", "2125551234", date);
    // POSTs a Contact
    Client client = ClientBuilder.newClient();
    URI uri = UriBuilder.fromUri(contextPath + REST_ROOT).port(8080).build();
    Response response = client.target(uri).request().post(Entity.entity(contact, MediaType.APPLICATION_JSON));
    assertEquals(Response.Status.CREATED, response.getStatusInfo());
    URI contactURI = response.getLocation();
    // With the location, GETs the Contact
    client.close();
    client = ClientBuilder.newClient();
    response = client.target(contactURI).request().get();
    contact = response.readEntity(Contact.class);
    assertEquals(Response.Status.OK, response.getStatusInfo());
    assertEquals("Jason", contact.getFirstName());
    // GETs the Contact ID and DELETEs it
    String contactID = contactURI.toString().split("/")[6];
    response = client.target(uri).path(contactID).request().delete();
    assertEquals(Response.Status.NO_CONTENT, response.getStatusInfo());
    // GETs the Contact and checks if it has been deleted
    client.close();
    client = ClientBuilder.newClient();
    response = client.target(uri).path(contactID).request().get();
    assertEquals(Response.Status.NOT_FOUND, response.getStatusInfo());
    client.close();
}
Also used : Response(javax.ws.rs.core.Response) Client(javax.ws.rs.client.Client) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) URI(java.net.URI) Contact(org.jboss.quickstarts.contact.Contact) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Example 35 with RunAsClient

use of org.jboss.arquillian.container.test.api.RunAsClient in project quickstart by wildfly.

the class ContactRegistrationIT method shouldNotCreateANullContact.

@Test
@RunAsClient
@InSequence(4)
public void shouldNotCreateANullContact(@ArquillianResource URL contextPath) throws JAXBException, URISyntaxException {
    // POSTs a null Contact
    Client client = ClientBuilder.newClient();
    URI uri = UriBuilder.fromUri(contextPath.toURI()).path(REST_ROOT).port(8080).build();
    Response response = client.target(uri).request().post(Entity.entity("{}", MediaType.APPLICATION_JSON));
    assertEquals(Response.Status.BAD_REQUEST, response.getStatusInfo());
    client.close();
}
Also used : Response(javax.ws.rs.core.Response) Client(javax.ws.rs.client.Client) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) URI(java.net.URI) RunAsClient(org.jboss.arquillian.container.test.api.RunAsClient) Test(org.junit.Test) InSequence(org.jboss.arquillian.junit.InSequence)

Aggregations

RunAsClient (org.jboss.arquillian.container.test.api.RunAsClient)65 Test (org.junit.Test)64 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 InSequence (org.jboss.arquillian.junit.InSequence)7 IOException (java.io.IOException)6 Response (javax.ws.rs.core.Response)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 Client (javax.ws.rs.client.Client)5 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 URI (java.net.URI)3