Skip to content

Commit 6f58694

Browse files
committed
ui debug 4
1 parent 4ea4578 commit 6f58694

1 file changed

Lines changed: 45 additions & 14 deletions

File tree

src/uiTest/kotlin/com/joetr/modulemaker/ModuleMakerUiTest.kt

Lines changed: 45 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -70,28 +70,59 @@ class ModuleMakerUiTest {
7070
}
7171
}
7272

73-
step("Open Module Maker via Find Action") {
74-
find<ComponentFixture>(
75-
byXpath("//div[@class='IdeFrameImpl']"),
76-
Duration.ofSeconds(10)
77-
).click()
73+
step("Wait for IDE to settle after loading") {
74+
// On CI the IDE may still be indexing or initializing after the frame appears.
75+
// Give it time before sending hotkeys.
76+
Thread.sleep(10_000)
77+
// Dismiss any dialogs that appeared during loading
78+
dismissBlockingDialogs()
79+
Thread.sleep(2_000)
80+
}
7881

82+
step("Open Module Maker via Find Action") {
7983
val isMac = System.getProperty("os.name").contains("Mac", ignoreCase = true)
80-
keyboard {
81-
if (isMac) {
82-
hotKey(KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_A)
84+
85+
// Retry the Find Action flow — on CI the first attempt may fail
86+
// if the IDE hasn't fully initialized its action system.
87+
waitFor(duration = Duration.ofSeconds(60), interval = Duration.ofSeconds(5)) {
88+
// Click the IDE frame to ensure it has focus
89+
find<ComponentFixture>(
90+
byXpath("//div[@class='IdeFrameImpl']"),
91+
Duration.ofSeconds(10)
92+
).click()
93+
Thread.sleep(500)
94+
95+
keyboard {
96+
if (isMac) {
97+
hotKey(KeyEvent.VK_META, KeyEvent.VK_SHIFT, KeyEvent.VK_A)
98+
} else {
99+
hotKey(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_A)
100+
}
101+
}
102+
Thread.sleep(2_000)
103+
104+
// Check if Find Action popup appeared
105+
val searchField = findAll<ComponentFixture>(
106+
byXpath("//div[@class='SearchEverywhereUI']")
107+
)
108+
if (searchField.isEmpty()) {
109+
println("Find Action popup not found, retrying...")
110+
// Press Escape to clean up any partial state
111+
keyboard { hotKey(KeyEvent.VK_ESCAPE) }
112+
Thread.sleep(1_000)
113+
false
83114
} else {
84-
hotKey(KeyEvent.VK_CONTROL, KeyEvent.VK_SHIFT, KeyEvent.VK_A)
115+
println("Find Action popup appeared")
116+
keyboard { enterText("Module Maker") }
117+
Thread.sleep(1_000)
118+
keyboard { hotKey(KeyEvent.VK_ENTER) }
119+
true
85120
}
86121
}
87-
Thread.sleep(1_000)
88-
keyboard { enterText("Module Maker") }
89-
Thread.sleep(500)
90-
keyboard { hotKey(KeyEvent.VK_ENTER) }
91122
}
92123

93124
step("Verify Module Maker dialog opened") {
94-
waitFor(duration = Duration.ofSeconds(15)) {
125+
waitFor(duration = Duration.ofSeconds(30)) {
95126
findAll<ComponentFixture>(
96127
byXpath("//div[@title='Module Maker']")
97128
).isNotEmpty()

0 commit comments

Comments
 (0)