-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Fixes in UI integration tests + added Getting Started test cases (
#563) * fix: correct xpath for selecting new project Signed-off-by: Richard Kocian <[email protected]> * fix: running integration UI tests with newer version of IntelliJ Signed-off-by: Richard Kocian <[email protected]> * test: added Getting Started test cases Signed-off-by: Richard Kocian <[email protected]> * build: Added dependency on gson (2.9.0) for UI tests Signed-off-by: Richard Kocian <[email protected]> * chore: Fixed copyright 2022 -> 2023 Signed-off-by: Richard Kocian <[email protected]> * chore: Added junit-platform-launcher for correct working with newer versions of IJ Signed-off-by: Richard Kocian <[email protected]> * fix: Find the right GettingStartedView window Signed-off-by: Richard Kocian <[email protected]> * fix: Maximalize GettingStartedView after opening Signed-off-by: Richard Kocian <[email protected]> * Enabled UI itests, using snapshot of common-ui-test-library Signed-off-by: Richard Kocian <[email protected]> * Use IJ Ultimate 2023.2 Signed-off-by: Richard Kocian <[email protected]> * Added encrypted IJ Ultimate activation key Signed-off-by: Richard Kocian <[email protected]> * fix: Use ToolWindowPane instead of ToolWindowsPane Signed-off-by: Richard Kocian <[email protected]> * Remove building common-ui-test-library in build job Signed-off-by: Richard Kocian <[email protected]> * Close Getting Started menu on start Signed-off-by: Richard Kocian <[email protected]> * Wait extend for openshift menu tree item Signed-off-by: Richard Kocian <[email protected]> * Comment unstable test -> TODO Signed-off-by: Richard Kocian <[email protected]> * Change job trigger to pull_request_target Signed-off-by: Richard Kocian <[email protected]> * feat: Added --stacktrace in gradlew command for debug Signed-off-by: Richard Kocian <[email protected]> * fix: New intellij license key Signed-off-by: Richard Kocian <[email protected]> rh-pre-commit.version: 2.2.0 rh-pre-commit.check-secrets: ENABLED * feat: Use newest release of common-ui-test-library Signed-off-by: Richard Kocian <[email protected]> rh-pre-commit.version: 2.2.0 rh-pre-commit.check-secrets: ENABLED --------- Signed-off-by: Richard Kocian <[email protected]> Signed-off-by: Richard Kocián (rkocian) <[email protected]> Co-authored-by: Stephane Bouchet <[email protected]>
- Loading branch information
1 parent
56f5ff6
commit 989eef4
Showing
9 changed files
with
191 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
88 changes: 88 additions & 0 deletions
88
src/it/java/org/jboss/tools/intellij/openshift/test/ui/views/GettingStartedView.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2023 Red Hat, Inc. | ||
* Distributed under license by Red Hat, Inc. All rights reserved. | ||
* This program is made available under the terms of the | ||
* Eclipse Public License v2.0 which accompanies this distribution, | ||
* and is available at http://www.eclipse.org/legal/epl-v20.html | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
******************************************************************************/ | ||
package org.jboss.tools.intellij.openshift.test.ui.views; | ||
|
||
import com.intellij.remoterobot.RemoteRobot; | ||
import com.intellij.remoterobot.data.RemoteComponent; | ||
import com.intellij.remoterobot.fixtures.*; | ||
import com.intellij.remoterobot.search.locators.Locator; | ||
import com.intellij.remoterobot.utils.Keyboard; | ||
import com.intellij.remoterobot.utils.WaitForConditionTimeoutException; | ||
import com.redhat.devtools.intellij.commonuitest.fixtures.mainidewindow.toolwindowspane.ToolWindowPane; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.awt.event.KeyEvent; | ||
import java.time.Duration; | ||
|
||
import static com.intellij.remoterobot.search.locators.Locators.byXpath; | ||
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor; | ||
|
||
/** | ||
* | ||
* @author Richard Kocian | ||
* | ||
*/ | ||
@DefaultXpath(by = "Getting Started type", xpath = "//div[@class='IdeFrameImpl']") | ||
@FixtureName(name = "GettingStarted View") | ||
public class GettingStartedView extends ContainerFixture { | ||
|
||
private final Locator editorPaneLocator = byXpath("//div[@class='JEditorPane']"); | ||
private final Locator backToMainViewLocator = byXpath("//div[@accessiblename='<< Getting Started with OpenShift Toolkit' and @class='JLabel' and @text='<< Getting Started with OpenShift Toolkit']"); | ||
public GettingStartedView(@NotNull RemoteRobot remoteRobot, @NotNull RemoteComponent remoteComponent) { | ||
super(remoteRobot, remoteComponent); | ||
} | ||
|
||
public void openView() { | ||
final ToolWindowPane toolWindowPane = find(ToolWindowPane.class); | ||
waitFor(Duration.ofSeconds(10), Duration.ofSeconds(1), "The 'Getting Started' stripe button is not available.", () -> isStripeButtonAvailable(toolWindowPane, "OpenShift")); | ||
toolWindowPane.stripeButton("Getting Started", false).click(); | ||
} | ||
|
||
public void closeView() { | ||
final ToolWindowPane toolWindowPane = find(ToolWindowPane.class); | ||
toolWindowPane.button(byXpath("//div[@tooltiptext='Getting Started']"), Duration.ofSeconds(2)).click(); | ||
} | ||
|
||
public void waitForTreeItem(String itemText, int duration, int interval) { | ||
waitFor(Duration.ofSeconds(duration), | ||
Duration.ofSeconds(interval), | ||
"The " + itemText + " project is still not available.", | ||
() -> getGettingStartedTree().hasText(itemText)); | ||
} | ||
|
||
public JTreeFixture getGettingStartedTree(){ | ||
return find(JTreeFixture.class, byXpath("//div[@class='Tree']"), Duration.ofSeconds(30)); | ||
} | ||
|
||
private boolean isStripeButtonAvailable(ToolWindowPane toolWindowPane, String label) { | ||
try { | ||
toolWindowPane.stripeButton(label, false); | ||
} catch (WaitForConditionTimeoutException e) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
|
||
public ComponentFixture findEditorPaneFixture() { | ||
return getRemoteRobot().findAll(GettingStartedView.class, editorPaneLocator).get(0); | ||
} | ||
|
||
public ComponentFixture findBackToMainButton() { | ||
return getRemoteRobot().find(GettingStartedView.class, backToMainViewLocator); | ||
} | ||
|
||
public void maximalizeToolWindow(RemoteRobot robot) { | ||
Keyboard keyboard = new Keyboard(robot); | ||
// Other OS may have different keyboard shortcut for maximizing | ||
keyboard.hotKey(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_QUOTE); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters