Skip to content

Commit

Permalink
Reworked/refactored CreateResourceByEditTest
Browse files Browse the repository at this point in the history
Signed-off-by: Oleksii Korniienko <[email protected]>
  • Loading branch information
olkornii committed May 9, 2024
1 parent 387aa2a commit 9e335a9
Showing 1 changed file with 7 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
import org.jboss.tools.intellij.kubernetes.fixtures.menus.ActionToolbarMenu;
import org.jboss.tools.intellij.kubernetes.fixtures.menus.RightClickMenu;

import java.awt.event.KeyEvent;
import java.time.Duration;
import java.util.List;


import static com.intellij.remoterobot.search.locators.Locators.byXpath;
import static com.intellij.remoterobot.utils.RepeatUtilsKt.waitFor;
import static org.junit.jupiter.api.Assertions.assertTrue;

/**
* @author [email protected]
Expand Down Expand Up @@ -70,36 +71,24 @@ public static void deleteResource(RemoteRobot robot, ComponentFixture kubernetes
}

private static RemoteText findResourceNamePosition(RemoteRobot robot, EditorsSplittersFixture editorSplitter, Keyboard myKeyboard){
myKeyboard.hotKey(KeyEvent.VK_CONTROL, KeyEvent.VK_F);
robot.find(ComponentFixture.class, byXpath("//div[@class='SearchTextArea']")).click();
myKeyboard.enterText(" name:");

scrollToVisible(" name:", robot);

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

System.out.println("==================================================================================");

for (RemoteText actual_remote_text : remoteText) {
System.out.println(actual_remote_text.getText());
}

System.out.println("==================================================================================");

int nameId = 0;
boolean nameFound = false;
for (RemoteText actual_remote_text : remoteText){
System.out.println(actual_remote_text.getText());
if ("name".equals(actual_remote_text.getText())){
nameFound = true;
break;
}
nameId++;
}

System.out.println("==================================================================================");

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

return namePlace;
return 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 ":"
}

private static boolean acceptDeleteDialog(RemoteRobot robot){
Expand Down

0 comments on commit 9e335a9

Please sign in to comment.