[gui-test] create Kotlin MP project: update test with 1.2.60 changes

This commit is contained in:
Viktoria.Shirunova
2018-07-17 13:12:19 +03:00
parent f0532adc6f
commit 8626fef0bd
2 changed files with 79 additions and 72 deletions

View File

@@ -12,71 +12,19 @@ import org.junit.Test
class CreateKotlinMPProjectGuiTest : KotlinGuiTestCase() {
@Test
@JvmName("kotlin_mpp_common_root")
@JvmName("kotlin_mpp_hierarchical")
fun createKotlinMppProjectCommonRoot() {
val extraTimeOut = 4000L
val projectName = testMethod.methodName
val kotlinVersion = KotlinTestProperties.kotlin_artifact_version
val setOfMPPModules = MPPModules.mppFullSet()
val module_common = "$projectName-common"
val module_jvm = "$projectName-jvm"
val module_js = "$projectName-js"
createKotlinMPProject(
projectPath = projectFolder,
moduleName = projectName,
mppProjectStructure = NewProjectDialogModel.MppProjectStructure.RootCommonModule,
setOfMPPModules = MPPModules.mppFullSet()
)
waitAMoment(extraTimeOut)
editSettingsGradle()
editBuildGradle(
kotlinVersion = kotlinVersion,
isKotlinDslUsed = false
)
if (setOfMPPModules.contains(KotlinKind.JVM)) {
editBuildGradle(kotlinVersion, false, "$projectName-jvm")
}
if (setOfMPPModules.contains(KotlinKind.JS)) {
editBuildGradle(kotlinVersion, false, "$projectName-js")
}
gradleReimport()
waitAMoment(extraTimeOut)
val expectedJars = (kotlinLibs[KotlinKind.Common]!!.kotlinMPProject.jars.getJars(kotlinVersion) +
(if (setOfMPPModules.contains(
KotlinKind.JVM)) kotlinLibs[KotlinKind.JVM]!!.kotlinMPProject.jars.getJars(kotlinVersion) else emptyList()) +
(if (setOfMPPModules.contains(
KotlinKind.JS)) kotlinLibs[KotlinKind.JS]!!.kotlinMPProject.jars.getJars(kotlinVersion) else emptyList())
).toSet()
projectStructureDialogScenarios.openProjectStructureAndCheck {
projectStructureDialogModel.checkLibrariesFromMavenGradle(
BuildSystem.Gradle,
kotlinVersion,
expectedJars
)
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, "$projectName", "${projectName}_main", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, "$projectName", "${projectName}_test", "Kotlin")
if (setOfMPPModules.contains(KotlinKind.JS)) {
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, "${projectName}-js", "${projectName}-js_main", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, "${projectName}-js", "${projectName}-js_test", "Kotlin")
}
if (setOfMPPModules.contains(KotlinKind.JVM)) {
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, "${projectName}-jvm", "${projectName}-jvm_main", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, "${projectName}-jvm", "${projectName}-jvm_test", "Kotlin")
}
}
}
@Test
@JvmName("kotlin_mpp_empty_root")
fun createKotlinMppProjectEmptyRoot() {
val extraTimeOut = 4000L
val projectName = testMethod.methodName
val kotlinVersion = KotlinTestProperties.kotlin_artifact_version
val setOfMPPModules = MPPModules.mppFullSet()
createKotlinMPProject(
projectPath = projectFolder,
moduleName = projectName,
mppProjectStructure = NewProjectDialogModel.MppProjectStructure.RootEmptyModule,
mppProjectStructure = NewProjectDialogModel.MppProjectStructure.HierarchicalStructure,
setOfMPPModules = MPPModules.mppFullSet()
)
waitAMoment(extraTimeOut)
@@ -84,14 +32,14 @@ class CreateKotlinMPProjectGuiTest : KotlinGuiTestCase() {
editBuildGradle(
kotlinVersion = kotlinVersion,
isKotlinDslUsed = false,
projectName = *arrayOf("$projectName-common")
projectName = *arrayOf(module_common)
)
if (setOfMPPModules.contains(KotlinKind.JVM)) {
editBuildGradle(kotlinVersion, false, "$projectName-jvm")
editBuildGradle(kotlinVersion, false, module_common, module_jvm)
}
if (setOfMPPModules.contains(KotlinKind.JS)) {
editBuildGradle(kotlinVersion, false, "$projectName-js")
editBuildGradle(kotlinVersion, false, module_common, module_js)
}
gradleReimport()
waitAMoment(extraTimeOut)
@@ -109,15 +57,74 @@ class CreateKotlinMPProjectGuiTest : KotlinGuiTestCase() {
kotlinVersion,
expectedJars
)
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, "${projectName}-common", "${projectName}-common_main", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, "${projectName}-common", "${projectName}-common_test", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, path = *arrayOf(module_common, "${module_common}_main", "Kotlin"))
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, path = *arrayOf(module_common, "${module_common}_test", "Kotlin"))
if (setOfMPPModules.contains(KotlinKind.JS)) {
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, "${projectName}-js", "${projectName}-js_main", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, "${projectName}-js", "${projectName}-js_test", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, path = *arrayOf(module_common, module_js, "${module_js}_main", "Kotlin"))
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, path = *arrayOf(module_common, module_js, "${module_js}_test", "Kotlin"))
}
if (setOfMPPModules.contains(KotlinKind.JVM)) {
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, "${projectName}-jvm", "${projectName}-jvm_main", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, "${projectName}-jvm", "${projectName}-jvm_test", "Kotlin")
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, path = *arrayOf(module_common, module_jvm, "${module_jvm}_main", "Kotlin"))
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, path = *arrayOf(module_common, module_jvm, "${module_jvm}_test", "Kotlin"))
}
}
}
@Test
@JvmName("kotlin_mpp_flat")
fun createKotlinMppProjectEmptyRoot() {
val extraTimeOut = 4000L
val projectName = testMethod.methodName
val kotlinVersion = KotlinTestProperties.kotlin_artifact_version
val setOfMPPModules = MPPModules.mppFullSet()
val module_common = "$projectName-common"
val module_jvm = "$projectName-jvm"
val module_js = "$projectName-js"
createKotlinMPProject(
projectPath = projectFolder,
moduleName = projectName,
mppProjectStructure = NewProjectDialogModel.MppProjectStructure.FlatStructure,
setOfMPPModules = MPPModules.mppFullSet()
)
waitAMoment(extraTimeOut)
editSettingsGradle()
editBuildGradle(
kotlinVersion = kotlinVersion,
isKotlinDslUsed = false,
projectName = *arrayOf(module_common)
)
if (setOfMPPModules.contains(KotlinKind.JVM)) {
editBuildGradle(kotlinVersion, false, module_jvm)
}
if (setOfMPPModules.contains(KotlinKind.JS)) {
editBuildGradle(kotlinVersion, false, module_js)
}
gradleReimport()
waitAMoment(extraTimeOut)
val expectedJars = (kotlinLibs[KotlinKind.Common]!!.kotlinMPProject.jars.getJars(kotlinVersion) +
(if (setOfMPPModules.contains(
KotlinKind.JVM)) kotlinLibs[KotlinKind.JVM]!!.kotlinMPProject.jars.getJars(kotlinVersion) else emptyList()) +
(if (setOfMPPModules.contains(
KotlinKind.JS)) kotlinLibs[KotlinKind.JS]!!.kotlinMPProject.jars.getJars(kotlinVersion) else emptyList())
).toSet()
projectStructureDialogScenarios.openProjectStructureAndCheck {
projectStructureDialogModel.checkLibrariesFromMavenGradle(
BuildSystem.Gradle,
kotlinVersion,
expectedJars
)
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, path = *arrayOf(module_common, "${module_common}_main", "Kotlin"))
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.Common]!!, path = *arrayOf(module_common, "${module_common}_test", "Kotlin"))
if (setOfMPPModules.contains(KotlinKind.JS)) {
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, path = *arrayOf(module_js, "${module_js}_main", "Kotlin"))
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JavaScript]!!, path = *arrayOf(module_js, "${module_js}_test", "Kotlin"))
}
if (setOfMPPModules.contains(KotlinKind.JVM)) {
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, path = *arrayOf(module_jvm, "${module_jvm}_main", "Kotlin"))
projectStructureDialogModel.checkFacetInOneModule(defaultFacetSettings[TargetPlatform.JVM18]!!, path = *arrayOf(module_jvm, "${module_jvm}_test", "Kotlin"))
}
}
}

View File

@@ -18,7 +18,7 @@ import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Consta
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.checkCreateJvmModule
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.checkCreateProjectFromTemplate
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.checkKotlinDsl
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.comboHierarchyKind
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.comboProjectStructure
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.groupAndroid
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.groupApplicationForge
import com.intellij.testGuiFramework.util.scenarios.NewProjectDialogModel.Constants.groupClouds
@@ -73,7 +73,7 @@ class NewProjectDialogModel(val testCase: GuiTestCase) : TestUtilsClass(testCase
const val textArtifactId = "ArtifactId"
const val checkKotlinDsl = "Kotlin DSL build script"
const val checkCreateFromArchetype = "Create from archetype"
const val comboHierarchyKind = "Hierarchy kind:"
const val comboProjectStructure = "Project structure:"
const val textRootModuleName = "Root module name:"
const val checkCreateJvmModule = "Create JVM module:"
const val checkCreateJsModule = "Create JS module:"
@@ -163,8 +163,8 @@ class NewProjectDialogModel(val testCase: GuiTestCase) : TestUtilsClass(testCase
)
enum class MppProjectStructure(private val title: String) {
RootEmptyModule("Root empty module with common & platform children"),
RootCommonModule("Root common module with children platform modules")
FlatStructure("Flat, all created modules on the same level"),
HierarchicalStructure("Hierarchical, platform modules under common one")
;
override fun toString() = title
@@ -426,13 +426,13 @@ fun NewProjectDialogModel.createKotlinMPProject(
logUIStep("Select `$itemKotlinMpp` kind of project")
jList(itemKotlinMpp).clickItem(itemKotlinMpp)
button(buttonNext).click()
val cmb = combobox(comboHierarchyKind)
val cmb = combobox(comboProjectStructure)
logUIStep("Select MP project hierarchy kind: `$mppProjectStructure`")
if (cmb.selectedItem() != mppProjectStructure.toString()) {
cmb
.expand()
.selectItem(mppProjectStructure.toString())
logInfo("Combobox `$comboHierarchyKind`: current selected item is `${cmb.selectedItem()}` ")
logInfo("Combobox `$comboProjectStructure`: current selected item is `${cmb.selectedItem()}` ")
}
logUIStep("Type root module name `$moduleName`")