Skip to content

Commit b58a489

Browse files
olkorniiadietish
authored andcommitted
Reworked/refactored CreateResourceByEditTest.
Signed-off-by: Oleksii Korniienko <[email protected]>
1 parent 257227b commit b58a489

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Diff for: src/it/java/org/jboss/tools/intellij/kubernetes/tests/CreateResourceByEditTest.java

+7-5
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,14 @@
2020
import org.jboss.tools.intellij.kubernetes.fixtures.menus.ActionToolbarMenu;
2121
import org.jboss.tools.intellij.kubernetes.fixtures.menus.RightClickMenu;
2222

23-
import java.awt.event.KeyEvent;
2423
import java.time.Duration;
2524
import java.util.List;
2625

2726
import static com.intellij.remoterobot.search.locators.Locators.byXpath;
2827
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
2928

29+
import static org.junit.jupiter.api.Assertions.assertTrue;
30+
3031
/**
3132
3233
*/
@@ -70,22 +71,23 @@ public static void deleteResource(RemoteRobot robot, ComponentFixture kubernetes
7071
}
7172

7273
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);
7775

7876
ComponentFixture textFixture = editorSplitter.getEditorTextFixture();
7977
List<RemoteText> remoteText = textFixture.findAllText();
8078

8179
int nameId = 0;
80+
boolean nameFound = false;
8281
for (RemoteText actual_remote_text : remoteText){
8382
if ("name".equals(actual_remote_text.getText())){
83+
nameFound = true;
8484
break;
8585
}
8686
nameId++;
8787
}
8888

89+
assertTrue(nameFound, "Resource name not found.");
90+
8991
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 ":"
9092

9193
return namePlace;

0 commit comments

Comments
 (0)