diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java index a9f3bcf2..e47213d4 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/UITestRunner.java @@ -51,6 +51,11 @@ public class UITestRunner { private static RemoteRobot remoteRobot = null; private static Process ideProcess; private static IntelliJVersion ideaVersion; + private static final String NEW_ITEM_PROPERTY = "New-ItemProperty"; + private static final String NAME_PARAM = "-Name"; + private static final String VALUE_PARAM = "-Value"; + + private UITestRunner() {} /** * Start the given version of IntelliJ Idea listening on the given port @@ -221,9 +226,9 @@ private static void acceptAllTermsAndConditions() { String powershellLocation = "C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe"; String powershellPathParameter = "-Path"; ProcessBuilder pb1 = new ProcessBuilder(powershellLocation, "New-Item", powershellPathParameter, registryPath, "-Force"); - ProcessBuilder pb2 = new ProcessBuilder(powershellLocation, "New-ItemProperty", powershellPathParameter, registryPath, "-Name", "accepted_version", "-Value", "'2.1'"); - ProcessBuilder pb3 = new ProcessBuilder(powershellLocation, "New-ItemProperty", powershellPathParameter, registryPath, "-Name", "euacommunity_accepted_version", "-Value", "'1.0'"); - ProcessBuilder pb4 = new ProcessBuilder(powershellLocation, "New-ItemProperty", powershellPathParameter, registryPath, "-Name", "eua_accepted_version", "-Value", "'1.2'"); + ProcessBuilder pb2 = new ProcessBuilder(powershellLocation, NEW_ITEM_PROPERTY, powershellPathParameter, registryPath, NAME_PARAM, "accepted_version", VALUE_PARAM, "'2.1'"); + ProcessBuilder pb3 = new ProcessBuilder(powershellLocation, NEW_ITEM_PROPERTY, powershellPathParameter, registryPath, NAME_PARAM, "euacommunity_accepted_version", VALUE_PARAM, "'1.0'"); + ProcessBuilder pb4 = new ProcessBuilder(powershellLocation, NEW_ITEM_PROPERTY, powershellPathParameter, registryPath, NAME_PARAM, "eua_accepted_version", VALUE_PARAM, "'1.2'"); try { Process p1 = pb1.start(); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java index 1a8bd9a9..68c46405 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/FlatWelcomeFrame.java @@ -46,7 +46,6 @@ import java.util.logging.Logger; import static com.intellij.remoterobot.search.locators.Locators.byXpath; -import static com.redhat.devtools.intellij.commonuitest.utils.screenshot.ScreenshotUtils.takeScreenshot; /** * Welcome to IntelliJ IDEA dialog fixture @@ -58,6 +57,7 @@ public class FlatWelcomeFrame extends CommonContainerFixture { private static final Logger LOGGER = Logger.getLogger(FlatWelcomeFrame.class.getName()); private static final String PROJECTS_BUTTON = "Projects"; + private static final String TIP_OF_THE_DAY = "Tip of the Day"; private final RemoteRobot remoteRobot; private final IntelliJVersion intelliJVersion; private final int ideaVersion; @@ -170,11 +170,11 @@ public TipDialog openTipDialog() { if (ideaVersion <= 20202) { clickOnLink("Get Help"); HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5)); - heavyWeightWindowFixture.findText("Tip of the Day").click(); + heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click(); } else if (ideaVersion <= 20203) { actionLink("Help").click(); HeavyWeightWindowFixture heavyWeightWindowFixture = find(HeavyWeightWindowFixture.class, Duration.ofSeconds(5)); - heavyWeightWindowFixture.findText("Tip of the Day").click(); + heavyWeightWindowFixture.findText(TIP_OF_THE_DAY).click(); } else if (ideaVersion <= 20212) { JListFixture jListFixture = remoteRobot.find(JListFixture.class, byXpath(XPathDefinitions.JBLIST)); jListFixture.findText("Learn IntelliJ IDEA").click(); @@ -184,7 +184,7 @@ public TipDialog openTipDialog() { JTreeFixture jTreeFixture = remoteRobot.find(JTreeFixture.class, byXpath(XPathDefinitions.TREE)); jTreeFixture.findText("Learn IntelliJ IDEA").click(); FlatWelcomeFrame flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class); - flatWelcomeFrame.findText("Tip of the Day").click(); + flatWelcomeFrame.findText(TIP_OF_THE_DAY).click(); } return remoteRobot.find(TipDialog.class, Duration.ofSeconds(10)); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java index 72c476c3..be015ce6 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/navigation/SearchEverywherePopup.java @@ -83,7 +83,7 @@ private List getSearchResults() { List searchResults = jLists(JListFixture.Companion.byType()); if (searchResults.isEmpty()) { return new ArrayList<>(); - }; + } JListFixture searchResultsList = searchResults.get(0); return searchResultsList.findAllText(); } diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java index 50810106..a073399a 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/dialogs/project/pages/NewProjectFirstPage.java @@ -65,6 +65,7 @@ public void selectNewProjectType(String projectType) { * * @param projectName project name */ + @Override public void setProjectName(String projectName) { find(JTextFieldFixture.class, byXpath("//div[@class='JBTextField']")).setText(projectName); } @@ -104,7 +105,7 @@ public void setProjectSdkIfAvailable(String targetSdkName) { projectJdkComboBox.click(); boolean popupOpenedPermanently = false; try { - waitFor(Duration.ofSeconds(10), Duration.ofMillis(250), "HeavyWeightWindow still visible.", () -> noHeavyWeightWindowVisible()); + waitFor(Duration.ofSeconds(10), Duration.ofMillis(250), "HeavyWeightWindow still visible.", this::noHeavyWeightWindowVisible); } catch (WaitForConditionTimeoutException e) { popupOpenedPermanently = true; } @@ -145,6 +146,6 @@ private kotlin.Pair didProjectSdkListLoadAllIte } private boolean noHeavyWeightWindowVisible() { - return remoteRobot.findAll(HeavyWeightWindowFixture.class).size() == 0; + return remoteRobot.findAll(HeavyWeightWindowFixture.class).isEmpty(); } } \ No newline at end of file diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java index 3573d166..94fa3a81 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/AbstractToolWinPane.java @@ -35,7 +35,7 @@ public abstract class AbstractToolWinPane extends CommonContainerFixture { private final RemoteRobot remoteRobot; - public AbstractToolWinPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { + protected AbstractToolWinPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); this.remoteRobot = remoteRobot; } @@ -106,7 +106,7 @@ public JButtonFixture stripeButton(String label, boolean isPaneOpened) { return button(byXpath("//div[@text='" + label + "']"), Duration.ofSeconds(2)); } - private T togglePane(String label, Class fixtureClass, boolean openPane) { + protected T togglePane(String label, Class fixtureClass, boolean openPane) { if ((!isPaneOpened(fixtureClass) && openPane)) { clickOnStripeButton(label, false); return find(fixtureClass, Duration.ofSeconds(10)); diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ToolWindowsPane.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ToolWindowsPane.java index 79e14993..fe614ad8 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ToolWindowsPane.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/fixtures/mainidewindow/toolwindowspane/ToolWindowsPane.java @@ -13,10 +13,8 @@ import com.intellij.remoterobot.RemoteRobot; import com.intellij.remoterobot.data.RemoteComponent; import com.intellij.remoterobot.fixtures.DefaultXpath; -import com.intellij.remoterobot.fixtures.Fixture; import com.intellij.remoterobot.fixtures.FixtureName; import com.intellij.remoterobot.fixtures.JButtonFixture; -import com.intellij.remoterobot.utils.WaitForConditionTimeoutException; import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.buildtoolpane.GradleBuildToolPane; import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.buildtoolpane.MavenBuildToolPane; import com.redhat.devtools.intellij.commonuitest.utils.constants.ButtonLabels; @@ -26,7 +24,6 @@ import java.time.Duration; import static com.intellij.remoterobot.search.locators.Locators.byXpath; -import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor; /** * Tool Windows Pane fixture @@ -36,11 +33,8 @@ @DefaultXpath(by = "ToolWindowsPane type", xpath = XPathDefinitions.TOOL_WINDOWS_PANE) @FixtureName(name = "Tool Windows Pane") public class ToolWindowsPane extends AbstractToolWinPane { - private final RemoteRobot remoteRobot; - public ToolWindowsPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { super(remoteRobot, remoteComponent); - this.remoteRobot = remoteRobot; } /** @@ -48,6 +42,7 @@ public ToolWindowsPane(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponen * * @return the Project Explorer fixture */ + @Override public ProjectExplorer openProjectExplorer() { return togglePane(ButtonLabels.PROJECT_STRIPE_BUTTON_LABEL, ProjectExplorer.class, true); } @@ -55,6 +50,7 @@ public ProjectExplorer openProjectExplorer() { /** * Close project explorer */ + @Override public void closeProjectExplorer() { togglePane(ButtonLabels.PROJECT_STRIPE_BUTTON_LABEL, ProjectExplorer.class, false); } @@ -64,6 +60,7 @@ public void closeProjectExplorer() { * * @return the Maven Build Tool Pane fixture */ + @Override public MavenBuildToolPane openMavenBuildToolPane() { return togglePane(ButtonLabels.MAVEN_STRIPE_BUTTON_LABEL, MavenBuildToolPane.class, true); } @@ -71,6 +68,7 @@ public MavenBuildToolPane openMavenBuildToolPane() { /** * Close maven build tool pane */ + @Override public void closeMavenBuildToolPane() { togglePane(ButtonLabels.MAVEN_STRIPE_BUTTON_LABEL, MavenBuildToolPane.class, false); } @@ -80,6 +78,7 @@ public void closeMavenBuildToolPane() { * * @return the Gradle Build Tool Pane fixture */ + @Override public GradleBuildToolPane openGradleBuildToolPane() { return togglePane(ButtonLabels.GRADLE_STRIPE_BUTTON_LABEL, GradleBuildToolPane.class, true); } @@ -87,6 +86,7 @@ public GradleBuildToolPane openGradleBuildToolPane() { /** * Close gradle build tool pane */ + @Override public void closeGradleBuildToolPane() { togglePane(ButtonLabels.GRADLE_STRIPE_BUTTON_LABEL, GradleBuildToolPane.class, false); } @@ -98,6 +98,7 @@ public void closeGradleBuildToolPane() { * @param isPaneOpened true if the pane is already opened * @return fixture for the Stripe button */ + @Override public JButtonFixture stripeButton(String label, boolean isPaneOpened) { if (isPaneOpened) { if (label.equals(ButtonLabels.MAVEN_STRIPE_BUTTON_LABEL) || label.equals(ButtonLabels.GRADLE_STRIPE_BUTTON_LABEL)) { @@ -108,38 +109,4 @@ public JButtonFixture stripeButton(String label, boolean isPaneOpened) { } return button(byXpath(XPathDefinitions.label(label)), Duration.ofSeconds(2)); } - - private T togglePane(String label, Class fixtureClass, boolean openPane) { - if ((!isPaneOpened(fixtureClass) && openPane)) { - clickOnStripeButton(label, false); - return find(fixtureClass, Duration.ofSeconds(10)); - } else if (isPaneOpened(fixtureClass) && !openPane) { - clickOnStripeButton(label, true); - } - return null; - } - - private boolean isPaneOpened(Class fixtureClass) { - ToolWindowsPane toolWindowsPane = remoteRobot.find(ToolWindowsPane.class, Duration.ofSeconds(10)); - try { - toolWindowsPane.find(fixtureClass, Duration.ofSeconds(10)); - return true; - } catch (WaitForConditionTimeoutException e) { - return false; - } - } - - private void clickOnStripeButton(String label, boolean isPaneOpened) { - waitFor(Duration.ofSeconds(30), Duration.ofSeconds(2), "The '" + label + "' stripe button is not available.", () -> isStripeButtonAvailable(label, isPaneOpened)); - remoteRobot.find(ToolWindowsPane.class, Duration.ofSeconds(10)).stripeButton(label, isPaneOpened).click(); - } - - private boolean isStripeButtonAvailable(String label, boolean isPaneOpened) { - try { - remoteRobot.find(ToolWindowsPane.class, Duration.ofSeconds(10)).stripeButton(label, isPaneOpened); - } catch (WaitForConditionTimeoutException e) { - return false; - } - return true; - } } \ No newline at end of file diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/internalerror/IdeInternalErrorUtils.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/internalerror/IdeInternalErrorUtils.java index e8995906..5856cae8 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/internalerror/IdeInternalErrorUtils.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/internalerror/IdeInternalErrorUtils.java @@ -30,6 +30,7 @@ */ public class IdeInternalErrorUtils { protected static final Logger LOGGER = Logger.getLogger(IdeInternalErrorUtils.class.getName()); + private IdeInternalErrorUtils() {} /** * Clear internal IDE errors on Windows diff --git a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/screenshot/ScreenshotUtils.java b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/screenshot/ScreenshotUtils.java index 8aa14d4b..0e8891a5 100644 --- a/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/screenshot/ScreenshotUtils.java +++ b/src/main/java/com/redhat/devtools/intellij/commonuitest/utils/screenshot/ScreenshotUtils.java @@ -53,7 +53,7 @@ public static File takeScreenshot(RemoteRobot remoteRobot, String comment) { Files.createDirectory(Paths.get(SCREENSHOT_LOCATION)); } String screenshotFilename = getTimeNow("yyyy_MM_dd_HH_mm_ss"); - String screenshotComment = comment == null || comment == "" ? "" : "_" + comment; + String screenshotComment = comment == null || comment.equals("") ? "" : "_" + comment; String screenshotPathname = SCREENSHOT_LOCATION + screenshotFilename + screenshotComment + "." + FILETYPE; File screenshotFile = new File(screenshotPathname); ImageIO.write(screenshotBufferedImage, FILETYPE, screenshotFile); diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/LibraryTestBase.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/LibraryTestBase.java index ebeff2e5..fd79f1b6 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/LibraryTestBase.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/LibraryTestBase.java @@ -23,8 +23,6 @@ import java.time.Duration; import java.util.logging.Logger; -import static com.intellij.remoterobot.search.locators.Locators.byXpath; - /** * Base class for all JUnit tests in the IntelliJ common UI test library * diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java index e03f5c90..6f880d50 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/project_manipulation/NewProjectDialogTest.java @@ -54,6 +54,8 @@ public class NewProjectDialogTest extends LibraryTestBase { private static final String PLAIN_JAVA_PROJECT_NAME = "plain_java_project_name_test"; private static final String MORE_SETTINGS_SHOULD_BE_VISIBLE = "The 'More Settings' should be visible."; private static final String MORE_SETTINGS_SHOULD_BE_HIDDEN = "The 'More Settings' should be hidden."; + private static final String ADVANCED_SETTINGS_SHOULD_BE_OPENED_MSG = "The 'Advanced Settings' section should be opened but is not"; + private static final String ADVANCED_SETTINGS_SHOULD_BE_CLOSED_MSG = "The 'Advanced Settings' section should be closed but is not"; private static final String BUT_IS = "but is"; private NewProjectDialogWizard newProjectDialogWizard; @@ -135,22 +137,22 @@ public void closeMoreSettingsTest() { @EnabledIfSystemProperty(named = "uitestlib.idea.version", matches = "2020.|2021.") public void openAdvancedSettingsTest() { newProjectFirstPage.closeAdvanceSettings(); - assertFalse(isAdvancedSettingsOpened(), "The 'Advanced Settings' section should be closed but is not"); + assertFalse(isAdvancedSettingsOpened(), ADVANCED_SETTINGS_SHOULD_BE_CLOSED_MSG); newProjectFirstPage.openAdvanceSettings(); - assertTrue(isAdvancedSettingsOpened(), "The 'Advanced Settings' section should be opened but is not"); + assertTrue(isAdvancedSettingsOpened(), ADVANCED_SETTINGS_SHOULD_BE_OPENED_MSG); newProjectFirstPage.openAdvanceSettings(); - assertTrue(isAdvancedSettingsOpened(), "The 'Advanced Settings' section should be opened but is not"); + assertTrue(isAdvancedSettingsOpened(), ADVANCED_SETTINGS_SHOULD_BE_OPENED_MSG); } @Test @EnabledIfSystemProperty(named = "uitestlib.idea.version", matches = "2020.|2021.") public void closeAdvancedSettingsTest() { newProjectFirstPage.openAdvanceSettings(); - assertTrue(isAdvancedSettingsOpened(), "The 'Advanced Settings' section should be opened but is not"); + assertTrue(isAdvancedSettingsOpened(), ADVANCED_SETTINGS_SHOULD_BE_OPENED_MSG); newProjectFirstPage.closeAdvanceSettings(); - assertFalse(isAdvancedSettingsOpened(), "The 'Advanced Settings' section should be closed but is not"); + assertFalse(isAdvancedSettingsOpened(), ADVANCED_SETTINGS_SHOULD_BE_CLOSED_MSG); newProjectFirstPage.closeAdvanceSettings(); - assertFalse(isAdvancedSettingsOpened(), "The 'Advanced Settings' section should be closed but is not"); + assertFalse(isAdvancedSettingsOpened(), ADVANCED_SETTINGS_SHOULD_BE_CLOSED_MSG); } @Test @@ -370,7 +372,7 @@ public void selectNewProjectTypeTest() { private void navigateToSetProjectNamePage(CreateCloseUtils.NewProjectType newProjectType) { if (UITestRunner.getIdeaVersionInt() >= 20221) { - newProjectFirstPage.setBuildSystem(newProjectType.toString() == "Java" ? "IntelliJ" : newProjectType.toString()); + newProjectFirstPage.setBuildSystem(newProjectType.toString().equals("Java") ? "IntelliJ" : newProjectType.toString()); return; } newProjectFirstPage.selectNewProjectType(newProjectType.toString()); diff --git a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/settings/SettingsDialogTest.java b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/settings/SettingsDialogTest.java index 381eccdc..69d5dd21 100644 --- a/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/settings/SettingsDialogTest.java +++ b/src/test-project/src/test/java/com/redhat/devtools/intellij/commonuitest/fixtures/test/dialogs/settings/SettingsDialogTest.java @@ -21,6 +21,7 @@ import org.junit.jupiter.api.AfterAll; import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.time.Duration; @@ -38,18 +39,27 @@ */ class SettingsDialogTest extends LibraryTestBase { private static FlatWelcomeFrame flatWelcomeFrame; - private static SettingsDialog settingsDialog; + private SettingsDialog settingsDialog = null; + private static final String APPEARANCE_AND_BEHAVIOR = "Appearance & Behavior"; + private static final String NOTIFICATIONS = "Notifications"; @BeforeAll public static void openSettingsDialog() { flatWelcomeFrame = remoteRobot.find(FlatWelcomeFrame.class, Duration.ofSeconds(10)); flatWelcomeFrame.openSettingsDialog(); - settingsDialog = remoteRobot.find(SettingsDialog.class, Duration.ofSeconds(5)); + } @AfterAll public static void closeSettingsDialog() { - settingsDialog.cancel(); + remoteRobot.find(SettingsDialog.class, Duration.ofSeconds(5)).cancel(); + } + + @BeforeEach + public void prepareSettingsDialogFixture() { + if (settingsDialog == null) { + settingsDialog = remoteRobot.find(SettingsDialog.class, Duration.ofSeconds(5)); + } } @AfterEach @@ -64,9 +74,9 @@ public void reopenSettingsDialogIfNeeded() { @Test public void navigateToTest() { - settingsDialog.navigateTo("Appearance & Behavior", "Notifications"); + settingsDialog.navigateTo(APPEARANCE_AND_BEHAVIOR, NOTIFICATIONS); try { - waitFor(Duration.ofSeconds(10), Duration.ofMillis(250), "The 'Notifications' settings page is not available.", () -> isSettingsPageLoaded("Notifications")); + waitFor(Duration.ofSeconds(10), Duration.ofMillis(250), "The 'Notifications' settings page is not available.", () -> isSettingsPageLoaded(NOTIFICATIONS)); } catch (WaitForConditionTimeoutException e) { LOGGER.log(Level.SEVERE, e.getMessage(), e); fail("The 'Settings' dialog should display the 'Notifications' page."); @@ -84,7 +94,7 @@ public void navigateToTest() { @Test public void settingsTreeTest() { JTreeFixture settingsTree = settingsDialog.settingsTree(); - assertTrue(settingsTree.hasText("Appearance & Behavior"), "The Settings tree does not contain the 'Appearance & Behavior' item."); + assertTrue(settingsTree.hasText(APPEARANCE_AND_BEHAVIOR), "The Settings tree does not contain the 'Appearance & Behavior' item."); } @Test @@ -102,7 +112,7 @@ public void okTest() { @Test public void applyTest() { settingsDialog = remoteRobot.find(SettingsDialog.class, Duration.ofSeconds(5)); - settingsDialog.navigateTo("Appearance & Behavior", "Notifications"); + settingsDialog.navigateTo(APPEARANCE_AND_BEHAVIOR, NOTIFICATIONS); JCheckboxFixture balloonNotificationsCheckbox = settingsDialog.checkBox("Display balloon notifications", true); balloonNotificationsCheckbox.setValue(!balloonNotificationsCheckbox.isSelected()); settingsDialog.apply();