Updates to the Selenium WebDriver tests.
This commit is contained in:
parent
41a7ed3682
commit
b66df2453d
5 changed files with 137 additions and 67 deletions
|
@ -10,6 +10,7 @@ import org.vivoweb.vivo.selenium.tests.CreateActivity;
|
||||||
import org.vivoweb.vivo.selenium.tests.CreateCourses;
|
import org.vivoweb.vivo.selenium.tests.CreateCourses;
|
||||||
import org.vivoweb.vivo.selenium.tests.CreateEquipment;
|
import org.vivoweb.vivo.selenium.tests.CreateEquipment;
|
||||||
import org.vivoweb.vivo.selenium.tests.CreateEvent;
|
import org.vivoweb.vivo.selenium.tests.CreateEvent;
|
||||||
|
import org.vivoweb.vivo.selenium.tests.CreateLocation;
|
||||||
import org.vivoweb.vivo.selenium.tests.CreateOrganization;
|
import org.vivoweb.vivo.selenium.tests.CreateOrganization;
|
||||||
import org.vivoweb.vivo.selenium.tests.CreateTopic;
|
import org.vivoweb.vivo.selenium.tests.CreateTopic;
|
||||||
import org.vivoweb.vivo.selenium.tests.DeleteActivities;
|
import org.vivoweb.vivo.selenium.tests.DeleteActivities;
|
||||||
|
@ -31,6 +32,7 @@ import org.vivoweb.vivo.selenium.tests.RebuildSearchIndex;
|
||||||
CreateEvent.class,
|
CreateEvent.class,
|
||||||
CreateTopic.class,
|
CreateTopic.class,
|
||||||
CreateEquipment.class,
|
CreateEquipment.class,
|
||||||
|
CreateLocation.class,
|
||||||
DeleteActivities.class,
|
DeleteActivities.class,
|
||||||
DeleteCourses.class,
|
DeleteCourses.class,
|
||||||
DeleteLocations.class,
|
DeleteLocations.class,
|
||||||
|
|
|
@ -28,21 +28,23 @@ public class AbstractVIVOSeleniumTest extends AbstractSeleniumTest {
|
||||||
element.sendKeys(text);
|
element.sendKeys(text);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Thread.sleep(1000);
|
int findElementCount = 0;
|
||||||
|
while (autoComplete == null && findElementCount < 6) {
|
||||||
|
Thread.sleep(250);
|
||||||
autoComplete = driver.findElement(By.className("ui-autocomplete"));
|
autoComplete = driver.findElement(By.className("ui-autocomplete"));
|
||||||
|
if (autoComplete != null && !autoComplete.isDisplayed()) {
|
||||||
|
autoComplete = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (NoSuchElementException nse) {
|
} catch (NoSuchElementException nse) {
|
||||||
System.out.println("Failure number: " + count);
|
System.out.println("Failure number: " + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (autoComplete != null && !autoComplete.isDisplayed()) {
|
|
||||||
autoComplete = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (autoComplete == null) {
|
if (autoComplete == null) {
|
||||||
element.clear();
|
element.clear();
|
||||||
if (count > 5) {
|
if (count > 3) {
|
||||||
throw new NoSuchElementException("Auto complete is not visible");
|
throw new NoSuchElementException("Auto complete is not visible");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,118 @@
|
||||||
|
package org.vivoweb.vivo.selenium.tests;
|
||||||
|
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.openqa.selenium.By;
|
||||||
|
import org.openqa.selenium.Keys;
|
||||||
|
|
||||||
|
public class CreateLocation extends AbstractVIVOSeleniumTest {
|
||||||
|
@Test
|
||||||
|
public void createLocation() {
|
||||||
|
deleteAllVisibleCookies();
|
||||||
|
|
||||||
|
open("/");
|
||||||
|
assertTitle("VIVO");
|
||||||
|
|
||||||
|
vivoLogIn("testAdmin@cornell.edu", "Password");
|
||||||
|
|
||||||
|
clickAndWait(By.linkText("Site Admin"));
|
||||||
|
assertTitle("VIVO Site Administration");
|
||||||
|
|
||||||
|
verifyTextPresent("Data Input");
|
||||||
|
|
||||||
|
selectByLabel(By.id("VClassURI"), "Building (vivo)");
|
||||||
|
|
||||||
|
clickAndWait(By.xpath("//input[@value='Add individual of this class']"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("Create a new Building");
|
||||||
|
|
||||||
|
clickAndWait(By.linkText("Cancel"));
|
||||||
|
assertTitle("VIVO Site Administration");
|
||||||
|
|
||||||
|
selectByLabel(By.id("VClassURI"), "Building (vivo)");
|
||||||
|
|
||||||
|
clickAndWait(By.xpath("//input[@value='Add individual of this class']"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("Create a new Building");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("Please enter a value in the Name field.");
|
||||||
|
|
||||||
|
type(By.id("label"), "Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.cssSelector("a.add-BFO_0000051 > img.add-individual"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("There are no entries in the system from which to select.");
|
||||||
|
|
||||||
|
clickAndWait(By.id("offerCreate"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("Create \"rooms\" entry for Jane Memorial Building");
|
||||||
|
type(By.id("label"), "Lab Admin Office");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.cssSelector("a.add-BFO_0000050 > img.add-individual"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("If you don't find the appropriate entry on the selection list above:");
|
||||||
|
selectByLabel(By.id("typeOfNew"), "Geographic Location (vivo)");
|
||||||
|
|
||||||
|
clickAndWait(By.id("offerCreate"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
type(By.id("label"), "Primate Quad");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.cssSelector("a.add-RO_0001015 > img.add-individual"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
verifyTextPresent("If you don't find the appropriate entry on the selection list above:");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.xpath("(//img[@alt='add'])[3]"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
selectByLabel(By.id("objectVar"), "Primate Heart Health (Service)");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.xpath("(//h3[@id='RO_0001015']/a)[3]"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
selectByLabel(By.id("objectVar"), "Primate University of America (University)");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
clickAndWait(By.xpath("(//img[@alt='add'])[5]"));
|
||||||
|
assertTitle("Edit");
|
||||||
|
|
||||||
|
selectByLabel(By.id("objectVar"), "Primate Health Check (Event)");
|
||||||
|
|
||||||
|
clickAndWait(By.id("submit"));
|
||||||
|
assertTitle("Jane Memorial Building");
|
||||||
|
|
||||||
|
verifyElementPresent(By.linkText("Portable Primate Habitat"));
|
||||||
|
verifyElementPresent(By.linkText("Primate Heart Health"));
|
||||||
|
verifyElementPresent(By.linkText("Primate University of America"));
|
||||||
|
verifyElementPresent(By.linkText("Primate Health Check"));
|
||||||
|
verifyElementPresent(By.linkText("Lab Admin Office"));
|
||||||
|
verifyElementPresent(By.linkText("Primate Quad"));
|
||||||
|
|
||||||
|
vivoLogOut();
|
||||||
|
}
|
||||||
|
}
|
|
@ -24,6 +24,9 @@ public class DeleteEquipment extends AbstractVIVOSeleniumTest {
|
||||||
|
|
||||||
vivoDeleteIndividual();
|
vivoDeleteIndividual();
|
||||||
/* From CreateEquipment */
|
/* From CreateEquipment */
|
||||||
|
clickAndWait(By.linkText("Index"));
|
||||||
|
assertTitle("Index of Contents");
|
||||||
|
|
||||||
clickAndWait(By.linkText("Equipment"));
|
clickAndWait(By.linkText("Equipment"));
|
||||||
assertTitle("Equipment");
|
assertTitle("Equipment");
|
||||||
|
|
||||||
|
|
|
@ -19,72 +19,17 @@ public class DeleteLocations extends AbstractVIVOSeleniumTest {
|
||||||
|
|
||||||
vivoDeleteIndividual("Building", "Primate Memorial Building");
|
vivoDeleteIndividual("Building", "Primate Memorial Building");
|
||||||
/* */
|
/* */
|
||||||
|
/* from CreateLocation */
|
||||||
|
clickAndWait(By.linkText("Index"));
|
||||||
|
assertTitle("Index of Contents");
|
||||||
|
|
||||||
|
vivoDeleteIndividual("Building", "Jane Memorial Building");
|
||||||
|
/* */
|
||||||
vivoLogOut();
|
vivoLogOut();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
<!--Delete Locations-->
|
<!--Delete Locations-->
|
||||||
<tr>
|
|
||||||
<td>clickAndWait</td>
|
|
||||||
<td>link=Building</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>assertTitle</td>
|
|
||||||
<td>Building</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>clickAndWait</td>
|
|
||||||
<td>link=Jane Memorial Building</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>assertTitle</td>
|
|
||||||
<td>Jane Memorial Building</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>clickAndWait</td>
|
|
||||||
<td>link=Edit this individual</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>assertTitle</td>
|
|
||||||
<td>Individual Control Panel</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>clickAndWait</td>
|
|
||||||
<td>//input[@value="Edit This Individual"]</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>assertTitle</td>
|
|
||||||
<td>Individual Editing Form</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>clickAndWait</td>
|
|
||||||
<td>_delete</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>assertConfirmation</td>
|
|
||||||
<td>Are you SURE you want to delete this individual? If in doubt, CANCEL.</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>waitForPageToLoad</td>
|
|
||||||
<td>5000</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>assertTitle</td>
|
|
||||||
<td>VIVO Site Administration</td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>clickAndWait</td>
|
<td>clickAndWait</td>
|
||||||
<td>link=Index</td>
|
<td>link=Index</td>
|
||||||
|
|
Loading…
Add table
Reference in a new issue