[gui-tests] changed checkRunGutterIcons() to checkGutterIcons(), now accepting different icons

This commit is contained in:
Mari Baburina
2018-08-27 20:19:46 +03:00
parent 4baeb745d0
commit 7fe3d126a3
@@ -207,19 +207,21 @@ fun GuiTestCase.checkProjectIsRun(configuration: String, message: String) {
}
}
fun GuiTestCase.checkRunGutterIcons(expectedNumberOfRunIcons: Int, expectedRunLines: List<String>) {
fun GuiTestCase.checkGutterIcons(gutterIcon: GutterFixture.GutterIcon,
expectedNumberOfIcons: Int,
expectedLines: List<String>) {
ideFrame {
logTestStep("Going to check whether $expectedNumberOfRunIcons `Run` gutter icons are present")
logTestStep("Going to check whether $expectedNumberOfIcons $gutterIcon gutter icons are present")
editor {
waitUntilFileIsLoaded()
waitUntilErrorAnalysisFinishes()
gutter.waitUntilIconsShown(mapOf(GutterFixture.GutterIcon.RUN_SCRIPT to expectedNumberOfRunIcons))
val gutterRunLines = gutter.linesWithGutterIcon(GutterFixture.GutterIcon.RUN_SCRIPT)
gutter.waitUntilIconsShown(mapOf(gutterIcon to expectedNumberOfIcons))
val gutterLinesWithIcon = gutter.linesWithGutterIcon(gutterIcon)
val contents = this@editor.getCurrentFileContents(false)?.lines() ?: listOf()
for ((index, line) in gutterRunLines.withIndex()) {
for ((index, line) in gutterLinesWithIcon.withIndex()) {
// line numbers start with 1, but index in the contents list starts with 0
val currentLine = contents[line - 1]
val expectedLine = expectedRunLines[index]
val expectedLine = expectedLines[index]
assert(currentLine.contains(expectedLine)) {
"At line #$line the actual text is `$currentLine`, but it was expected `$expectedLine`"
}