Skip to content

Commit 4c2cb4c

Browse files
Update GridBar.setAliquotView to be more reliable (#2807)
1 parent 06bcbe8 commit 4c2cb4c

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

src/org/labkey/test/components/ui/grids/GridBar.java

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
import java.util.HashMap;
2626
import java.util.List;
2727
import java.util.Map;
28+
import java.util.Objects;
2829

2930
import static org.labkey.test.WebDriverWrapper.sleep;
3031

@@ -301,13 +302,18 @@ public AliquotViewOptions getCurrentAliquotView()
301302
*/
302303
public void setAliquotView(AliquotViewOptions view)
303304
{
305+
306+
// Do nothing if currently on the requested menu item.
307+
if (getCurrentAliquotView().equals(view))
308+
return;
309+
304310
// Need to identify where we are. The menu text is contextual to the page.
305-
String url = getDriver().getCurrentUrl().toLowerCase();
311+
String url = Objects.requireNonNull(getDriver().getCurrentUrl()).toLowerCase();
306312
boolean onSourcesPage = url.contains("#/sources/");
307313
boolean onSamplePage = url.contains("#/samples/");
308314

309315
String currentButtonText = currentAliquotViewText();
310-
String menuChoice = "";
316+
final String menuChoice;
311317

312318
switch (view)
313319
{
@@ -354,10 +360,13 @@ else if(onSamplePage)
354360
case ALIQUOTS:
355361
menuChoice = "Aliquots Only";
356362
break;
363+
default:
364+
menuChoice = "";
357365
}
358366

367+
// Ideally should call _queryGrid.doAndWaitForUpdate(... but that causes the grid to go stale and is tricky to
368+
// get a recover the reference to it.
359369
doMenuAction(currentButtonText, Arrays.asList(menuChoice));
360-
361370
}
362371

363372
public GridBar searchFor(String searchStr)

src/org/labkey/test/tests/SampleTypeRenameTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import org.labkey.test.util.TestDataGenerator;
2222
import org.labkey.test.util.exp.SampleTypeAPIHelper;
2323
import org.labkey.test.util.search.SearchAdminAPIHelper;
24-
import org.openqa.selenium.Keys;
2524
import org.openqa.selenium.WebElement;
2625

2726
import java.io.IOException;

0 commit comments

Comments
 (0)