Skip to content

Commit 03df6c8

Browse files
committed
2080: fixed UI tests
1 parent 117e67f commit 03df6c8

File tree

5 files changed

+13
-35
lines changed

5 files changed

+13
-35
lines changed

src/test/kotlin/com/magento/idea/magento2plugin/pages/CreateANewModuleDialogFixture.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fun RemoteRobot.createAModuleDialog(function: CreateAModuleDialogFixture.() -> U
1919
}
2020

2121
@FixtureName("CreateAModuleDialog")
22-
@DefaultXpath("CreateAModuleDialog type", "//div[@class='NewModuleDialog']")
22+
@DefaultXpath("CreateAModuleDialog type", "//div[@class='MyDialog']")
2323
class CreateAModuleDialogFixture(
2424
remoteRobot: RemoteRobot,
2525
remoteComponent: RemoteComponent) : CommonContainerFixture(remoteRobot, remoteComponent) {

src/test/kotlin/com/magento/idea/magento2plugin/pages/CreateAPluginDialogFixture.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fun RemoteRobot.createAPluginDialog(function: CreateAPluginDialogFixture.() -> U
1919
}
2020

2121
@FixtureName("CreateAPluginDialog")
22-
@DefaultXpath("CreateAPluginDialog type", "//div[@class='CreateAPluginDialog']")
22+
@DefaultXpath("CreateAPluginDialog type", "//div[@class='MyDialog']")
2323
class CreateAPluginDialogFixture(
2424
remoteRobot: RemoteRobot,
2525
remoteComponent: RemoteComponent) : CommonContainerFixture(remoteRobot, remoteComponent) {
@@ -32,4 +32,4 @@ class CreateAPluginDialogFixture(
3232

3333
val pluginName
3434
get() = find<JTextFieldFixture>(byXpath("FilteredComboBox", "//div[@tooltiptext='Plugin name in di.xml']"))
35-
}
35+
}

src/test/kotlin/com/magento/idea/magento2plugin/pages/DialogFixture.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ class DialogFixture(
3737
fun byTitle(title: String) = byXpath("title $title", "//div[@title='$title' and @class='MyDialog']")
3838

3939
@JvmStatic
40-
fun getJDialog(title: String) = byXpath("title $title", "//div[@title='$title' and @class='JDialog']")
40+
fun getJDialog(title: String) = byXpath("title $title", "//div[@title='$title']")
4141
}
42-
}
42+
}

src/test/kotlin/com/magento/idea/magento2plugin/pages/IdeaFrame.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ class IdeaFrame(remoteRobot: RemoteRobot, remoteComponent: RemoteComponent) :
2929

3030
val projectViewTree
3131
get() = try {
32-
find<ContainerFixture>(byXpath("//div[@class='ProjectViewTree']"))
32+
find<ContainerFixture>(byXpath("//div[@class='MyProjectViewTree']"))
3333
} catch (e: Exception) {
3434
keyboard {
3535
hotKey(VK_ALT, VK_1)
3636
}
37-
find<ContainerFixture>(byXpath("//div[@class='ProjectViewTree']"))
37+
find<ContainerFixture>(byXpath("//div[@class='MyProjectViewTree']"))
3838
}
3939

4040
fun isProjectViewVisible(): Boolean {

src/test/kotlin/com/magento/idea/magento2plugin/steps/SharedSteps.kt

Lines changed: 6 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import com.magento.idea.magento2plugin.pages.*
1717
import java.awt.Point
1818
import java.awt.event.KeyEvent.*
1919
import java.io.File
20-
import java.io.IOException
2120
import java.nio.file.Paths
2221
import java.time.Duration.ofMinutes
2322
import java.util.*
@@ -99,17 +98,19 @@ class SharedSteps(private val remoteRobot: RemoteRobot) {
9998
}
10099

101100
private fun enableMagentoSupport() {
101+
Thread.sleep(7_000)
102+
102103
try {
103104
//closing AI adv popup
104105
val dialog = remoteRobot.find(
105-
DialogFixture::class.java, byXpath("//div[@class='MyDialog']")
106+
DialogFixture::class.java, byXpath("//div[@name='dialog2']")
106107
)
107-
dialog.button("Close").click()
108+
dialog.click()
109+
dialog.keyboard { key(VK_ESCAPE) }
108110
} catch (e: Exception) {
109111
//do nothing
110112
}
111113

112-
113114
remoteRobot.idea {
114115
step("Enable Magento Integration") {
115116
waitFor(ofMinutes(1)) { isDumbMode().not() }
@@ -148,27 +149,4 @@ class SharedSteps(private val remoteRobot: RemoteRobot) {
148149
trustProjectLink.click()
149150
}
150151
}
151-
152-
/**
153-
* Closes the browser by terminating its process based on the operating system.
154-
*/
155-
fun closeBrowser() {
156-
val os = System.getProperty("os.name").lowercase(Locale.getDefault())
157-
158-
try {
159-
if (os.contains("win")) {
160-
// For Windows: Close common browsers like Chrome, Firefox, etc.
161-
Runtime.getRuntime().exec("taskkill /F /IM edge.exe")
162-
} else if (os.contains("mac")) {
163-
// For macOS: Kill browsers using `pkill`
164-
Runtime.getRuntime().exec("killall -9 safari")
165-
} else if (os.contains("nix") || os.contains("nux")) {
166-
// For Linux-based systems: Kill typical browser processes
167-
Runtime.getRuntime().exec("killall -9 firefox")
168-
Runtime.getRuntime().exec("killall -9 chrome")
169-
}
170-
} catch (e: IOException) {
171-
e.printStackTrace()
172-
}
173-
}
174-
}
152+
}

0 commit comments

Comments
 (0)