From beffd099c3f46d82ebae311260a56a47907d0106 Mon Sep 17 00:00:00 2001 From: delchev Date: Fri, 3 Jul 2026 01:07:46 +0300 Subject: [PATCH] fix(tests): EdmView.regenerate waits for the generated sources, not the transient toast DependsOnIT (and every PredefinedProjectIT generating from an EDM) asserted the "Generated from model" success toast via a cross-frame text sweep. On slow CI runners the sweep can outlast the toast, and its timeout fallback RELOADS the page - destroying the toast for good, so the retry can never succeed. Failure screenshots showed the toast on screen and the gen folder already created while the assertion still failed; the flake hit master too (fails alongside a runner-side Selenium "Failed to establish BiDi connection" error that slows/breaks the frame iteration). Wait for the durable effect instead: the generated sources landing in the workspace project's gen folder, polled through IRepository (the same approach IntentEditorLoadsIT uses). Co-Authored-By: Claude Fable 5 --- .../tests/framework/ide/EdmView.java | 22 ++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/tests/tests-framework/src/main/java/org/eclipse/dirigible/tests/framework/ide/EdmView.java b/tests/tests-framework/src/main/java/org/eclipse/dirigible/tests/framework/ide/EdmView.java index 086c3dcf192..ba2c0c9d761 100644 --- a/tests/tests-framework/src/main/java/org/eclipse/dirigible/tests/framework/ide/EdmView.java +++ b/tests/tests-framework/src/main/java/org/eclipse/dirigible/tests/framework/ide/EdmView.java @@ -9,6 +9,11 @@ */ package org.eclipse.dirigible.tests.framework.ide; +import java.util.concurrent.TimeUnit; + +import org.awaitility.Awaitility; +import org.eclipse.dirigible.repository.api.IRepository; +import org.eclipse.dirigible.repository.api.IRepositoryStructure; import org.eclipse.dirigible.tests.framework.browser.Browser; import org.eclipse.dirigible.tests.framework.browser.HtmlAttribute; import org.eclipse.dirigible.tests.framework.browser.HtmlElementType; @@ -21,10 +26,12 @@ public class EdmView { private final Browser browser; private final WorkbenchFactory workbenchFactory; + private final IRepository repository; - public EdmView(Browser browser, WorkbenchFactory workbenchFactory) { + public EdmView(Browser browser, WorkbenchFactory workbenchFactory, IRepository repository) { this.browser = browser; this.workbenchFactory = workbenchFactory; + this.repository = repository; } public void regenerate(String projectName, String edmFileName) { @@ -32,7 +39,16 @@ public void regenerate(String projectName, String edmFileName) { workbench.openFile(projectName, edmFileName); browser.clickOnElementByAttributePattern(HtmlElementType.BUTTON, HtmlAttribute.TITLE, "Regenerate"); - browser.assertElementExistsByTypeAndContainsText(HtmlElementType.SPAN, "Generated from model"); + // Wait for the DURABLE effect of the regeneration - the generated sources landing in the + // project's gen folder - not the transient "Generated from model" toast. On slow CI runners + // the cross-frame text sweep can outlast the toast, and the sweep's timeout fallback reloads + // the page, destroying it for good (failure screenshots showed the toast on screen and the + // gen folder already created while the assertion still failed - the recurring DependsOnIT + // flake that also hit master). + String genPath = IRepositoryStructure.PATH_USERS + "/admin/workspace/" + projectName + "/gen"; + Awaitility.await() + .atMost(120, TimeUnit.SECONDS) + .pollInterval(1, TimeUnit.SECONDS) + .until(() -> repository.hasCollection(genPath)); } } -