Skip to content

Commit 0c954cf

Browse files
committed
MCC test inprovements
1 parent 8eeaa56 commit 0c954cf

File tree

2 files changed

+99
-13
lines changed

2 files changed

+99
-13
lines changed

LabPurchasing/test/src/org/labkey/test/tests/labpurchasing/LabPurchasingTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ public void testLabPurchasingModule()
166166
dr = DataRegionTable.DataRegion(getDriver()).withName("query").waitFor();
167167
dr.goToView("Waiting for Item");
168168
dr.checkCheckbox(0);
169-
Assert.assertEquals("OrderXXXX", dr.getRowDataAsText(0, "orderNumber").get(0));
169+
Assert.assertEquals("OrderXXXX", dr.getDataAsText(0, "orderNumber"));
170170

171171
dr.clickHeaderMenu("More Actions", false, "Mark Received");
172172
new Window.WindowFinder(getDriver()).withTitle("Mark Received").waitFor();
@@ -178,7 +178,7 @@ public void testLabPurchasingModule()
178178
Assert.assertEquals(0, dr.getDataRowCount());
179179

180180
dr.goToView("All Items");
181-
Assert.assertEquals("-80 Freezer", dr.getRowDataAsText(1, "itemLocation").get(0));
181+
Assert.assertEquals("-80 Freezer", dr.getDataAsText(1, "itemLocation"));
182182
}
183183

184184
@Override

mcc/test/src/org/labkey/test/tests/mcc/MccTest.java

Lines changed: 97 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,20 @@
3333
import org.labkey.test.WebTestHelper;
3434
import org.labkey.test.categories.External;
3535
import org.labkey.test.categories.LabModule;
36+
import org.labkey.test.components.ext4.Window;
3637
import org.labkey.test.util.ApiPermissionsHelper;
3738
import org.labkey.test.util.DataRegionTable;
39+
import org.labkey.test.util.Ext4Helper;
3840
import org.labkey.test.util.PermissionsHelper;
41+
import org.labkey.test.util.ext4cmp.Ext4ComboRef;
42+
import org.labkey.test.util.ext4cmp.Ext4FieldRef;
3943

44+
import java.text.SimpleDateFormat;
4045
import java.util.ArrayList;
4146
import java.util.Arrays;
4247
import java.util.Collection;
4348
import java.util.Collections;
49+
import java.util.Date;
4450
import java.util.List;
4551
import java.util.Map;
4652
import java.util.stream.Collectors;
@@ -51,12 +57,79 @@ public class MccTest extends BaseWebDriverTest
5157
@Test
5258
public void testMccModule() throws Exception
5359
{
54-
_containerHelper.enableModule("Mcc");
60+
//doRequestFormTest();
61+
//doRequestFormTestWithFailure();
5562

56-
doRequestFormTest();
57-
doRequestFormTestWithFailure();
63+
//testInvalidId();
5864

59-
testInvalidId();
65+
testAnimalImportAndTransfer();
66+
}
67+
68+
private void testAnimalImportAndTransfer()
69+
{
70+
beginAt(getProjectName() + "/Colonies/SNPRC/project-begin.view");
71+
// waitAndClickAndWait(Locator.tagWithText("a", "Import Excel-Based Data"));
72+
// waitForElement(Locator.tagWithText("label", "Paste Data Below:"));
73+
// Ext4FieldRef.getForLabel(this, "Center/Colony Name").setValue("SNPRC");
74+
//
75+
// Ext4FieldRef.getForLabel(this, "Paste Data Below").setValue(
76+
// "animal ID\tprevious IDs\tsource\t\"DOB\n(MM/DD/YYYY)\"\tsex\tmaternal ID\tpaternal ID\t\"weight(grams)\"\t\"date of weight\n(MM/DD/YY)\"\tU24 status\tavailalble to transfer\tcurrent housing status\tinfant history\tfertility status\tmedical history\n" +
77+
// "Animal1\t\t\t7/10/2011\t0 - male\tDam1\tSire1\t382.8\t5/19/2021\t0 - not assigned to U24 breeding colony\t0 - not available for transfer\t1 - natal family group\t3 - successful rearing of offspring\t2 - successful offspring produced\t0 - naive animal\n" +
78+
// "Animal2\t\t\t6/3/2015\t1 - female\tDam2\tSire2\t361.2\t1/28/2021\t0 - not assigned to U24 breeding colony\t0 - not available for transfer\t2 - active breeding\t3 - successful rearing of offspring\t2 - successful offspring produced\t0 - naive animal"
79+
// );
80+
//
81+
// waitAndClick(Ext4Helper.Locators.ext4Button("Preview"));
82+
// waitForElement(Locator.tagWithText("td", "Animal2").withClass("dt-center"));
83+
//
84+
// waitAndClick(getButton("Submit"));
85+
// new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
86+
// waitAndClick(Ext4Helper.Locators.ext4Button("OK"));
87+
88+
waitAndClickAndWait(Locator.tagWithText("a", "View Study Datasets"));
89+
waitAndClickAndWait(Locator.tagWithText("a", "Demographics"));
90+
91+
DataRegionTable dr = DataRegionTable.DataRegion(getDriver()).withName("Dataset").waitFor();
92+
dr.checkCheckbox(1); //Animal2
93+
Assert.assertEquals("Incorrect ID", "Animal2", dr.getDataAsText(1, "Id"));
94+
Assert.assertEquals("Incorrect Status", "<Alive>", dr.getDataAsText(1, "Status"));
95+
String mccId = dr.getDataAsText(1, "MCC Alias");
96+
97+
dr.clickHeaderMenu("More Actions", false, "Mark Animal Shipped");
98+
99+
new Window.WindowFinder(getDriver()).withTitle("Mark ID Shipped").waitFor();
100+
Ext4FieldRef.getForLabel(this, "Effective Date").setValue(new SimpleDateFormat("MM/dd/yyyy").format(new Date()));
101+
Ext4ComboRef combo = Ext4ComboRef.getForLabel(this, "Destination Center Name");
102+
combo.clickTrigger();
103+
waitAndClick(Locator.tagContainingText("li", "Other"));
104+
105+
Window dialog = new Window.WindowFinder(getDriver()).withTitle("Enter Value").waitFor();
106+
dialog.findElement(Locator.tag("input")).sendKeys("TargetColony");
107+
waitAndClick(Ext4Helper.Locators.ext4Button("OK"));
108+
sleep(100);
109+
110+
Ext4ComboRef.getForLabel(this, "Target Folder").setComboByDisplayValue("Other");
111+
waitAndClick(Ext4Helper.Locators.ext4Button("Submit"));
112+
113+
new Window.WindowFinder(getDriver()).withTitle("Success").waitFor();
114+
waitAndClickAndWait(Ext4Helper.Locators.ext4Button("OK"));
115+
116+
dr = DataRegionTable.DataRegion(getDriver()).withName("Dataset").waitFor();
117+
Assert.assertEquals("Incorrect ID", "Animal2", dr.getDataAsText(1, "Id"));
118+
Assert.assertEquals("Incorrect Status", "<Shipped>", dr.getDataAsText(1, "Status"));
119+
Assert.assertEquals("Incorrect Value", "true", dr.getDataAsText(1, "Exclude From Census?"));
120+
Assert.assertEquals("Incorrect Colony", "TargetColony", dr.getDataAsText(1, "Current Colony"));
121+
122+
// Verify result:
123+
beginAt(getProjectName() + "/Colonies/Other/project-begin.view");
124+
waitAndClickAndWait(Locator.tagWithText("a", "View Study Datasets"));
125+
waitAndClickAndWait(Locator.tagWithText("a", "Demographics"));
126+
127+
dr = DataRegionTable.DataRegion(getDriver()).withName("Dataset").waitFor();
128+
Assert.assertEquals("Incorrect ID", "Animal2", dr.getDataAsText(0, "Id"));
129+
Assert.assertEquals("Incorrect Alias", mccId, dr.getDataAsText(0, "Id"));
130+
Assert.assertEquals("Incorrect Status", "<Alive>", dr.getDataAsText(0, "Status"));
131+
Assert.assertEquals("Incorrect Colony", "TargetColony", dr.getDataAsText(0, "colony"));
132+
Assert.assertEquals("Incorrect Source", "SNPRC", dr.getDataAsText(0, "source"));
60133
}
61134

62135
private static class FormElement
@@ -628,14 +701,14 @@ private void setFormValues(@Nullable Collection<String> fieldsToSkip)
628701
@Override
629702
protected void doCleanup(boolean afterTest) throws TestTimeoutException
630703
{
631-
super.doCleanup(afterTest);
704+
// super.doCleanup(afterTest);
632705
}
633706

634707
@BeforeClass
635708
public static void setupProject() throws Exception
636709
{
637-
MccTest init = (MccTest)getCurrentTest();
638-
init.doSetup();
710+
// MccTest init = (MccTest)getCurrentTest();
711+
// init.doSetup();
639712
}
640713

641714
private void doSetup() throws Exception
@@ -644,14 +717,15 @@ private void doSetup() throws Exception
644717
_containerHelper.createProject(getProjectName());
645718
_containerHelper.enableModules(Arrays.asList("MCC", "Study"));
646719

647-
importStudy();
720+
importStudy(getProjectName());
648721

649722
_containerHelper.setFolderType("MCC");
650723
setModuleProperties(Arrays.asList(
651724
new ModulePropertyValue("MCC", "/", "MCCContainer", "/" + getProjectName()),
652725
new ModulePropertyValue("MCC", "/", "MCCRequestContainer", "/" + getProjectName()),
653726
new ModulePropertyValue("MCC", "/", "MCCContactUsers", getCurrentUserName()),
654-
new ModulePropertyValue("MCC", "/", "MCCRequestNotificationUsers", getCurrentUserName())
727+
new ModulePropertyValue("MCC", "/", "MCCRequestNotificationUsers", getCurrentUserName()),
728+
new ModulePropertyValue("MCC", "/", "MCCInternalDataContainer", "/" + getProjectName() + "/Colonies")
655729
));
656730

657731
beginAt("/mcc/" + getProjectName() + "/configureMcc.view");
@@ -666,6 +740,14 @@ private void doSetup() throws Exception
666740
{
667741
log("Member already in group. This is not expected for fresh installations or TeamCity");
668742
}
743+
744+
// Raw data folders:
745+
_containerHelper.createSubfolder(getProjectName(), "Colonies", "MCC Colony");
746+
for (String name : Arrays.asList("SNPRC", "WNPRC", "UCSD", "Other"))
747+
{
748+
_containerHelper.createSubfolder(getProjectName() + "/Colonies", name, "MCC Colony");
749+
importStudy(getProjectName() + "/Colonies/" + name);
750+
}
669751
}
670752

671753
private void testInvalidId()
@@ -676,11 +758,15 @@ private void testInvalidId()
676758
}
677759

678760

679-
private void importStudy()
761+
private void importStudy(String containerPath)
680762
{
681-
beginAt(WebTestHelper.getBaseURL() + "/mcc/" + getProjectName() + "/importStudy.view");
763+
beginAt(WebTestHelper.getBaseURL() + "/mcc/" + containerPath + "/importStudy.view");
682764
clickButton("OK");
683765
waitForPipelineJobsToComplete(1, "Study import", false, MAX_WAIT_SECONDS * 2500);
766+
767+
beginAt(WebTestHelper.getBaseURL() + "/ehr/" + containerPath + "/ensureQcStates.view");
768+
clickButton("OK");
769+
684770
}
685771

686772
@Before

0 commit comments

Comments
 (0)