vaadin / testbench

Vaadin TestBench is a tool for automated user interface testing of Vaadin applications.
https://vaadin.com/testbench
Other
20 stars 22 forks source link

Wait for dev bundle build in waitForVaadin #1705

Closed mshabarov closed 11 months ago

mshabarov commented 11 months ago

Vaadin Flow 24.3 has now a "Building front-end development bundle" spinner shown on the page when dev bundle is being generated, see this issue.

TestBench should take this into account in waitForVaadin method to let Flow apps to properly wait until custom dev bundle is ready.

Possible solution is to wait until spinner div

<div class="message">Building front-end development bundle</div>

disappears, like shown below:

waitUntil(driver -> {
            try {
                TestBenchElement testBenchElement = $("div").attribute("class", "message").waitForFirst();
                return testBenchElement == null;
            } catch (TimeoutException e){
                return true;
            } catch (NoSuchElementException e){
                return true;
            }
        });
TatuLund commented 11 months ago

I have used slightly different wayt to do the same

https://github.com/TatuLund/bean-table/blob/v24/src/test/java/org/vaadin/tatu/AbstractViewTest.java#L123

mshabarov commented 11 months ago

UPD: TestBench waitForVaadin method already has a check for dev server here.

This checks for a flag devServerIsNotLoaded which is added on "dev mode not ready" page here.

Since the custom dev bundle build shows the same dev-mode-not-ready page now, I expect that the existing TestBench implementation works properly.

We should start with testing the waitForVaadin() method properly waiting until custom dev bundle build in Spring+Flow skeleton starter project with JS customisations.