|
20 | 20 | import org.jboss.tools.intellij.kubernetes.fixtures.menus.ActionToolbarMenu;
|
21 | 21 | import org.jboss.tools.intellij.kubernetes.fixtures.menus.RightClickMenu;
|
22 | 22 |
|
23 |
| -import java.awt.event.KeyEvent; |
24 | 23 | import java.time.Duration;
|
25 | 24 | import java.util.List;
|
26 | 25 |
|
27 | 26 | import static com.intellij.remoterobot.search.locators.Locators.byXpath;
|
28 | 27 | import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
|
29 | 28 |
|
| 29 | +import static org.junit.jupiter.api.Assertions.assertTrue; |
| 30 | + |
30 | 31 | /**
|
31 | 32 |
|
32 | 33 | */
|
@@ -70,22 +71,23 @@ public static void deleteResource(RemoteRobot robot, ComponentFixture kubernetes
|
70 | 71 | }
|
71 | 72 |
|
72 | 73 | private static RemoteText findResourceNamePosition(RemoteRobot robot, EditorsSplittersFixture editorSplitter, Keyboard myKeyboard){
|
73 |
| - myKeyboard.hotKey(KeyEvent.VK_CONTROL, KeyEvent.VK_F); |
74 |
| - robot.find(ComponentFixture.class, byXpath("//div[@class='SearchTextArea']")).click(); |
75 |
| - myKeyboard.enterText(" name:"); |
76 |
| - |
| 74 | + scrollToVisible(" name:", robot); |
77 | 75 |
|
78 | 76 | ComponentFixture textFixture = editorSplitter.getEditorTextFixture();
|
79 | 77 | List<RemoteText> remoteText = textFixture.findAllText();
|
80 | 78 |
|
81 | 79 | int nameId = 0;
|
| 80 | + boolean nameFound = false; |
82 | 81 | for (RemoteText actual_remote_text : remoteText){
|
83 | 82 | if ("name".equals(actual_remote_text.getText())){
|
| 83 | + nameFound = true; |
84 | 84 | break;
|
85 | 85 | }
|
86 | 86 | nameId++;
|
87 | 87 | }
|
88 | 88 |
|
| 89 | + assertTrue(nameFound, "Resource name not found."); |
| 90 | + |
89 | 91 | RemoteText namePlace = remoteText.get(nameId+3); // +1 because we need the next one, +1 because between every 2 real elements is space, +1 because here is the ":"
|
90 | 92 |
|
91 | 93 | return namePlace;
|
|
0 commit comments