Skip to content

Commit 51af5a8

Browse files
committed
Add workaround to handle Firefox overlay during tests
This change introduces a step to switch back to PhpStorm IDE if the Firefox overlay is detected during test execution. It uses a JavaScript snippet with Robot actions to simulate the ALT+TAB keypress sequence. This ensures seamless continuation of test cases in multi-window environments.
1 parent a4f65eb commit 51af5a8

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/test/kotlin/com/magento/idea/magento2plugin/actions/content/MarkDirectoryAsMagentoRootTest.kt

+18
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,24 @@ class MarkDirectoryAsMagentoRootTest {
7474
startTrialFree.click()
7575
val dialog = find<DialogFixture>(byXpath("//div[@class='MyDialog']"))
7676
dialog.button("Close").click();
77+
78+
step("Switch back to PhpStorm IDE window if Firefox overlay detected") {
79+
waitFor(ofMinutes(2)) {
80+
remoteRobot.callJs(
81+
"""
82+
const robot = java.awt.Robot();
83+
const activeWindowName = java.awt.Frame.getFrames().find(frame => frame.isActive()).getName();
84+
if (activeWindowName.contains("Firefox")) {
85+
robot.keyPress(java.awt.event.KeyEvent.VK_ALT);
86+
robot.keyPress(java.awt.event.KeyEvent.VK_TAB);
87+
robot.keyRelease(java.awt.event.KeyEvent.VK_TAB);
88+
robot.keyRelease(java.awt.event.KeyEvent.VK_ALT);
89+
}
90+
true
91+
""".trimIndent()
92+
)
93+
}
94+
}
7795
// end temporary workaround
7896

7997
welcomeFrame {

0 commit comments

Comments
 (0)