Skip to content

Commit

Permalink
await expected conditions after tab delete (#1601)
Browse files Browse the repository at this point in the history
  • Loading branch information
labkey-chrisj authored Aug 4, 2023
1 parent b3453da commit edd7162
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions src/org/labkey/test/tests/TabTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import org.junit.experimental.categories.Category;
import org.labkey.test.BaseWebDriverTest;
import org.labkey.test.Locator;
import org.labkey.test.WebDriverWrapper;
import org.labkey.test.categories.Daily;
import org.labkey.test.components.BodyWebPart;
import org.labkey.test.components.labkey.PortalTab;
import org.labkey.test.util.Ext4Helper;
import org.labkey.test.util.LabKeyExpectedConditions;
Expand All @@ -30,6 +30,7 @@
import org.openqa.selenium.WebElement;

import java.util.List;
import java.util.NoSuchElementException;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
Expand Down Expand Up @@ -114,14 +115,23 @@ private void doTabManagementTests()
String tab2Delete = "RENAMED TAB 1";
portalHelper.activateTab(tab2Delete);
portalHelper.deleteTab("Test Tab 2");
List<BodyWebPart> bodyparts = portalHelper.getBodyWebParts();
assertTrue("Webparts failed to load after tab delete while on page", bodyparts != null && bodyparts.size() > 0);
assertEquals("Wrong tab selected after tab deletion", tab2Delete, getText(PortalHelper.Locators.activeTab().containing(tab2Delete)).replace(Locator.NBSP, " ").trim());
WebDriverWrapper.waitFor(()-> portalHelper.getBodyWebParts().size() > 0,
"Webparts failed to load after tab delete while on page", 2000);
WebDriverWrapper.waitFor(()-> {
try
{
return getText(PortalHelper.Locators.activeTab())
.replace(Locator.NBSP, " ").equals(tab2Delete);
}catch (NoSuchElementException retry)
{
return false;
}
}, "Wrong tab selected after tab deletion", 2000);

//Delete tab while on the Tab
portalHelper.deleteTab(tab2Delete);
bodyparts = portalHelper.getBodyWebParts();
assertTrue("Webparts failed to load after tab delete", bodyparts != null && bodyparts.size() > 0);
WebDriverWrapper.waitFor(()-> portalHelper.getBodyWebParts().size() > 0,
"Webparts failed to load after tab delete while on page", 2000);
}

@LogMethod
Expand Down

0 comments on commit edd7162

Please sign in to comment.