From 2dc1a26b793748dae09e75d370dc4bfed7ffea38 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Sun, 7 Mar 2021 18:54:31 -0800 Subject: [PATCH 01/10] Automation test for 41231 --- .../test/tests/onprc_ehr/ONPRC_EHRTest.java | 44 +++++++++++++++---- 1 file changed, 36 insertions(+), 8 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java index d67915e50..187b2dd96 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java @@ -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; @@ -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; @@ -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) @@ -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"); @@ -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 @@ -1220,6 +1219,35 @@ 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 = animalHistoryPage + .selectMultiAnimalSearch() + .addSubjects("99991") + .addSubjects("99991011") + .addSubjects(("99991041")) + .addSubjects("99991080") + .addSubjects("99998") + .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 the limiting animal selection", 3, kinshipTable.getDataRowCount()); + + Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION").findElement(getDriver()).click(); + kinshipTable = animalHistoryPage.getActiveReportDataRegion(); + + assertEquals("Incorrect number of rows before the limiting animal selection", 2, kinshipTable.getDataRowCount()); } @Test @@ -1373,7 +1401,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 @@ -1427,14 +1455,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())); @@ -1459,7 +1487,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")); From 0d61a861a06c396c879bd053a942c7577618c815 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Fri, 12 Mar 2021 10:31:19 -0800 Subject: [PATCH 02/10] Blood draw request and Protocol/Project creation test addition --- .../labkey/test/tests/ehr/EHRSetupHelper.java | 6 +- .../tests/onprc_ehr/ONPRC_BillingTest.java | 70 +++++++++++++++++-- .../test/tests/onprc_ehr/ONPRC_EHRTest.java | 6 +- .../test/tests/onprc_ehr/ONPRC_EHRTest2.java | 69 +++++++++++++++--- 4 files changed, 128 insertions(+), 23 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java b/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java index 69a9c40cd..4becf11dc 100644 --- a/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java +++ b/ehr/test/src/org/labkey/test/tests/ehr/EHRSetupHelper.java @@ -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"); diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java index ba0f4febc..e365c3ff4 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java @@ -24,10 +24,13 @@ 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; @@ -35,9 +38,19 @@ @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() { @@ -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 @@ -125,6 +142,47 @@ 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) { diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java index 187b2dd96..139fa28ca 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java @@ -1810,9 +1810,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()); diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 850f880b3..3713b6a77 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -20,6 +20,7 @@ import org.junit.BeforeClass; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.labkey.remoteapi.CommandException; import org.labkey.remoteapi.PostCommand; import org.labkey.remoteapi.query.ExecuteSqlCommand; import org.labkey.remoteapi.query.Filter; @@ -33,16 +34,19 @@ import org.labkey.test.categories.EHR; import org.labkey.test.categories.ONPRC; import org.labkey.test.pages.ehr.AnimalHistoryPage; +import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.Ext4Helper; import org.labkey.test.util.LogMethod; import org.labkey.test.util.Maps; import org.labkey.test.util.PasswordUtil; -import org.labkey.test.util.SchemaHelper; import org.labkey.test.util.ext4cmp.Ext4CmpRef; import org.labkey.test.util.ext4cmp.Ext4ComboRef; import org.labkey.test.util.ext4cmp.Ext4FieldRef; import org.labkey.test.util.ext4cmp.Ext4GridRef; +import java.io.IOException; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; import java.util.Arrays; import java.util.Calendar; import java.util.Collections; @@ -58,6 +62,8 @@ public class ONPRC_EHRTest2 extends AbstractONPRC_EHRTest { private String PROJECT_NAME = "ONPRC_EHR_TestProject2"; private String ANIMAL_HISTORY_URL = "/ehr/" + getProjectName() + "/animalHistory.view?"; + protected DateTimeFormatter _dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + @Override protected String getModuleDirectory() { @@ -973,22 +979,65 @@ public void bulkUploadsTest() //TODO: weight form, bulk upload } - //TODO: @Test - public void bloodRequestTest() + @Test + public void bloodRequestTest() throws IOException, CommandException { - // make request + LocalDateTime now = LocalDateTime.now(); + String animalId = "12345"; + + log("Inserting the charge unit necessary for blood draw request"); + InsertRowsCommand chargeUnitCommand = new InsertRowsCommand("onprc_billing", "chargeUnits"); + chargeUnitCommand.addRow(Map.of("chargetype", "ChargeUnit2", "servicecenter", "ServiceCenter2", "shownInBlood", true, "active", true)); + chargeUnitCommand.execute(getApiHelper().getConnection(), getContainerPath()); + + log("Inserting the data in available blood volume"); + goToProjectHome(); + goToSchemaBrowser(); + DataRegionTable ABVTable = viewQueryData("onprc_ehr", "AvailableBloodVolume"); + ABVTable.clickInsertNewRow(); + setFormElement(Locator.name("quf_datecreated"), now.toString()); + setFormElement(Locator.name("quf_id"), animalId); + setFormElement(Locator.name("quf_ABV"), "10"); + setFormElement(Locator.name("quf_dsrowid"), "1"); + clickButton("Submit"); + + + log("Creating the blood draw request"); + goToProjectHome(); + clickAndWait(Locator.linkWithText("Manage Requests")); + waitAndClickAndWait(Locator.linkWithText("ASB SERVICES REQUEST")); + addBloodDrawRequest(animalId, now, "795644", "ChargeUnit2", "Heparin", 12); + clickButton("Request"); + + checker().verifyTrue("Error is not present",true); + + addBloodDrawRequest(animalId, now, "795644", "ChargeUnit2", "Heparin", 8); + clickButton("Request"); + + checker().verifyTrue("Error is present",true); - // check queue + } - // create task, save + private void addBloodDrawRequest(String animalId, LocalDateTime date, String project, String charge_type, String tube_type, Integer quantity) + { + Ext4GridRef bloodDraw = _helper.getExt4GridForFormSection("Blood Draws"); + _helper.addRecordToGrid(bloodDraw); + scrollIntoView(Locator.tagWithText("span", "Blood Draws")); + int index = bloodDraw.getRowCount(); - // open, delete record. + bloodDraw.setGridCellJS(index, "date", date.format(DateTimeFormatter.ofPattern(DATE_TIME_FORMAT_STRING))); + bloodDraw.setGridCell(index, "Id", animalId); - // save. make sure deleted record back in queue + bloodDraw.setGridCell(index, "quantity", quantity.toString()); + bloodDraw.setGridCell(index, "chargetype", charge_type); + bloodDraw.setGridCell(index, "tube_type", tube_type); - // use copy previous request + getFieldInWindow("project", Ext4FieldRef.class).getEval("expand()"); + waitAndClick(Locator.tag("li").append(Locator.tagContainingText("span", "Other"))); + waitForElement(Ext4Helper.Locators.window("Choose Project")); + _ext4Helper.queryOne("window[title=Choose Project] [fieldLabel='Project']", Ext4ComboRef.class).setComboByDisplayValue(project); + waitAndClick(Ext4Helper.Locators.window("Choose Project").append(Ext4Helper.Locators.ext4ButtonEnabled("Submit"))); - // test repeat selected helper, including save } //TODO: @Test From 9446a566b0ccd0629a344fa9db7b939ba6e18f70 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Mon, 15 Mar 2021 18:20:34 -0700 Subject: [PATCH 03/10] Automation test --- .../tests/onprc_ehr/ONPRC_BillingTest.java | 4 +- .../test/tests/onprc_ehr/ONPRC_EHRTest2.java | 100 ++++++++++++++++-- 2 files changed, 91 insertions(+), 13 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java index e365c3ff4..c8012decb 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java @@ -47,8 +47,8 @@ public class ONPRC_BillingTest extends AbstractONPRC_EHRTest @LogMethod public static void setupProject() throws Exception { -// ONPRC_BillingTest initTest = (ONPRC_BillingTest)getCurrentTest(); -// initTest.doSetUp(); + ONPRC_BillingTest initTest = (ONPRC_BillingTest)getCurrentTest(); + initTest.doSetUp(); } @Override diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 3713b6a77..dc0bac448 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -31,9 +31,14 @@ import org.labkey.test.Locator; import org.labkey.test.TestProperties; import org.labkey.test.categories.CustomModules; +import org.labkey.test.categories.Data; import org.labkey.test.categories.EHR; import org.labkey.test.categories.ONPRC; import org.labkey.test.pages.ehr.AnimalHistoryPage; +import org.labkey.test.tests.di.ETLHelper; +import org.labkey.test.util.APIContainerHelper; +import org.labkey.test.util.AbstractContainerHelper; +import org.labkey.test.util.DataRegion; import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.Ext4Helper; import org.labkey.test.util.LogMethod; @@ -43,6 +48,7 @@ import org.labkey.test.util.ext4cmp.Ext4ComboRef; import org.labkey.test.util.ext4cmp.Ext4FieldRef; import org.labkey.test.util.ext4cmp.Ext4GridRef; +import org.openqa.selenium.support.ui.ExpectedConditions; import java.io.IOException; import java.time.LocalDateTime; @@ -62,7 +68,8 @@ public class ONPRC_EHRTest2 extends AbstractONPRC_EHRTest { private String PROJECT_NAME = "ONPRC_EHR_TestProject2"; private String ANIMAL_HISTORY_URL = "/ehr/" + getProjectName() + "/animalHistory.view?"; - protected DateTimeFormatter _dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd"); + public ETLHelper _etlHelper = new ETLHelper(this, getProjectName()); + public AbstractContainerHelper _containerHelper = new APIContainerHelper(this); @Override protected String getModuleDirectory() @@ -78,13 +85,21 @@ protected String getProjectName() @BeforeClass @LogMethod - public static void doSetup() throws Exception + public static void setupProject() throws Exception { ONPRC_EHRTest2 initTest = new ONPRC_EHRTest2(); initTest.doCleanup(false); - initTest.initProject(); - initTest.createTestSubjects(); + initTest.doSetUp(); + } + + private void doSetUp() throws Exception + { + initProject(); + createTestSubjects(); + + //treatmentToDrug ETL is part of this module. + _containerHelper.enableModule("TreatmentETL"); } @Override @@ -979,6 +994,34 @@ public void bulkUploadsTest() //TODO: weight form, bulk upload } + @Test + public void testTreatmentToDrugETL() + { + LocalDateTime endDate = LocalDateTime.now().plusDays(2); + String animalId = "12345"; + + goToProjectHome(); + clickAndWait(Locator.linkWithText("Enter Data / Task Review")); + clickAndWait(Locator.linkWithText("Medications/Diet")); + + addTreatmentOrder(animalId, endDate, "640991", "ACETAMINOPHEN (80mg) (E-77510)", + "BID - AM/Night","PO","tablet(s)" ,10, "mg"); + + shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span","Submit Final"))); + clickButton("Submit Final",0); + + _billingHelper.checkMessageWindow("Finalize Form", "You are about to finalize this form. Do you want to do this?", "Yes"); + + goToSchemaBrowser(); + DataRegionTable table = viewQueryData("study","treatment_order"); + checker().verifyEquals("Treatment order is not placed", 1, table.getDataRowCount()); + + goToModule("DataIntegration"); + _etlHelper.runETL("treatmentToDrug"); + + + } + @Test public void bloodRequestTest() throws IOException, CommandException { @@ -1007,16 +1050,20 @@ public void bloodRequestTest() throws IOException, CommandException clickAndWait(Locator.linkWithText("Manage Requests")); waitAndClickAndWait(Locator.linkWithText("ASB SERVICES REQUEST")); addBloodDrawRequest(animalId, now, "795644", "ChargeUnit2", "Heparin", 12); - clickButton("Request"); - checker().verifyTrue("Error is not present",true); + checker().verifyTrue("Expected error is not present",isAnyTextPresent( + "Row 1, # of Tubes: ERROR: The quantity requested, 12.0ml exceeds the available blood volume, 8.0ml for AnimalId: 12345")); + + //Updating the total volume below the the available blood volume. + updateTotalVolume(8); - addBloodDrawRequest(animalId, now, "795644", "ChargeUnit2", "Heparin", 8); + shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span","Request"))); clickButton("Request"); - checker().verifyTrue("Error is present",true); + DataRegionTable table = new DataRegionTable("study|blood",getDriver()); + checker().verifyEquals("New blood draw request is not created", 1 , table.getDataRowCount()); - } + } private void addBloodDrawRequest(String animalId, LocalDateTime date, String project, String charge_type, String tube_type, Integer quantity) { @@ -1031,13 +1078,44 @@ private void addBloodDrawRequest(String animalId, LocalDateTime date, String pro bloodDraw.setGridCell(index, "quantity", quantity.toString()); bloodDraw.setGridCell(index, "chargetype", charge_type); bloodDraw.setGridCell(index, "tube_type", tube_type); + addProjectToTheRow(bloodDraw,index,project); + + } + + private void addTreatmentOrder(String animalId, LocalDateTime endDate, String project, String treatment, String frequency, String route, + String volUnits, Integer amount, String amountUnits) + { + Ext4GridRef treatmentOrder = _helper.getExt4GridForFormSection("Medication/Treatment Orders"); + _helper.addRecordToGrid(treatmentOrder); + scrollIntoView(Locator.tagWithText("span", "Medication/Treatment Orders")); + int index = treatmentOrder.getRowCount(); + + treatmentOrder.setGridCell(index, "Id", animalId); + treatmentOrder.setGridCellJS(index, "enddate", endDate.toString()); + treatmentOrder.setGridCell(index, "code", treatment); + treatmentOrder.setGridCell(index, "frequency", frequency); + treatmentOrder.setGridCell(index, "route", route); + treatmentOrder.setGridCell(index, "vol_units", volUnits); + treatmentOrder.setGridCell(index, "amount", amount.toString()); + treatmentOrder.setGridCell(index, "amount_units", amountUnits); + + addProjectToTheRow(treatmentOrder, index, project); + } - getFieldInWindow("project", Ext4FieldRef.class).getEval("expand()"); + private void updateTotalVolume(Integer quantity) + { + Ext4GridRef bloodDraw = _helper.getExt4GridForFormSection("Blood Draws"); + int index = bloodDraw.getRowCount(); + bloodDraw.setGridCell(index, "quantity", quantity.toString()); + } + + private void addProjectToTheRow(Ext4GridRef gridRef, int index, String project) + { + gridRef.clickDownArrowOnGrid(index,"project"); waitAndClick(Locator.tag("li").append(Locator.tagContainingText("span", "Other"))); waitForElement(Ext4Helper.Locators.window("Choose Project")); _ext4Helper.queryOne("window[title=Choose Project] [fieldLabel='Project']", Ext4ComboRef.class).setComboByDisplayValue(project); waitAndClick(Ext4Helper.Locators.window("Choose Project").append(Ext4Helper.Locators.ext4ButtonEnabled("Submit"))); - } //TODO: @Test From d140256f0ca6fc961eeac345d1577e3f5e244f86 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Wed, 17 Mar 2021 14:32:34 -0700 Subject: [PATCH 04/10] Automation test 1. ONPRC_EHRTest2.testTreatmentToDrugETL() 2. ONPRC_EHRTest2.bloodRequestTest() 3. ONPRC_EHRTest.testGeneticsPipeline() 4. ONPRC_BillingTest.testProtocolProjectCreation() --- .../tests/onprc_ehr/ONPRC_BillingTest.java | 1 - .../test/tests/onprc_ehr/ONPRC_EHRTest.java | 13 +- .../test/tests/onprc_ehr/ONPRC_EHRTest2.java | 118 ++++++++++-------- 3 files changed, 68 insertions(+), 64 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java index c8012decb..0a3b0f710 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_BillingTest.java @@ -178,7 +178,6 @@ public void testProtocolProjectCreation() clickButton("Submit"); projectTable.setFilter("name", "Equals", projectName); - checker().verifyEquals("Adding new project was not successful", 1, projectTable.getDataRowCount()); } diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java index 139fa28ca..0b97bfba5 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java @@ -1227,15 +1227,8 @@ public void testGeneticsPipeline() throws Exception goToProjectHome(); beginAtAnimalHistoryTab(); AnimalHistoryPage animalHistoryPage = new AnimalHistoryPage(getDriver()); - animalHistoryPage = animalHistoryPage - .selectMultiAnimalSearch() - .addSubjects("99991") - .addSubjects("99991011") - .addSubjects(("99991041")) - .addSubjects("99991080") - .addSubjects("99998") - .refreshReport(); - + animalHistoryPage.searchSingleAnimal("99991,99991011,99991041,99991080,99998"); + animalHistoryPage.refreshReport(); animalHistoryPage.clickCategoryTab("Genetics") .clickReportTab("Kinship"); @@ -1245,6 +1238,7 @@ public void testGeneticsPipeline() throws Exception assertEquals("Incorrect number of rows before the limiting animal selection", 3, kinshipTable.getDataRowCount()); Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION").findElement(getDriver()).click(); + waitForText("coefficient"); kinshipTable = animalHistoryPage.getActiveReportDataRegion(); assertEquals("Incorrect number of rows before the limiting animal selection", 2, kinshipTable.getDataRowCount()); @@ -1677,7 +1671,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(); } diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index dc0bac448..459d5367b 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -28,17 +28,16 @@ import org.labkey.remoteapi.query.SaveRowsResponse; import org.labkey.remoteapi.query.SelectRowsCommand; import org.labkey.remoteapi.query.SelectRowsResponse; +import org.labkey.test.BaseWebDriverTest; import org.labkey.test.Locator; import org.labkey.test.TestProperties; import org.labkey.test.categories.CustomModules; -import org.labkey.test.categories.Data; import org.labkey.test.categories.EHR; import org.labkey.test.categories.ONPRC; import org.labkey.test.pages.ehr.AnimalHistoryPage; import org.labkey.test.tests.di.ETLHelper; import org.labkey.test.util.APIContainerHelper; import org.labkey.test.util.AbstractContainerHelper; -import org.labkey.test.util.DataRegion; import org.labkey.test.util.DataRegionTable; import org.labkey.test.util.Ext4Helper; import org.labkey.test.util.LogMethod; @@ -64,12 +63,23 @@ import java.util.regex.Pattern; @Category({CustomModules.class, EHR.class, ONPRC.class}) +@BaseWebDriverTest.ClassTimeout(minutes = 6) public class ONPRC_EHRTest2 extends AbstractONPRC_EHRTest { + public AbstractContainerHelper _containerHelper = new APIContainerHelper(this); private String PROJECT_NAME = "ONPRC_EHR_TestProject2"; - private String ANIMAL_HISTORY_URL = "/ehr/" + getProjectName() + "/animalHistory.view?"; public ETLHelper _etlHelper = new ETLHelper(this, getProjectName()); - public AbstractContainerHelper _containerHelper = new APIContainerHelper(this); + private String ANIMAL_HISTORY_URL = "/ehr/" + getProjectName() + "/animalHistory.view?"; + + @BeforeClass + @LogMethod + public static void setupProject() throws Exception + { + ONPRC_EHRTest2 initTest = new ONPRC_EHRTest2(); + initTest.doCleanup(false); + + initTest.doSetUp(); + } @Override protected String getModuleDirectory() @@ -83,16 +93,6 @@ protected String getProjectName() return PROJECT_NAME; } - @BeforeClass - @LogMethod - public static void setupProject() throws Exception - { - ONPRC_EHRTest2 initTest = new ONPRC_EHRTest2(); - initTest.doCleanup(false); - - initTest.doSetUp(); - } - private void doSetUp() throws Exception { initProject(); @@ -145,16 +145,17 @@ public void testBirthStatusApi() throws Exception //update to completed, expect to find demographics record. SelectRowsCommand select1 = new SelectRowsCommand("study", "birth"); select1.addFilter(new Filter("Id", damId1, Filter.Operator.EQUAL)); - final String damLsid = (String)select1.execute(getApiHelper().getConnection(), getContainerPath()).getRows().get(0).get("lsid"); + final String damLsid = (String) select1.execute(getApiHelper().getConnection(), getContainerPath()).getRows().get(0).get("lsid"); getApiHelper().updateRow("study", "birth", new HashMap() {{ - put("lsid", damLsid); - put("QCStateLabel", "Completed"); - }}, false); + put("lsid", damLsid); + put("QCStateLabel", "Completed"); + }}, false); org.junit.Assert.assertTrue("demographics row was not created for dam1", getApiHelper().doesRowExist("study", "demographics", new Filter("Id", damId1, Filter.Operator.EQUAL))); //update record to get a geographic_origin, which we expect to get entered into demographics - getApiHelper().updateRow("study", "birth", new HashMap(){ + getApiHelper().updateRow("study", "birth", new HashMap() + { { put("lsid", damLsid); put("geographic_origin", INDIAN); @@ -173,7 +174,8 @@ public void testBirthStatusApi() throws Exception String spfStatus = "SPF 9"; final String spfFlag = getOrCreateSpfFlag(spfStatus); InsertRowsCommand insertRowsCommand = new InsertRowsCommand("study", "flags"); - insertRowsCommand.addRow(new HashMap(){ + insertRowsCommand.addRow(new HashMap() + { { put("Id", damId1); put("date", dam1Birth); @@ -185,7 +187,8 @@ public void testBirthStatusApi() throws Exception String groupName = "TestGroup1"; final Integer groupId = getOrCreateGroup(groupName); InsertRowsCommand insertRowsCommand2 = new InsertRowsCommand("study", "animal_group_members"); - insertRowsCommand2.addRow(new HashMap(){ + insertRowsCommand2.addRow(new HashMap() + { { put("Id", damId1); put("date", dam1Birth); @@ -235,7 +238,7 @@ public void testBirthStatusApi() throws Exception final Map lsidMap = new HashMap<>(); for (Map row : insertRowsResp.getRows()) { - lsidMap.put((String)row.get("Id"), (String)row.get("lsid")); + lsidMap.put((String) row.get("Id"), (String) row.get("lsid")); } testBirthRecordStatus(offspringId1); @@ -341,14 +344,14 @@ private void testBirthRecordStatus(String offspringId, boolean birthWasChanged) org.junit.Assert.assertEquals("Birth record not created: " + offspringId, 1, resp.getRowCount().intValue()); - boolean isPublic = (Boolean)resp.getRows().get(0).get("QCState/PublicData"); - String damId = (String)resp.getRows().get(0).get("dam"); - boolean isAlive = resp.getRows().get(0).get("birth_condition/alive") == null ? true : (Boolean)resp.getRows().get(0).get("birth_condition/alive"); - String room = (String)resp.getRows().get(0).get("room"); - String cage = (String)resp.getRows().get(0).get("cage"); - Double weight = (Double)resp.getRows().get(0).get("weight"); - Date weightDate = (Date)resp.getRows().get(0).get("wdate"); - Date birthDate = (Date)resp.getRows().get(0).get("date"); + boolean isPublic = (Boolean) resp.getRows().get(0).get("QCState/PublicData"); + String damId = (String) resp.getRows().get(0).get("dam"); + boolean isAlive = resp.getRows().get(0).get("birth_condition/alive") == null ? true : (Boolean) resp.getRows().get(0).get("birth_condition/alive"); + String room = (String) resp.getRows().get(0).get("room"); + String cage = (String) resp.getRows().get(0).get("cage"); + Double weight = (Double) resp.getRows().get(0).get("weight"); + Date weightDate = (Date) resp.getRows().get(0).get("wdate"); + Date birthDate = (Date) resp.getRows().get(0).get("date"); SelectRowsCommand select2 = new SelectRowsCommand("study", "demographics"); select2.addFilter(new Filter("Id", offspringId, Filter.Operator.EQUAL)); @@ -470,7 +473,8 @@ public void testFlagsApi() throws Exception final Date date = new Date(); InsertRowsCommand insertRowsCommand = new InsertRowsCommand("study", "flags"); - insertRowsCommand.addRow(new HashMap(){ + insertRowsCommand.addRow(new HashMap() + { { put("Id", SUBJECTS[0]); put("date", prepareDate(date, -10, 0)); @@ -481,7 +485,8 @@ public void testFlagsApi() throws Exception //expect success InsertRowsCommand insertRowsCommand2 = new InsertRowsCommand("study", "flags"); - insertRowsCommand2.addRow(new HashMap(){ + insertRowsCommand2.addRow(new HashMap() + { { put("Id", SUBJECTS[0]); put("date", prepareDate(date, -9, 0)); @@ -503,7 +508,7 @@ public void testFlagsApi() throws Exception {SUBJECTS[0], prepareDate(date, -5, 0), flag1, generateGUID(), "recordID"} }, Maps.of( "flag", Arrays.asList( - "ERROR: Cannot change condition to a lower code. Animal is already: 202" + "ERROR: Cannot change condition to a lower code. Animal is already: 202" ) )); @@ -588,7 +593,7 @@ public void testArrivalForm() throws Exception waitAndClick(Ext4Helper.Locators.window("Set Values").append(Ext4Helper.Locators.ext4Button("Yes"))); waitForElementToDisappear(Ext4Helper.Locators.window("Bulk Edit")); - for (int i = 1;i<=3;i++) + for (int i = 1; i <= 3; i++) { Assert.assertEquals("bos", grid.getFieldValue(i, "source")); Assert.assertEquals("f", grid.getFieldValue(i, "gender")); @@ -997,29 +1002,38 @@ public void bulkUploadsTest() @Test public void testTreatmentToDrugETL() { + LocalDateTime beginDate = LocalDateTime.now(); LocalDateTime endDate = LocalDateTime.now().plusDays(2); String animalId = "12345"; + log("Creating the Treatment order request"); goToProjectHome(); clickAndWait(Locator.linkWithText("Enter Data / Task Review")); clickAndWait(Locator.linkWithText("Medications/Diet")); - addTreatmentOrder(animalId, endDate, "640991", "ACETAMINOPHEN (80mg) (E-77510)", - "BID - AM/Night","PO","tablet(s)" ,10, "mg"); - - shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span","Submit Final"))); - clickButton("Submit Final",0); + addTreatmentOrder(animalId, beginDate, endDate, "640991", "ACETAMINOPHEN (80mg) (E-77510)", + "BID - AM/Night", "PO", "tablet(s)", 10, "mg"); + shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span", "Submit Final"))); + clickButton("Submit Final", 0); _billingHelper.checkMessageWindow("Finalize Form", "You are about to finalize this form. Do you want to do this?", "Yes"); + waitForElement(Locator.linkWithText("Medications/Diet")); + log("Verifying request was created"); goToSchemaBrowser(); - DataRegionTable table = viewQueryData("study","treatment_order"); + DataRegionTable table = viewQueryData("study", "treatment_order"); + table.setFilter("Id", "Equals", animalId); checker().verifyEquals("Treatment order is not placed", 1, table.getDataRowCount()); + log("Running the treatment to drug ETL"); goToModule("DataIntegration"); - _etlHelper.runETL("treatmentToDrug"); - + _etlHelper.runETL("{ONPRC_EHR}/treatmentToDrug"); + log("Verifying the drug table was populated"); + goToSchemaBrowser(); + table = viewQueryData("study", "drug"); + table.setFilter("Id", "Equals", animalId); + checker().verifyEquals("ETL did not populate the study.drug", 1, table.getDataRowCount()); } @Test @@ -1034,7 +1048,6 @@ public void bloodRequestTest() throws IOException, CommandException chargeUnitCommand.execute(getApiHelper().getConnection(), getContainerPath()); log("Inserting the data in available blood volume"); - goToProjectHome(); goToSchemaBrowser(); DataRegionTable ABVTable = viewQueryData("onprc_ehr", "AvailableBloodVolume"); ABVTable.clickInsertNewRow(); @@ -1051,17 +1064,17 @@ public void bloodRequestTest() throws IOException, CommandException waitAndClickAndWait(Locator.linkWithText("ASB SERVICES REQUEST")); addBloodDrawRequest(animalId, now, "795644", "ChargeUnit2", "Heparin", 12); - checker().verifyTrue("Expected error is not present",isAnyTextPresent( + checker().verifyTrue("Expected error is not present", isAnyTextPresent( "Row 1, # of Tubes: ERROR: The quantity requested, 12.0ml exceeds the available blood volume, 8.0ml for AnimalId: 12345")); //Updating the total volume below the the available blood volume. updateTotalVolume(8); - shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span","Request"))); + shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span", "Request"))); clickButton("Request"); - DataRegionTable table = new DataRegionTable("study|blood",getDriver()); - checker().verifyEquals("New blood draw request is not created", 1 , table.getDataRowCount()); + DataRegionTable table = new DataRegionTable("study|blood", getDriver()); + checker().verifyEquals("New blood draw request is not created", 1, table.getDataRowCount()); } @@ -1078,11 +1091,10 @@ private void addBloodDrawRequest(String animalId, LocalDateTime date, String pro bloodDraw.setGridCell(index, "quantity", quantity.toString()); bloodDraw.setGridCell(index, "chargetype", charge_type); bloodDraw.setGridCell(index, "tube_type", tube_type); - addProjectToTheRow(bloodDraw,index,project); - + addProjectToTheRow(bloodDraw, index, project); } - private void addTreatmentOrder(String animalId, LocalDateTime endDate, String project, String treatment, String frequency, String route, + private void addTreatmentOrder(String animalId, LocalDateTime beginDate, LocalDateTime endDate, String project, String treatment, String frequency, String route, String volUnits, Integer amount, String amountUnits) { Ext4GridRef treatmentOrder = _helper.getExt4GridForFormSection("Medication/Treatment Orders"); @@ -1091,15 +1103,15 @@ private void addTreatmentOrder(String animalId, LocalDateTime endDate, String pr int index = treatmentOrder.getRowCount(); treatmentOrder.setGridCell(index, "Id", animalId); + treatmentOrder.setGridCellJS(index, "date", beginDate.toString()); treatmentOrder.setGridCellJS(index, "enddate", endDate.toString()); + addProjectToTheRow(treatmentOrder, index, project); treatmentOrder.setGridCell(index, "code", treatment); treatmentOrder.setGridCell(index, "frequency", frequency); treatmentOrder.setGridCell(index, "route", route); treatmentOrder.setGridCell(index, "vol_units", volUnits); treatmentOrder.setGridCell(index, "amount", amount.toString()); treatmentOrder.setGridCell(index, "amount_units", amountUnits); - - addProjectToTheRow(treatmentOrder, index, project); } private void updateTotalVolume(Integer quantity) @@ -1111,7 +1123,7 @@ private void updateTotalVolume(Integer quantity) private void addProjectToTheRow(Ext4GridRef gridRef, int index, String project) { - gridRef.clickDownArrowOnGrid(index,"project"); + gridRef.clickDownArrowOnGrid(index, "project"); waitAndClick(Locator.tag("li").append(Locator.tagContainingText("span", "Other"))); waitForElement(Ext4Helper.Locators.window("Choose Project")); _ext4Helper.queryOne("window[title=Choose Project] [fieldLabel='Project']", Ext4ComboRef.class).setComboByDisplayValue(project); From 1621ce650094af2490350f6cda63c1b898173082 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Wed, 17 Mar 2021 16:19:31 -0700 Subject: [PATCH 05/10] Correcting the error message --- .../src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java index 0b97bfba5..6b5b5e5dd 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java @@ -1235,13 +1235,13 @@ public void testGeneticsPipeline() throws Exception assertTrue(isElementPresent(Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION"))); DataRegionTable kinshipTable = animalHistoryPage.getActiveReportDataRegion(); - assertEquals("Incorrect number of rows before the limiting animal selection", 3, kinshipTable.getDataRowCount()); + assertEquals("Incorrect number of rows before limiting animal selection", 3, kinshipTable.getDataRowCount()); Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION").findElement(getDriver()).click(); waitForText("coefficient"); - kinshipTable = animalHistoryPage.getActiveReportDataRegion(); - assertEquals("Incorrect number of rows before the limiting animal selection", 2, kinshipTable.getDataRowCount()); + kinshipTable = animalHistoryPage.getActiveReportDataRegion(); + assertEquals("Incorrect number of rows after limiting animal selection", 2, kinshipTable.getDataRowCount()); } @Test From 950b5a777621bce78bc3ef0a3dc8aaff02ccd251 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Wed, 17 Mar 2021 17:55:14 -0700 Subject: [PATCH 06/10] Increasing the timeout for ONPRC_EHRTest2 --- .../src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 459d5367b..aaef84904 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -63,7 +63,7 @@ import java.util.regex.Pattern; @Category({CustomModules.class, EHR.class, ONPRC.class}) -@BaseWebDriverTest.ClassTimeout(minutes = 6) +@BaseWebDriverTest.ClassTimeout(minutes = 10) public class ONPRC_EHRTest2 extends AbstractONPRC_EHRTest { public AbstractContainerHelper _containerHelper = new APIContainerHelper(this); From b8f8c9966a4de6e2929074324bc4b306290eb73b Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Thu, 18 Mar 2021 18:11:50 -0700 Subject: [PATCH 07/10] Fixing the teamcity test failures. --- .../src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java | 3 +-- .../src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java index 6b5b5e5dd..f72e7d4bc 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest.java @@ -1237,8 +1237,7 @@ public void testGeneticsPipeline() throws Exception DataRegionTable kinshipTable = animalHistoryPage.getActiveReportDataRegion(); assertEquals("Incorrect number of rows before limiting animal selection", 3, kinshipTable.getDataRowCount()); - Locator.linkWithText("CLICK HERE TO LIMIT TO ANIMALS IN SELECTION").findElement(getDriver()).click(); - waitForText("coefficient"); + 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()); diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index aaef84904..3952dbadf 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -63,7 +63,7 @@ import java.util.regex.Pattern; @Category({CustomModules.class, EHR.class, ONPRC.class}) -@BaseWebDriverTest.ClassTimeout(minutes = 10) +@BaseWebDriverTest.ClassTimeout(minutes = 12) public class ONPRC_EHRTest2 extends AbstractONPRC_EHRTest { public AbstractContainerHelper _containerHelper = new APIContainerHelper(this); From 26bc79d06ace1c762ee26ab99f392fb69c3f0d8b Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Fri, 19 Mar 2021 14:10:36 -0700 Subject: [PATCH 08/10] setting the time part to 0 to get more consistent results --- .../org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 3952dbadf..31b65a1f7 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -1002,8 +1002,8 @@ public void bulkUploadsTest() @Test public void testTreatmentToDrugETL() { - LocalDateTime beginDate = LocalDateTime.now(); - LocalDateTime endDate = LocalDateTime.now().plusDays(2); + LocalDateTime beginDate = LocalDateTime.now().withHour(0).withMinute(0); + LocalDateTime endDate = LocalDateTime.now().withHour(0).withMinute(0).plusDays(2); String animalId = "12345"; log("Creating the Treatment order request"); @@ -1033,7 +1033,7 @@ public void testTreatmentToDrugETL() goToSchemaBrowser(); table = viewQueryData("study", "drug"); table.setFilter("Id", "Equals", animalId); - checker().verifyEquals("ETL did not populate the study.drug", 1, table.getDataRowCount()); + checker().verifyEquals("ETL did not populate the study.drug", 2, table.getDataRowCount()); } @Test @@ -1064,7 +1064,7 @@ public void bloodRequestTest() throws IOException, CommandException waitAndClickAndWait(Locator.linkWithText("ASB SERVICES REQUEST")); addBloodDrawRequest(animalId, now, "795644", "ChargeUnit2", "Heparin", 12); - checker().verifyTrue("Expected error is not present", isAnyTextPresent( + checker().withScreenshot("Blood request").verifyTrue("Expected error is not present", isAnyTextPresent( "Row 1, # of Tubes: ERROR: The quantity requested, 12.0ml exceeds the available blood volume, 8.0ml for AnimalId: 12345")); //Updating the total volume below the the available blood volume. From 7f87ac3ca4c158cfe7f334a873252f4c392b5a33 Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Fri, 19 Mar 2021 14:32:05 -0700 Subject: [PATCH 09/10] Increased timeout --- .../src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 31b65a1f7..8962519b1 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -63,7 +63,7 @@ import java.util.regex.Pattern; @Category({CustomModules.class, EHR.class, ONPRC.class}) -@BaseWebDriverTest.ClassTimeout(minutes = 12) +@BaseWebDriverTest.ClassTimeout(minutes = 18) public class ONPRC_EHRTest2 extends AbstractONPRC_EHRTest { public AbstractContainerHelper _containerHelper = new APIContainerHelper(this); From d390ef7c69e13a8f13306d5acee63c30258b4e3a Mon Sep 17 00:00:00 2001 From: labkey-sweta Date: Tue, 23 Mar 2021 18:26:14 -0700 Subject: [PATCH 10/10] Teamcity timing issues --- .../src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java index 8962519b1..0b7cb16d5 100644 --- a/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java +++ b/ehr/test/src/org/labkey/test/tests/onprc_ehr/ONPRC_EHRTest2.java @@ -1027,7 +1027,7 @@ public void testTreatmentToDrugETL() log("Running the treatment to drug ETL"); goToModule("DataIntegration"); - _etlHelper.runETL("{ONPRC_EHR}/treatmentToDrug"); + _etlHelper.runETL("{ONPRC_EHR}/TreatmentToDrug"); log("Verifying the drug table was populated"); goToSchemaBrowser(); @@ -1070,8 +1070,8 @@ public void bloodRequestTest() throws IOException, CommandException //Updating the total volume below the the available blood volume. updateTotalVolume(8); - shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span", "Request"))); - clickButton("Request"); + shortWait().until(ExpectedConditions.elementToBeClickable(Locator.tagWithText("span", "Request"))).click(); + clickButton("Request","My Pending Requests"); DataRegionTable table = new DataRegionTable("study|blood", getDriver()); checker().verifyEquals("New blood draw request is not created", 1, table.getDataRowCount());