Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,8 @@ public void loadEHRTableDefinitions()
_test.clickFolder(_folderName);
else
_test.clickFolder(_projectName);
if (_projectName.equalsIgnoreCase("CNPRC"))
_test.beginAt(_test.getCurrentContainerPath() + "/cnprc_ehr-ehrSettings.view?");
else
_test.beginAt(_test.getCurrentContainerPath() + "/tnprc_ehr-ehrSettings.view?");

_test.beginAt(_test.getCurrentContainerPath() + "/tnprc_ehr-ehrSettings.view?");
_test.clickButton("Load EHR table definitions", 0);
_test.waitForElement(Locator.tagWithClass("span", "x4-window-header-text").withText("Success"));
_test.assertExt4MsgBox("EHR tables updated successfully.", "OK");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,33 @@
import org.labkey.test.WebTestHelper;
import org.labkey.test.categories.EHR;
import org.labkey.test.categories.ONPRC;
import org.labkey.test.util.DataRegionTable;
import org.labkey.test.util.Ext4Helper;
import org.labkey.test.util.LogMethod;
import org.labkey.test.util.PortalHelper;
import org.labkey.test.util.ext4cmp.Ext4FieldRef;

import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;

@Category({EHR.class, ONPRC.class})
@BaseWebDriverTest.ClassTimeout(minutes = 10)
public class ONPRC_BillingTest extends AbstractONPRC_EHRTest
{
protected String PROJECT_NAME = "ONPRC_Billing_TestProject";
protected static String PROJECT_NAME = "ONPRC_Billing_TestProject";
private static final String BILLING_FOLDER_PATH = "/" + PROJECT_NAME + "/" + BILLING_FOLDER;
private static final String EHR_FOLDER_PATH = "/" + PROJECT_NAME + "/" + FOLDER_NAME;
private String ANIMAL_HISTORY_URL = "/ehr/" + getProjectName() + "/animalHistory.view?";

@BeforeClass
@LogMethod
public static void setupProject() throws Exception
{
ONPRC_BillingTest initTest = (ONPRC_BillingTest)getCurrentTest();
initTest.doSetUp();
}

@Override
protected String getProjectName()
{
Expand All @@ -50,12 +63,16 @@ protected String getModuleDirectory()
return "onprc_ehr";
}

@BeforeClass
@LogMethod
public static void doSetup() throws Exception
private void doSetUp() throws Exception
{
ONPRC_BillingTest initTest = (ONPRC_BillingTest)getCurrentTest();
initTest.initProject();
initProject();
_containerHelper.createSubfolder(getProjectName(), getProjectName(), BILLING_FOLDER, "Collaboration", null);
clickFolder(BILLING_FOLDER);
_containerHelper.enableModules(Arrays.asList("ONPRC_EHR", "EHR_Billing", "ONPRC_Billing", "ONPRC_BillingPublic"));

PortalHelper _portalHelper = new PortalHelper(getDriver());
_portalHelper.addWebPart("ONPRC Finance");

}

@Test
Expand Down Expand Up @@ -125,6 +142,46 @@ public void miscChargesFormTest()

}

/*
Test coverage for https://www.labkey.org/ONPRC/Support%20Tickets/issues-details.view?issueId=41146
*/

@Test
public void testProtocolProjectCreation()
{
String protocolTitle = "Test Protocol";
String projectName = "Test Project";
navigateToFolder(PROJECT_NAME, BILLING_FOLDER);

clickAndWait(Locator.linkWithText("IACUC Protocols"));
DataRegionTable protocolTable = new DataRegionTable("query", getDriver());
protocolTable.clickHeaderMenu("More Actions", false, "Edit Records");
protocolTable.clickImportBulkData();

setFormElement(Locator.textarea("title"), protocolTitle);
clickButton("Submit");

protocolTable.setFilter("title", "Equals", protocolTitle);
String protocolId = protocolTable.getDataAsText(0, "protocol");

checker().verifyEquals("Adding new protocol was not successful", 1, protocolTable.getDataRowCount());

navigateToFolder(PROJECT_NAME, BILLING_FOLDER);
clickAndWait(Locator.linkWithText("ONPRC Projects"));

DataRegionTable projectTable = new DataRegionTable("query", getDriver());
projectTable.clickHeaderMenu("More Actions", false, "Edit Records");
projectTable.clickImportBulkData();

setFormElement(Locator.name("name"), projectName);
setFormElement(Locator.name("protocol"), protocolId);
clickButton("Submit");

projectTable.setFilter("name", "Equals", projectName);
checker().verifyEquals("Adding new project was not successful", 1, projectTable.getDataRowCount());
}


@Override
public void validateQueries(boolean validateSubfolders)
{
Expand Down
44 changes: 32 additions & 12 deletions ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
import org.labkey.test.util.Maps;
import org.labkey.test.util.PasswordUtil;
import org.labkey.test.util.RReportHelper;
import org.labkey.test.util.SchemaHelper;
import org.labkey.test.util.ehr.EHRClientAPIHelper;
import org.labkey.test.util.ext4cmp.Ext4CmpRef;
import org.labkey.test.util.ext4cmp.Ext4ComboRef;
Expand All @@ -61,7 +60,6 @@
import java.io.IOException;
import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;
import java.time.temporal.ChronoUnit;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
Expand All @@ -74,6 +72,7 @@
import java.util.Set;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

@Category({CustomModules.class, EHR.class, ONPRC.class})
@BaseWebDriverTest.ClassTimeout(minutes = 60)
Expand Down Expand Up @@ -464,7 +463,7 @@ public void testArrivalApi() throws Exception
), getExtraContext());

//expect to find demographics record.
Assert.assertTrue("demographics row was not created for arrival", getApiHelper().doesRowExist("study", "demographics", new Filter("Id", arrivalId1, Filter.Operator.EQUAL)));
assertTrue("demographics row was not created for arrival", getApiHelper().doesRowExist("study", "demographics", new Filter("Id", arrivalId1, Filter.Operator.EQUAL)));

//and birth
SelectRowsCommand birthSelect = new SelectRowsCommand("study", "birth");
Expand Down Expand Up @@ -669,7 +668,7 @@ public void testPedigreeReport() throws Exception

waitForElement(Locator.tagContainingText("span", "Pedigree Plot - " + id), WAIT_FOR_JAVASCRIPT * 3);
assertTextNotPresent("Error executing command");
Assert.assertTrue(isTextPresent("Console output"));
assertTrue(isTextPresent("Console output"));
}

@Test
Expand Down Expand Up @@ -1220,6 +1219,28 @@ public void testGeneticsPipeline() throws Exception
waitAndClickAndWait(Ext4Helper.Locators.ext4Button("Run Now"));
waitAndClickAndWait(Locator.lkButton("OK"));
waitForPipelineJobsToComplete(2, "genetics pipeline", false);

/*
Test coverage for : https://www.labkey.org/ONPRC/Support%20Tickets/issues-details.view?issueId=41231
*/

goToProjectHome();
beginAtAnimalHistoryTab();
AnimalHistoryPage animalHistoryPage = new AnimalHistoryPage(getDriver());
animalHistoryPage.searchSingleAnimal("99991,99991011,99991041,99991080,99998");
animalHistoryPage.refreshReport();
animalHistoryPage.clickCategoryTab("Genetics")
.clickReportTab("Kinship");

assertTrue(isElementPresent(Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION")));

DataRegionTable kinshipTable = animalHistoryPage.getActiveReportDataRegion();
assertEquals("Incorrect number of rows before limiting animal selection", 3, kinshipTable.getDataRowCount());

kinshipTable.doAndWaitForUpdate(() -> Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION").findElement(getDriver()).click());

kinshipTable = animalHistoryPage.getActiveReportDataRegion();
assertEquals("Incorrect number of rows after limiting animal selection", 2, kinshipTable.getDataRowCount());
}

@Test
Expand Down Expand Up @@ -1373,7 +1394,7 @@ public void testPathology()
final String caseNoBase = "2013A00";
waitFor(() -> Ext4FieldRef.getForLabel(ONPRC_EHRTest.this, "Case Number").getValue().toString().startsWith(caseNoBase),
"Case Number field was not set", WAIT_FOR_JAVASCRIPT);
Assert.assertTrue(Ext4FieldRef.getForLabel(this, "Case Number").getValue().toString().startsWith(caseNoBase));
assertTrue(Ext4FieldRef.getForLabel(this, "Case Number").getValue().toString().startsWith(caseNoBase));
String caseNo = Ext4FieldRef.getForLabel(this, "Case Number").getValue().toString();

// apply form template
Expand Down Expand Up @@ -1427,14 +1448,14 @@ public void testPathology()
visible.get(0).sendKeys(Keys.ENTER);
String code2 = "APEX OF HEART (T-32040)";
waitForElement(Locator.tagContainingText("div", "2: " + code2),20000);
Assert.assertTrue(isTextBefore(code1, code2));
assertTrue(isTextBefore(code1, code2));

visible.get(0).sendKeys("disease");
sleep(2000);
visible.get(0).sendKeys(Keys.ENTER);
String code3 = "ALEUTIAN DISEASE (D-03550)";
waitForElement(Locator.tagContainingText("div", "3: " + code3),20000);
Assert.assertTrue(isTextBefore(code2, code3));
assertTrue(isTextBefore(code2, code3));

//move first code down
click(Locator.id(_ext4Helper.componentQuery("button[testLocator=snomedDownArrow]", Ext4CmpRef.class).get(0).getId()));
Expand All @@ -1459,7 +1480,7 @@ public void testPathology()

waitAndClick(Ext4Helper.Locators.window("Manage SNOMED Codes").append(Ext4Helper.Locators.ext4Button("Submit")));
Assert.assertEquals("1<>D-03550;2<>E-70590", histologyGrid.getFieldValue(1, "codesRaw").toString());
Assert.assertTrue(isTextBefore("1: " + code3, "2: " + code1));
assertTrue(isTextBefore("1: " + code3, "2: " + code1));

//enter death
waitAndClick(Ext4Helper.Locators.ext4ButtonEnabled("Enter/Manage Death"));
Expand Down Expand Up @@ -1649,7 +1670,6 @@ public void testSurgeryForm()
waitForElementToDisappear(caseWindow);
waitForElement(Ext4Helper.Locators.window("Success").append(Locator.tagWithText("div", "Surgical cases opened")));
waitAndClick(Ext4Helper.Locators.window("Success").append(Ext4Helper.Locators.ext4ButtonEnabled("OK")));

_helper.discardForm();
}

Expand Down Expand Up @@ -1782,9 +1802,9 @@ public void testNecropsyRequestFlow() throws IOException, CommandException
String tissue = "AMNION (T-88300)";

// Insert a row so we can select a charge unit in the form
InsertRowsCommand protocolCommand = new InsertRowsCommand("onprc_billing", "chargeUnits");
protocolCommand.addRow(Maps.of("chargetype", "ChargeUnit1", "servicecenter", "ServiceCenter1", "shownInProcedures", true, "active", true));
protocolCommand.execute(getApiHelper().getConnection(), getContainerPath());
InsertRowsCommand chargeUnitCommand = new InsertRowsCommand("onprc_billing", "chargeUnits");
chargeUnitCommand.addRow(Maps.of("chargetype", "ChargeUnit1", "servicecenter", "ServiceCenter1", "shownInProcedures", true, "active", true));
chargeUnitCommand.execute(getApiHelper().getConnection(), getContainerPath());

log("Begin the test with entry data page");
EnterDataPage enterData = EnterDataPage.beginAt(this, getContainerPath());
Expand Down
Loading