Skip to content
Snippets Groups Projects
Commit b7212a0b authored by Michael Hamann's avatar Michael Hamann
Browse files

[Misc] Wait more thoroughly for the tree to be loaded

This is an attempt to reduce flickering in tests that might be caused by
proceeding too quickly with loading other tree nodes while the initial
tree nodes are still loading. Then possibly the selection of the root
node might not be cleared correctly before selecting the desired node as
the root node is automatically selected during the initial load.

(cherry picked from commit 8e0c1cd9)
parent 5d4c8eef
No related branches found
No related tags found
No related merge requests found
...@@ -26,10 +26,8 @@ ...@@ -26,10 +26,8 @@
import org.openqa.selenium.By; import org.openqa.selenium.By;
import org.openqa.selenium.Keys; import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement; import org.openqa.selenium.WebElement;
import org.openqa.selenium.interactions.Actions; import org.openqa.selenium.interactions.Actions;
import org.openqa.selenium.support.ui.ExpectedCondition;
import org.xwiki.test.ui.po.BaseElement; import org.xwiki.test.ui.po.BaseElement;
/** /**
...@@ -117,15 +115,12 @@ public TreeElement waitForIt() ...@@ -117,15 +115,12 @@ public TreeElement waitForIt()
// being initialized, so its presence guarantees that the tree initialization has started. // being initialized, so its presence guarantees that the tree initialization has started.
getDriver().waitUntilElementIsVisible(this.element, By.cssSelector(".jstree-container-ul")); getDriver().waitUntilElementIsVisible(this.element, By.cssSelector(".jstree-container-ul"));
// Wait for the root node to be loaded. // Wait for the root node to be loaded.
getDriver().waitUntilCondition(new ExpectedCondition<Boolean>() getDriver().waitUntilCondition(driver ->
{ // The tree element is marked as busy while the tree nodes are being loaded.
@Override !Boolean.parseBoolean(this.element.getAttribute("aria-busy"))
public Boolean apply(WebDriver driver) // Check if there is any descendant of the element that is marked as busy.
{ && this.element.findElements(By.cssSelector("[aria-busy = 'true']")).isEmpty()
// The tree element is marked as busy while the tree nodes are being loaded. );
return !Boolean.valueOf(element.getAttribute("aria-busy"));
}
});
return this; return this;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment