setTestWindowTitle method
Sets the test window title.
Implementation
void setTestWindowTitle([String? step]) {
cleanText(String? s) =>
s
?.replaceAll(RegExp(r'"+'), ' ')
.replaceAll(RegExp(r'[\[\]]'), ' ')
.replaceAll(RegExp(r'-+'), '_')
.replaceAll(RegExp(r'\s+'), ' ')
.trim() ??
'';
step = cleanText(step);
var testName = cleanText(testUIName);
var uiName = isInitialized ? uiRoot.name : null;
uiName = cleanText(uiName);
var prefix =
[uiName, testName].nonNulls.where((e) => e.isNotEmpty).join(' - ');
var parts = [
if (prefix.isNotEmpty) '[$prefix]',
step,
];
var title = parts.where((e) => e.isNotEmpty).join(' ');
try {
js.context.callMethod("eval", [
'''
window.top.document.title = "$title";
'''
]);
} catch (_) {}
}