Skip to content

Commit

Permalink
GH-282 Regression tests fix
Browse files Browse the repository at this point in the history
Signed-off-by: Uladzislau <[email protected]>
  • Loading branch information
KUGDev committed Feb 17, 2025
1 parent b73c798 commit 01c4fbd
Show file tree
Hide file tree
Showing 34 changed files with 1,359 additions and 717 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
./gradlew uiTests
reportName: ui-test-fails-report-linux

- os: macOS-latest
- os: macos-latest
prepareEnv: echo "No preparations needed for MacOS"
runTests: ./gradlew uiTests
reportName: ui-test-fails-report-mac
Expand All @@ -52,11 +52,6 @@ jobs:
distribution: zulu
java-version: 21

- name: Setup FFmpeg
uses: FedericoCarboni/[email protected]
with:
github-token: ${{ github.server_url == 'https://github.com' && github.token || '' }}

- name: Prepare test env
run: ${{ matrix.prepareEnv }}

Expand Down
4 changes: 2 additions & 2 deletions .idea/copyright/ijmp.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 24 additions & 0 deletions .run/Run UI regression tests.run.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Run UI regression tests" type="GradleRunConfiguration" factoryName="Gradle">
<ExternalSystemSettings>
<option name="executionName" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="externalSystemIdString" value="GRADLE" />
<option name="scriptParameters" value="" />
<option name="taskDescriptions">
<list />
</option>
<option name="taskNames">
<list>
<option value=":uiTests" />
</list>
</option>
<option name="vmOptions" />
</ExternalSystemSettings>
<ExternalSystemDebugServerProcess>false</ExternalSystemDebugServerProcess>
<ExternalSystemReattachDebugProcess>true</ExternalSystemReattachDebugProcess>
<DebugAllEnabled>false</DebugAllEnabled>
<RunAsTest>true</RunAsTest>
<method v="2" />
</configuration>
</component>
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,7 @@ the [contribution guide](CONTRIBUTING.md).
If you have any questions, related to the project development, further plans or something else, you can reach as out by
some of the communication chanels:

* [For Mainframe Slack channel in IBA workspace](https://iba-mainframe-tools.slack.com/archives/C01V4MZL9DH)
* [Zowe Explorer IntelliJ team Slack channel in Open Mainframe Project workspace](https://openmainframeproject.slack.com/archives/C020BGPSU0M)
* [For Mainframe GitHub (create or review issues)](https://github.com/for-mainframe/For-Mainframe/issues)
* [Zowe Explorer plug-in for IntelliJ IDEA GitHub (create or review issues)](https://github.com/zowe/zowe-explorer-intellij/issues)
* Email to: <a href="mailto:[email protected]">Uladzislau Kalesnikau (Team Lead of the Zowe Explorer IntelliJ squad)</a>
* Email to: <a href="mailto:[email protected]">Alex Burak (Product Owner)</a>
Expand Down
50 changes: 5 additions & 45 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
* Contributors:
* IBA Group
* Zowe Community
* Uladzislau Kalesnikau
*/

import org.jetbrains.changelog.Changelog
import org.jetbrains.intellij.platform.gradle.TestFrameworkType
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.Duration
import java.time.LocalDate
import java.time.ZoneId
import java.time.format.DateTimeFormatter
Expand Down Expand Up @@ -331,6 +333,7 @@ tasks {
// https://github.com/JetBrains/intellij-community/blob/master/platform/remote-driver/README.md
val uiTests by intellijPlatformTesting.testIdeUi.registering {
task {
timeout.set(Duration.ofMinutes(60))
enabled = gradle.startParameter.taskNames.any { it.contains("uiTests") } && descriptor.since >= "242"
archiveFile.set(tasks.buildPlugin.flatMap { it.archiveFile })
testClassesDirs = sourceSets["uiTest"].output.classesDirs
Expand All @@ -347,18 +350,11 @@ val uiTests by intellijPlatformTesting.testIdeUi.registering {
"-Xms512m",
"-Dide.test.version=${descriptor.sdkVersion}",
"-Dplugin.path=${tasks.buildPlugin.flatMap { it.archiveFile }.get().asFile.absolutePath}",
"-Dui.tests.mock.project.path=src/uiTest/resources/mock_project",
"-Dui.test.mock.project.path=src/uiTest/resources/mock_project",
"-Didea.trust.all.projects=true",
"-Dide.show.tips.on.startup.default.value=false",
"-Didea.log.config.properties.file=src/uiTest/resources/log.properties",
"-Didea.log.path=src/uiTest/resources/mock_project",
// TODO: delete
"-DideLaunchFolder=ide_for_launch",
"-DremoteRobotUrl=http://127.0.0.1",
"-DideaBuildVersionForTest=ideaIC-242.20224.91",
"-DrobotServerForTest=robot-server-plugin-0.11.23",
"-Didea.trust.all.projects=true",
"-Dide.show.tips.on.startup.default.value=false",
"-Dkotest.framework.classpath.scanning.autoscan.disable=true",
)
}
Expand All @@ -373,12 +369,9 @@ val uiTests by intellijPlatformTesting.testIdeUi.registering {
}

dependencies {
// testImplementation(libs.junit.platform.launcher)
// testImplementation(libs.junit.platform.suite)
// testImplementation(libs.junit.jupiter)
// testImplementation(libs.junit.jupiter.engine)
testImplementation(libs.junit.jupiter.api)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.okhttp3.logging.interceptor)
testImplementation(libs.okhttp3.mockwebserver)
testImplementation(libs.okhttp3.okhttp.tls)
// TODO: revise and delete old unnecessary deps
Expand All @@ -387,36 +380,3 @@ val uiTests by intellijPlatformTesting.testIdeUi.registering {
testImplementation("com.intellij.remoterobot:remote-fixtures:0.11.23")
}
}

// TODO: fix
///**
// * Runs the first UI test, which agrees to the license agreement
// */
//val firstTimeUiTest = task<Test>("firstTimeUiTest") {
// description = "Gets rid of license agreement, etc."
// group = "verification"
// testClassesDirs = sourceSets["uiTest"].output.classesDirs
// classpath = sourceSets["uiTest"].runtimeClasspath
// useJUnitPlatform {
// includeTags("FirstTime")
// }
// testLogging {
// events("passed", "skipped", "failed")
// }
//}
//
///**
// * Runs the smoke ui test
// */
//val smokeUiTest = task<Test>("smokeUiTest") {
// description = "Gets rid of license agreement, etc."
// group = "verification"
// testClassesDirs = sourceSets["uiTest"].output.classesDirs
// classpath = sourceSets["uiTest"].runtimeClasspath
// useJUnitPlatform {
// includeTags("SmokeTest")
// }
// testLogging {
// events("passed", "skipped", "failed")
// }
//}
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import javax.swing.JComponent
* Class which represents TSO console creation action
*/
class TsoConsoleCreateAction : AnAction() {
private val presentationText = "Zowe TSO Console"
private val presentationText = "TSO Console"

override fun getActionUpdateThread(): ActionUpdateThread {
return ActionUpdateThread.EDT
Expand Down
109 changes: 57 additions & 52 deletions src/uiTest/kotlin/tests/AddConnectionDialogTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,52 +10,52 @@
* Contributors:
* IBA Group
* Zowe Community
* Uladzislau Kalesnikau
*/

package tests

import auxiliary.mockServer
import auxiliary.startMockServer
import io.kotest.core.annotation.Description

import com.intellij.driver.client.Driver
import org.junit.jupiter.api.*
import tests.utils.ActionMenuPoints
import tests.utils.FilesExplorerPanel
import tests.utils.dialogs.AddConnectionDialog
import tests.utils.notification.UnsecureConnectionDialog
import testutils.*

import workingset.testutils.injectTestInfo
import workingset.testutils.injectTestInfoRestTopology
import tests.utils.*
import tests.utils.uidefinitions.dialogs.AddConnectionDialog
import tests.utils.uidefinitions.dialogs.UnsecureConnectionDialog
import tests.utils.uidefinitions.FilesExplorerPanel
import tests.utils.uidefinitions.dialogs.ErrorCreatingConnectionDialog

@Disabled("This testsuite needs to be reworked")
@Description("Tests for interaction and filling the connection creation dialog")
class AddConnectionDialogTest {
private lateinit var ideDriver: Driver
private lateinit var filesExplorerPanel: FilesExplorerPanel
lateinit var addConnectionDialog: AddConnectionDialog
private lateinit var addConnectionDialog: AddConnectionDialog
private lateinit var unsecureConnectionDialog: UnsecureConnectionDialog
private lateinit var errorCreatingConnectionDialog: ErrorCreatingConnectionDialog

companion object {
private lateinit var ideDriver: Driver

@JvmStatic
@BeforeAll
fun prepareBeforeAll() {
startMockServer()
IdeRunManager.prepareRunManager()
.runningIde
.resetTestEnv()
val ideDriver = IdeRunManager.getIdeDriver()
callRightSidePanel(ideDriver)
openZoweExplorerPanel(ideDriver)
}

@JvmStatic
@AfterAll
fun afterAll() {
mockServer.shutdown()
IdeRunManager.prepareRunManager()
.runningIde
.resetTestEnv()
deleteConfigEntities(ideDriver, "Connections")
MockWebServerManager.removeAllEndpoints()
}
}


@BeforeEach
fun prepareTestEnv() {
IdeRunManager.prepareRunManager()
Expand All @@ -65,49 +65,54 @@ class AddConnectionDialogTest {
filesExplorerPanel = FilesExplorerPanel(ideDriver)
addConnectionDialog = AddConnectionDialog(ideDriver)
unsecureConnectionDialog = UnsecureConnectionDialog(ideDriver)
errorCreatingConnectionDialog = ErrorCreatingConnectionDialog(ideDriver)
}

@AfterEach
fun finalizeTestEnv() {
IdeRunManager.prepareRunManager()
.runningIde
.resetTestEnv()
}

@Test
@Tag("New")
fun fieldsPresenceTest() {
filesExplorerPanel.openExplorerToolWindow(ActionMenuPoints.CONNECTION)



addConnectionDialog.passwordInput.click()
assert(addConnectionDialog.connectionDialogPanel.isVisible())
assert(addConnectionDialog.connectionNameLabel.isVisible())
assert(addConnectionDialog.connectionUrlLabel.isVisible())
assert(addConnectionDialog.connectionUsernameLabel.isVisible())
assert(addConnectionDialog.passwordLabel.isVisible())
assert(addConnectionDialog.passwordInput.isVisible())
assert(addConnectionDialog.questionMark.isVisible())
assert(addConnectionDialog.connectionDialogCancelButton.isVisible())
MockWebServerManager.removeAllEndpoints()
}

/**
* @see
* <a href="https://github.com/zowe/zowe-explorer-intellij/wiki/Manual-and-automated-test-cases-consistency#add-invalid-connection">
* Regression: Add invalid connection
* </a>
*/
@Disabled("This testcase needs to be reworked")
@Test
@Tag("New")
fun createInvalidConnectionTest(testInfo: TestInfo) {
injectTestInfo(testInfo)
injectTestInfoRestTopology(testInfo)

filesExplorerPanel.openExplorerToolWindow(ActionMenuPoints.CONNECTION)

addConnectionDialog.passwordInput.text = "passwordInput"
addConnectionDialog.connectionNameInput.text = "nameInput"
addConnectionDialog.urlInput.text = "https://${mockServer.hostName}:${mockServer.port}"
addConnectionDialog.userNameInput.text = "userNameInput"
addConnectionDialog.acceptSelfSignedCheckbox.click()
unsecureConnectionDialog.preceedButton.click()

addConnectionDialog.connectionDialogOkButton.click()
unsecureConnectionDialog.preceedButton.click()
// TODO: finalize the check (the error dialog should appear)
// val mockServer = MockWebServerManager.prepareMockServer()
//
// MockWebServerManager.injectEndpoint(
// "${testInfo.displayName}_info",
// jsonMock = "infoResponse",
// endpointResolver = { it?.requestLine?.contains("zosmf/info") ?: false }
// )
// MockWebServerManager.injectEndpoint(
// "${testInfo.displayName}_resttopology",
// jsonMock = "infoResponse",
// endpointResolver = { it?.requestLine?.contains("zosmf/resttopology/systems") ?: false }
// )
//
// filesExplorerPanel.createInvalidConnection(ideDriver, connectionName)
// addConnectionDialog
// .fillDialog(
// connectionName = "nameInput",
// connectionUrl = "https://${mockServer.hostName}:${mockServer.port}",
// username = "userNameInput",
// password = "passwordInput",
// isAcceptSelfSigned = true
// )
//
// unsecureConnectionDialog.proceedButton.click()
// addConnectionDialog.okButton.click()
// unsecureConnectionDialog.proceedButton.click()

// assert(errorCreatingConnectionDialog.dialogComponent.isVisible())
//
// errorCreatingConnectionDialog.noButton.click()
}
}
Loading

0 comments on commit 01c4fbd

Please sign in to comment.