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"));
}
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="));
}
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"));
}
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();
}
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();
}
Aggregations