[IFT] Add test script to Modal commit enabled warning

It will fix UI tests if for some reason modal commit dialog is enabled by default.

IJ-CR-19745

GitOrigin-RevId: 2a71ab9387367fa8d0ca239439f3f1193ee4a898
This commit is contained in:
Konstantin Hudyakov
2022-01-18 19:34:08 +03:00
committed by intellij-monorepo-bot
parent cf1a201c6e
commit 75508378c8
2 changed files with 20 additions and 8 deletions

View File

@@ -212,6 +212,12 @@ object GitLessonsUtil {
+ " " + GitLessonsBundle.message("git.click.to.change.settings", callbackId)) {
!VcsApplicationSettings.getInstance().COMMIT_FROM_LOCAL_CHANGES
}
test {
if (!VcsApplicationSettings.getInstance().COMMIT_FROM_LOCAL_CHANGES) {
Thread.sleep(1000) // need to wait until LessonMessagePane become updated after restart and warning will be showed
clickLessonMessagePaneLink(" click ")
}
}
}
}

View File

@@ -368,14 +368,20 @@ fun TaskContext.proceedLink(additionalAbove: Int = 0) {
}
addStep(gotIt)
test {
ideFrame {
val linkText = "Click to proceed"
val lessonMessagePane = findComponentWithTimeout(defaultTimeout) { _: LessonMessagePane -> true }
val offset = lessonMessagePane.text.indexOf(linkText)
if (offset == -1) error("Not found '$linkText' in the LessonMessagePane")
val rect = lessonMessagePane.modelToView2D(offset + linkText.length / 2)
robot.click(lessonMessagePane, Point(rect.centerX.toInt(), rect.centerY.toInt()))
}
clickLessonMessagePaneLink("Click to proceed")
}
}
/**
* Will click on the first occurrence of [linkText] in the [LessonMessagePane]
*/
fun TaskTestContext.clickLessonMessagePaneLink(linkText: String) {
ideFrame {
val lessonMessagePane = findComponentWithTimeout(defaultTimeout) { _: LessonMessagePane -> true }
val offset = lessonMessagePane.text.indexOf(linkText)
if (offset == -1) error("Not found '$linkText' in the LessonMessagePane")
val rect = lessonMessagePane.modelToView2D(offset + linkText.length / 2)
robot.click(lessonMessagePane, Point(rect.centerX.toInt(), rect.centerY.toInt()))
}
}