From e0e77013415f053ce228be1a3f9a14e08d361bda Mon Sep 17 00:00:00 2001 From: xiangzihao <460888207@qq.com> Date: Mon, 21 Mar 2022 17:30:33 +0800 Subject: [PATCH] [E2E] [CI] Fix flaky e2e test cause by #9036 (#9053) --- .../workflow/task/SubWorkflowTaskForm.java | 2 ++ .../e2e/pages/resource/ResourcePage.java | 4 ++- .../e2e/pages/security/SecurityPage.java | 25 +++++++++++++------ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java index f18afabfd1..dddf6e7ba6 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/project/workflow/task/SubWorkflowTaskForm.java @@ -53,6 +53,8 @@ public final class SubWorkflowTaskForm extends TaskNodeForm { } public SubWorkflowTaskForm childNode(String node) { + new WebDriverWait(driver, 5).until(ExpectedConditions.elementToBeClickable(btnSelectChildNodeDropdown)); + btnSelectChildNodeDropdown().click(); new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(By.className( diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java index 68c6556c21..7cc50e6120 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/resource/ResourcePage.java @@ -47,19 +47,21 @@ public class ResourcePage extends NavBarPage implements NavBarPage.NavBarItem { public T goToTab(Class tab) { if (tab == FileManagePage.class) { - new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/file-manage")); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(fileManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", fileManageTab()); return tab.cast(new FileManagePage(driver)); } if (tab == UdfManagePage.class) { + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(udfManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", udfManageTab()); return tab.cast(new UdfManagePage(driver)); } if (tab == FunctionManagePage.class) { + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/resource")); new WebDriverWait(driver, 10).until(ExpectedConditions.elementToBeClickable(functionManageTab)); ((JavascriptExecutor) driver).executeScript("arguments[0].click();", functionManageTab()); return tab.cast(new FunctionManagePage(driver)); diff --git a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java index 65e5208229..1f8565090b 100644 --- a/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java +++ b/dolphinscheduler-e2e/dolphinscheduler-e2e-case/src/test/java/org/apache/dolphinscheduler/e2e/pages/security/SecurityPage.java @@ -63,40 +63,51 @@ public class SecurityPage extends NavBarPage implements NavBarItem { public T goToTab(Class tab) { if (tab == TenantPage.class) { + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuTenantManage)); - menuTenantManage.click(); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuTenantManage()); return tab.cast(new TenantPage(driver)); } if (tab == UserPage.class) { + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menUserManage)); - menUserManage.click(); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menUserManage()); return tab.cast(new UserPage(driver)); } if (tab == WorkerGroupPage.class) { + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menWorkerGroupManage)); - menWorkerGroupManage.click(); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menWorkerGroupManage()); return tab.cast(new WorkerGroupPage(driver)); } if (tab == QueuePage.class) { - menuQueueManage().click(); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuQueueManage)); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuQueueManage()); return tab.cast(new QueuePage(driver)); } if (tab == EnvironmentPage.class) { - menuEnvironmentManage().click(); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuEnvironmentManage)); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuEnvironmentManage()); return tab.cast(new EnvironmentPage(driver)); } if (tab == TokenPage.class) { - menuTokenManage().click(); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuTokenManage)); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuTokenManage()); return tab.cast(new TokenPage(driver)); } if (tab == NamespacePage.class) { - menuNamespaceManage().click(); + new WebDriverWait(driver, 10).until(ExpectedConditions.urlContains("/security")); + new WebDriverWait(driver, 60).until(ExpectedConditions.elementToBeClickable(menuNamespaceManage)); + ((JavascriptExecutor) driver).executeScript("arguments[0].click();", menuNamespaceManage()); return tab.cast(new NamespacePage(driver)); }