If a test name contains `Char.MIN_HIGH_SURROGATE` ...
# testballoon
c
If a test name contains
Char.MIN_HIGH_SURROGATE
, running with
Copy code
js {
    browser {
        test {  // new Playwright-based DSL
            firefox()
        }
    }
}
the test times out. I don't see issues with Chromium-based browsers I don't know if it's related to TestBalloon, I guess not?
o
Would it time out after adding
withTestBalloon(this@js)
inside the
test
block?
c
I don't have this method in TestBalloon 1.2.0 🤔 Should it be available?
o
It's available for Kotlin versions >= 2.4.20 in package
de.infix.testBalloon.gradlePlugin.internal.layer.kotlin2420
. TestBalloon dynamically loads Kotlin-version-specific Gradle subplugins for multi-version support, but these are all located in a single artifact. If the IDE balks, maybe a manual import would help.
c
The IDE doesn't seem convinced. Kotlin 2.4.21, TestBalloon 1.2.0
o
Copy code
import de.infix.testBalloon.gradlePlugin.internal.layer.kotlin2420.withTestBalloon
A full example (though in a template format) is here: github.com/infix-de/testBalloon/blob/…/build.gradle.kts
c
IDE still doesn't like it, but Gradle accepts it. The timeout is reproduced:
Copy code
* What went wrong:
Execution failed for task ':suite:jsBrowserTest' (registered in build file 'suite/build.gradle.kts').
> Timeout 30000ms exceeded
o
Then it's probably a browser-specific issue. You could use the following:
Copy code
test {
    withTestBalloon(this@js)
    headless = true
    timeout = 5.minutes
    firefox()
}
and examine the browser's console log for details.
c
Since it's a weird Unicode character that triggers it, I suspect something in between the test framework, the browser and KGP gets confused and drops the message
Since it works with Chromium, I assume it's not TestBalloon
o
It's always possible that an "illegal" character (high surrogate without preceding subsequent low surrogate) disturbs the messaging between browser and server (KGP).
o
Do you have some minimal code for the test itself? E.g., what surrounds the invalid character? Is it just the name or does the character get printed?
c
It's just in the name, if I strip it from the name the test is successful
o
Is there a special reason to use the invalid character instead of the valid surrogate pair?
c
It's a regression test that verifies what happens when an invalid UTF8 sequence is passed to the
Display.Full.display()
function
I've just removed the value from the test name for now, it's not a big deal, but I'm happy that my regression tests find other people's bugs 😅
o
I guess things like these in test names are just out of scope: You'd probably have no way of inserting that code into a Kotlin test function name using backticks, right? TestBalloon would encode the character, but AFAIK there are no provisions in the TeamCity report format for surrogates. And the underlying decoder in KGP probably will not expect them.
c
To be fair, I wouldn't mind if whatever doesn't like the character down the chain just strips it out
It's just that "a timeout error" is not the appropriate behavior
Actually I wouldn't even complain about an error that says "this character is forbidden in test names"
(though I prefer the character being stripped out, if it's not possible to deal with it the entire way)
o
Regarding TestBalloon, there is already a ton of code inside to just make test names work on the various targets. The more checks we put in there, the less maintainable the product becomes, and the slower it gets.
So assuming TestBalloon should care more about the internals of KGP (which could change without notice), you could also start at the top of your stack, which is Prepared, right?
c
I believe the problem should be fixed the nearer to where it is (easier maintenance + benefits the most users). If the problem is in Playwright, they should fix it. If it can't be fixed there, it should be fixed in KGP. Anyway TestBalloon seems to work fine with Chromium so I don't think there's any change required on the TestBalloon side if KGP fixes it
I don't think there's any need to patch it in TestBalloon/Prepared until KGP does something, since it's probably not something many people do anyway
o
Yes, I guess things like this would probably be introduced deliberately and can be dealt with if breaking, as in your case (unlike, for examples, producing long test names, which may be hard to contain in test user code). But I guess it's a near-zero priority for KGP, as it's an extreme edge case, and probably not many test frameworks/libraries (if any at all) would cover something like this. Maybe it even depends on where this invalid character appears. If there are many tests after it, it might just work.
Interestingly, doesn't reproduce with
firefox()
over here:
Copy code
package com.example

import de.infix.testBalloon.framework.core.testSuite

val SimpleSuite by testSuite {
    test("test 1") {}
    test("Invalid ${Char.MIN_HIGH_SURROGATE}") {}
}
👀 1