From 5a2acf94e5c163cb0cae0d1902d5e755ad26caf9 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Sat, 5 Oct 2024 17:36:38 +0200 Subject: [PATCH 1/2] Add license text & update comments in SWTBot test Amends 7c195df69383cc2798775df0fd4e169e3e843de5 --- .../ui/MavenTargetDependencyEditorTest.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java index 6cbf0252a..a95de7b0e 100644 --- a/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java +++ b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java @@ -1,3 +1,15 @@ +/******************************************************************************* + * Copyright (c) 2024 Patrick Ziegler and others. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * https://www.eclipse.org/legal/epl-2.0. + * + * SPDX-License-Identifier: EPL-2.0 + * + * Contributors: + * Patrick Ziegler - initial API and implementation + *******************************************************************************/ package org.eclipse.m2e.pde.ui; import static org.junit.Assert.assertEquals; @@ -224,8 +236,8 @@ public void testAddMavenLocation() throws Exception { assertFalse(robot.button("Update").isEnabled()); assertFalse(robot.button("Finish").isEnabled()); - // There is no elegant way to select the cell editor, - // but we know that opening it focuses the text widget + // There is no elegant way to select the cell editor, but we + // know that it will be the first text widget in the dialog. table.click(19, 0); robot.text(0).setText("org.apache.commons"); table.click(19, 1); @@ -400,7 +412,7 @@ public void testColumnSorting() throws Exception { table.header("Artifact Id").click(); assertEquals(table.cell(0, 1), "caffeine"); - // Sort by Artifact Id + // Sort by Group Id table.header("Group Id").click(); assertEquals(table.cell(0, 1), "jackson-annotations"); From 66be5a532d00d723c5a66048a87be419616791a3 Mon Sep 17 00:00:00 2001 From: Patrick Ziegler Date: Fri, 18 Oct 2024 00:22:48 +0200 Subject: [PATCH 2/2] Attempt to stabilize MavenTargetDependencyEditorTest Create more descriptive failure messages and delay validation of button enablement to give the dialog more time to update. --- .../m2e/pde/ui/MavenTargetDependencyEditorTest.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java index a95de7b0e..44fb9e9d4 100644 --- a/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java +++ b/org.eclipse.m2e.swtbot.tests/src/org/eclipse/m2e/pde/ui/MavenTargetDependencyEditorTest.java @@ -234,8 +234,8 @@ public void testAddMavenLocation() throws Exception { assertEquals(table.cell(19, 3), ""); assertEquals(table.cell(19, 4), "jar"); - assertFalse(robot.button("Update").isEnabled()); - assertFalse(robot.button("Finish").isEnabled()); + assertFalse("Expected \"Update\" button to be disabled", robot.button("Update").isEnabled()); + assertFalse("Expected \"Finish\" button to be disabled", robot.button("Finish").isEnabled()); // There is no elegant way to select the cell editor, but we // know that it will be the first text widget in the dialog. table.click(19, 0); @@ -246,14 +246,14 @@ public void testAddMavenLocation() throws Exception { robot.text(0).setText("3.12.0"); table.click(19, 3); // Close cell editor - assertTrue(robot.button("Update").isEnabled()); - assertTrue(robot.button("Finish").isEnabled()); - assertEquals(table.cell(19, 0), "org.apache.commons"); assertEquals(table.cell(19, 1), "commons-lang3"); assertEquals(table.cell(19, 2), "3.12.0"); assertEquals(table.cell(19, 3), ""); assertEquals(table.cell(19, 4), "jar"); + + assertTrue("Expected \"Update\" button to be enabled", robot.button("Update").isEnabled()); + assertTrue("Expected \"Finished\" button to be enabled", robot.button("Finish").isEnabled()); } /**