MPDL / imeji-gui-testing

Automatic Testing of imeji GUI
Apache License 2.0
1 stars 0 forks source link

Refactor the wait and the page-loading handling #34

Open helkv opened 6 years ago

helkv commented 6 years ago

When a new page is loaded and after certain actions the test-execution has to wait until all needed web-elements are present in the DOM. Sometimes a loading screen (.loaderWrapper) is displayed.

Actual Approach:

Problems:

TODO:

helkv commented 5 years ago

General Waiting-Approaches proofed to be successful:

  1. Wait directly after a Selenium action for something to be loaded
    • Wait until an element is no longer attached to the DOM: WebElement elementToBecomeStale = driver.findelement(...); buttonElement.click() wait.until(ExpectedConditions.stalenessOf(elementToBecomeStale));
    • This can be appended by checking the loading status of the page (after the staleness-wait): wait.until(webDriver -> ((JavascriptExecutor) webDriver).executeScript("return document.readyState").equals("complete"));
  2. Wait directly before a Selenium action for the element to be available
    • Wait until the element is visible wait.until(ExpectedConditions.elementToBeClickable(element));
    • Wait until the element is clickable wait.until(ExpectedConditions.visibilityOf(element));