[gui-test] fix first start

This commit is contained in:
Vladislav Shishov
2019-01-17 14:46:37 +03:00
parent 2eed470f0f
commit fc2fcfca59
@@ -42,8 +42,6 @@ abstract class FirstStart(val ideType: IdeType) {
private val FIRST_START_ROBOT_THREAD = "First Start Robot Thread"
private val LOG = Logger.getInstance(this.javaClass.name)
val myRobot: Robot
private val robotThread: Thread = thread(start = false, name = FIRST_START_ROBOT_THREAD) {
@@ -85,7 +83,7 @@ abstract class FirstStart(val ideType: IdeType) {
init {
myRobot = SmartWaitRobot()
LOG.info("Starting separated thread: '$FIRST_START_ROBOT_THREAD' to complete initial installation")
println("Starting separated thread: '$FIRST_START_ROBOT_THREAD' to complete initial installation")
robotThread.start()
}
@@ -111,7 +109,7 @@ abstract class FirstStart(val ideType: IdeType) {
fun Frame.close() = myRobot.close(this)
fun findWelcomeFrame(seconds: Int = 5): Frame? {
LOG.info("Waiting for a Welcome Frame")
println("Waiting for a Welcome Frame")
silentWaitUntil("Welcome Frame to show up", seconds) {
Frame.getFrames().any { checkIsWelcomeFrame(it) }
}
@@ -135,28 +133,29 @@ abstract class FirstStart(val ideType: IdeType) {
open fun acceptAgreement() {
if (!needToShowAgreement()) return
try {
LOG.info("Waiting for License Agreement/Privacy Policy dialog")
println("Waiting for License Agreement/Privacy Policy dialog")
findPrivacyPolicyDialogOrLicenseAgreement()
with(JDialogFixture(myRobot, findPrivacyPolicyDialogOrLicenseAgreement())) {
click()
checkboxContainingText("i confirm", true, Timeouts.noTimeout).select()
LOG.info("Accept License Agreement/Privacy Policy dialog")
println("Accept License Agreement/Privacy Policy dialog")
button("Continue", Timeouts.seconds05).click()
}
}
catch (e: WaitTimedOutError) {
LOG.warn("'License Agreement/Privacy Policy dialog hasn't been shown. Check registry...")
println("'License Agreement/Privacy Policy dialog hasn't been shown. Check registry...")
}
}
open fun completeInstallation() {
if (!needToShowCompleteInstallation()) return
with(myRobot) {
val title = "Complete Installation"
LOG.info("Waiting for '$title' dialog")
val dialogFixture = dialog(title)
println("Waiting for 'import settings' dialog")
val dialogFixture = dialog {
it.startsWith("Import")
}
LOG.info("Click OK on 'Do not import settings'")
println("Click OK on 'Do not import settings'")
dialogFixture.radioButton("Do not import settings").select()
repeatUntil(
@@ -168,15 +167,15 @@ abstract class FirstStart(val ideType: IdeType) {
open fun acceptDataSharing() {
with(myRobot) {
LOG.info("Accepting Data Sharing")
println("Accepting Data Sharing")
val title = "Data Sharing"
try {
dialog(title, timeout = Timeouts.seconds05)
button("Send Usage Statistics").click()
LOG.info("Data sharing accepted")
println("Data sharing accepted")
}
catch (e: WaitTimedOutError) {
LOG.info("Data sharing dialog hasn't been shown")
println("Data sharing dialog hasn't been shown")
return
}
}
@@ -186,10 +185,10 @@ abstract class FirstStart(val ideType: IdeType) {
if (!needToShowCustomizeWizard()) return
with(myRobot) {
val title = "Customize $ideName"
LOG.info("Waiting for '$title' dialog")
println("Waiting for '$title' dialog")
dialog(title)
val buttonText = "Skip Remaining and Set Defaults"
LOG.info("Click '$buttonText'")
println("Click '$buttonText'")
button(buttonText).click()
}
}
@@ -197,20 +196,20 @@ abstract class FirstStart(val ideType: IdeType) {
open fun evaluateLicense(ideName: String, robot: Robot) {
with(robot) {
val licenseActivationFrameTitle = "$ideName License Activation"
LOG.info("Waiting for '$licenseActivationFrameTitle' dialog")
println("Waiting for '$licenseActivationFrameTitle' dialog")
try {
waitFrame(licenseActivationFrameTitle) { it == licenseActivationFrameTitle }
radioButton("Evaluate for free").select()
val evaluateButton = button("Evaluate")
GuiTestUtilKt.waitUntil("activate button will be enabled") { evaluateButton.isEnabled }
LOG.info("Click '${evaluateButton.text()}'")
println("Click '${evaluateButton.text()}'")
evaluateButton.click()
dialog(timeout = Timeouts.seconds10) { it.startsWith("License Agreement for") }
button("Accept").click()
}
catch (waitTimedOutError: WaitTimedOutError) {
LOG.info("No License Activation dialog has been found")
println("No License Activation dialog has been found")
}
}
}