Skip to content

Commit

Permalink
GH-282 Allocate dataset test + GH-297 Automated test pipeline run (#316)
Browse files Browse the repository at this point in the history
* Allocate dataset dialog regression test.

Signed-off-by: Uladzislau <[email protected]>

* GH-282 Regression tests fix

Signed-off-by: Uladzislau <[email protected]>

---------

Signed-off-by: Uladzislau <[email protected]>
Co-authored-by: Shyshkou_I <[email protected]>
  • Loading branch information
KUGDev and Shyshkou_I authored Feb 18, 2025
1 parent e3ce988 commit f88c915
Show file tree
Hide file tree
Showing 43 changed files with 1,917 additions and 417 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
24 changes: 12 additions & 12 deletions src/uiTest/kotlin/auxiliary/containers/AllocateDatasetDialog.kt
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,19 @@ open class AllocateDatasetDialog(
* Fills in the parameters for allocating dataset.
*/
fun allocateDataset(
datasetName: String,
datasetOrganization: String,
allocationUnit: String,
primaryAllocation: Int,
secondaryAllocation: Int,
directory: Int,
recordFormat: String,
recordLength: Int,
blockSize: Int,
averageBlockLength: Int = 0
datasetName: String,
datasetOrganization: DatasetOrganization,
allocationUnit: String,
primaryAllocation: Int,
secondaryAllocation: Int,
directory: Int,
recordFormat: String,
recordLength: Int,
blockSize: Int,
averageBlockLength: Int = 0
) {
findAll<JTextFieldFixture>(datasetNameInputLoc)[0].text = datasetName
findAll<ComboBoxFixture>(datasetOrgDropDownLoc)[1].selectItem(datasetOrganization)
findAll<ComboBoxFixture>(datasetOrgDropDownLoc)[1].selectItem(datasetOrganization.value)

val datasetTextParams = findAll<JTextFieldFixture>(inputFieldLoc)
val datasetComboBoxParams = findAll<ComboBoxFixture>(dropdownsLoc)
Expand All @@ -63,7 +63,7 @@ open class AllocateDatasetDialog(
datasetTextParams[2].text = secondaryAllocation.toString()
datasetComboBoxParams[3].selectItem(recordFormat)

if (datasetOrganization == SEQUENTIAL_ORG_FULL) {
if (datasetOrganization == DatasetOrganization.PO_ORG_FULL_ITEM) {
datasetTextParams[3].text = recordLength.toString()
datasetTextParams[4].text = blockSize.toString()
datasetTextParams[5].text = averageBlockLength.toString()
Expand Down
5 changes: 2 additions & 3 deletions src/uiTest/kotlin/auxiliary/utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ import okhttp3.tls.HeldCertificate
import org.junit.jupiter.api.TestInfo
import testutils.MockResponseDispatcher
import workingset.*
import workingset.*
//import workingset.testutils.InjectDispatcher
import java.awt.event.KeyEvent
import java.net.InetAddress
Expand Down Expand Up @@ -742,7 +741,7 @@ fun allocatePDSAndCreateMask(
actionMenu(remoteRobot, NEW_POINT_TEXT).click()
actionMenuItem(remoteRobot, DATASET_POINT_TEXT).click()
allocateDatasetDialog(fixtureStack) {
allocateDataset(datasetName, PO_ORG_FULL, "TRK", 10, 1, directory, "VB", 255, 6120)
allocateDataset(datasetName, DatasetOrganization.PO_ORG_FULL_ITEM, "TRK", 10, 1, directory, "VB", 255, 6120)
clickButton(OK_TEXT)
Thread.sleep(500)
}
Expand Down Expand Up @@ -855,7 +854,7 @@ fun allocateDataSet(
actionMenu(remoteRobot, "New").click()
actionMenuItem(remoteRobot, "Dataset").click()
allocateDatasetDialog(fixtureStack) {
allocateDataset(datasetName, POE_ORG_FULL, "TRK", 10, 1, 1, "VB", 255, 6120)
allocateDataset(datasetName, DatasetOrganization.POE_ORG_FULL_ITEM, "TRK", 10, 1, 1, "VB", 255, 6120)
clickButton(OK_TEXT)
Thread.sleep(3000)
}
Expand Down
2 changes: 1 addition & 1 deletion src/uiTest/kotlin/jes/CancelHoldReleaseJobTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class CancelHoldReleaseJobTest {
setUpTestEnvironment(fixtureStack, closableFixtureCollector, remoteRobot)
createValidConnectionWithMock(testInfo, connectionName, fixtureStack, closableFixtureCollector, remoteRobot)
injectTestInfoForPdsDataset(testInfo.displayName, datasetBody, datasetName)
mapListDatasets[datasetName] = listDS(datasetName, PDS_TYPE, PO_ORG_SHORT)
mapListDatasets[datasetName] = listDS(datasetName, "PDS", "PO")
injectListAllAllocatedDatasetsWithContents(testInfo,datasetName,mapListDatasets)
injectSingleMember(testInfo, datasetName, listMembersInDataset)
utilObject.createWsAndMask(wsName, connectionName, fixtureStack, closableFixtureCollector, remoteRobot,datasetMaskPair)
Expand Down
2 changes: 1 addition & 1 deletion src/uiTest/kotlin/jes/PurgeJobTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class PurgeJobTest {

injectTestInfoForPdsDataset(testInfo.displayName, datasetParams, datasetName)

mapListDatasets[datasetName] = listDS(datasetName, PDS_TYPE, PO_ORG_SHORT)
mapListDatasets[datasetName] = listDS(datasetName, "PDS", "PO")

injectListAllAllocatedDatasetsWithContents(testInfo, datasetName, mapListDatasets)
injectJobList(testInfo, datasetName, listMembersInDataset)
Expand Down
2 changes: 1 addition & 1 deletion src/uiTest/kotlin/jes/SubmitJobTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class SubmitJobTest {
)
injectTestInfoForPdsDataset(testInfo.displayName, datasetParams,datasetName)

mapListDatasets[datasetName] = listDS(datasetName, PDS_TYPE, PO_ORG_SHORT)
mapListDatasets[datasetName] = listDS(datasetName, "PDS", "PO")

injectListAllAllocatedDatasetsWithContents(testInfo,datasetName,mapListDatasets)
injectJobList(testInfo,datasetName,listMembersInDataset)
Expand Down
118 changes: 118 additions & 0 deletions src/uiTest/kotlin/tests/AddConnectionDialogTest.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/*
* Copyright (c) 2024 IBA Group.
*
* This program and the accompanying materials are made available under the terms of the
* Eclipse Public License v2.0 which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-v20.html
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* IBA Group
* Zowe Community
* Uladzislau Kalesnikau
*/

package tests

import io.kotest.core.annotation.Description
import com.intellij.driver.client.Driver
import org.junit.jupiter.api.*
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 filesExplorerPanel: FilesExplorerPanel
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() {
IdeRunManager.prepareRunManager()
.runningIde
.resetTestEnv()
val ideDriver = IdeRunManager.getIdeDriver()
openZoweExplorerPanel(ideDriver)
}

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

@BeforeEach
fun prepareTestEnv() {
IdeRunManager.prepareRunManager()
.runningIde
.resetTestEnv()
ideDriver = IdeRunManager.getIdeDriver()
filesExplorerPanel = FilesExplorerPanel(ideDriver)
addConnectionDialog = AddConnectionDialog(ideDriver)
unsecureConnectionDialog = UnsecureConnectionDialog(ideDriver)
errorCreatingConnectionDialog = ErrorCreatingConnectionDialog(ideDriver)
}

@AfterEach
fun finalizeTestEnv() {
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) {
// 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 f88c915

Please sign in to comment.