From ecf8300055a822a3a4ab1fe56f925649929a7160 Mon Sep 17 00:00:00 2001 From: Dan Duffek Date: Fri, 1 Dec 2023 11:47:39 -0800 Subject: [PATCH] Increase Wait Time in Test (#1739) --- .../tests/SampleTypeNameExpressionTest.java | 33 +++++++++++-------- 1 file changed, 20 insertions(+), 13 deletions(-) diff --git a/src/org/labkey/test/tests/SampleTypeNameExpressionTest.java b/src/org/labkey/test/tests/SampleTypeNameExpressionTest.java index ebe4221a3a..d107b9b4af 100644 --- a/src/org/labkey/test/tests/SampleTypeNameExpressionTest.java +++ b/src/org/labkey/test/tests/SampleTypeNameExpressionTest.java @@ -238,8 +238,8 @@ public void testWithTrickyCharacters() log("Validate save worked. Should be sent back to the project begin page and there should be a link with the sample type name."); checker().fatal() - .verifyTrue("Did not successfully save the sample type. Fatal error.", - waitFor(()->Locator.linkWithText(sampleTypeName).findWhenNeeded(getDriver()).isDisplayed(), 1_000)); + .verifyTrue(String.format("Did not find link with text '%s' for sample type. Fatal error.", sampleTypeName), + waitFor(()->Locator.linkWithText(sampleTypeName).findWhenNeeded(getDriver()).isDisplayed(), 5_000)); log("Create some samples and validate the name(s)."); @@ -490,8 +490,10 @@ public void testDeriveSampleFromSampleDetailsPage() throws Exception String intVal = "987"; String derivedSampleName = deriveSample(PARENT_SAMPLE_01, PARENT_SAMPLE_TYPE, sampleType, flagString, intVal); - checker().verifyTrue("Name of derived sample doesn't look correct.", derivedSampleName.contains("Parent Sample")); - checker().verifyTrue("Doesn't look like there is a link to the parent sample.", isElementPresent(Locator.linkWithText(PARENT_SAMPLE_01))); + checker().verifyTrue("Name of derived sample doesn't look correct. Should contain 'Parent Sample'.", + derivedSampleName.contains("Parent Sample")); + checker().verifyTrue(String.format("Doesn't look like there is a link to the parent sample '%s'.", PARENT_SAMPLE_01), + isElementPresent(Locator.linkWithText(PARENT_SAMPLE_01))); final String ancestorNameExpression = String.format("GrandChild_${MaterialInputs/%s/..[MaterialInputs/%s]/Str}_${genId}", sampleType, PARENT_SAMPLE_TYPE); log("Change the sample type name expression to support grandparent property lookup: " + ancestorNameExpression); @@ -506,8 +508,10 @@ public void testDeriveSampleFromSampleDetailsPage() throws Exception String flagStringGD = "grand child sample."; String intValGD = "567"; String grandChildSampleName = deriveSample(derivedSampleName, sampleType, sampleType, flagStringGD, intValGD); - checker().verifyTrue("Name of derived sample doesn't look correct.", grandChildSampleName.contains("Parent Sample") && !grandChildSampleName.contains(flagString)); - checker().verifyTrue("Doesn't look like there is a link to the parent sample.", isElementPresent(Locator.linkWithText(derivedSampleName))); + checker().verifyTrue(String.format("Name of derived sample doesn't look correct. Should contain 'Parent Sample' and not contain '%s'.", flagString), + grandChildSampleName.contains("Parent Sample") && !grandChildSampleName.contains(flagString)); + checker().verifyTrue(String.format("Doesn't look like there is a link to the parent sample '%s'.", derivedSampleName), + isElementPresent(Locator.linkWithText(derivedSampleName))); String flagStringBulkImport = "bulk imported grand child."; log("Derive a sample using bulk import but give it no name. The name expression should be used to name the derived sample."); @@ -527,9 +531,10 @@ public void testDeriveSampleFromSampleDetailsPage() throws Exception click(Locator.tagWithText("td", grandImportChildSampleName)); waitForElement(Locator.tagWithText("td", flagStringBulkImport)); - grandImportChildSampleName = Locator.tagWithText("td", "Name:").followingSibling("td").findElement(getDriver()).getText(); - checker().verifyTrue("Name of derived sample doesn't look correct.", grandChildSampleName.contains("Parent Sample") && !grandChildSampleName.contains(flagString)); - checker().verifyTrue("Doesn't look like there is a link to the parent sample.", isElementPresent(Locator.linkWithText(derivedSampleName))); + checker().verifyTrue(String.format("Name of derived sample doesn't look correct. Should contain 'Parent Sample' and not contain '%s'.", flagString), + grandChildSampleName.contains("Parent Sample") && !grandChildSampleName.contains(flagString)); + checker().verifyTrue(String.format("Doesn't look like there is a link to the parent sample '%s'.", derivedSampleName), + isElementPresent(Locator.linkWithText(derivedSampleName))); } private String deriveSample(String parentSampleName, String parentSampleType, String targetSampleType, String strVal, String intVal) throws IOException, CommandException @@ -768,11 +773,13 @@ public void testErrorsAndWarnings() actualMsg = dialog.getBodyText(); log("Dialog text: " + actualMsg); - checker().verifyTrue("Warning dialog does not have example name.", actualMsg.contains(nameExpression)); + checker().verifyTrue(String.format("Warning dialog does not have example text '%s'.", nameExpression), + actualMsg.contains(nameExpression)); expectedMsg = "The 'genId' substitution pattern starting at position 6 should be preceded by the string '${'."; - checker().verifyTrue("Warning dialog does not have expected warning message.", actualMsg.contains(expectedMsg)); + checker().verifyTrue(String.format("Warning dialog does not have expected warning message '%s'.", expectedMsg), + actualMsg.contains(expectedMsg)); checker().screenShotIfNewError("Warning_Dialog_Error"); @@ -1023,8 +1030,8 @@ public void testGenIdMinValue() waitAndClickAndWait(Locator.lkButton("Edit Type")); updatePage = new UpdateSampleTypePage(getDriver()); - log("The displayed genId should have incremented normall regardless of the minValue."); - checker().verifyEquals("After makin minValue smaller the value for the next genId is not as expected.", + log("The displayed genId should have incremented normally regardless of the minValue."); + checker().verifyEquals("After making minValue smaller the value for the next genId is not as expected.", Integer.toString(nextGenId), updatePage.getCurrentGenId()); minValue = 500;