Skip to content

Commit 1eab2ec

Browse files
committed
chore: fix localiser tools for QA
1 parent 4c5cd88 commit 1eab2ec

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

ts/localization/localeTools.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ export class LocalizedStringBuilder<T extends MergedLocalizerTokens> extends Str
352352
}
353353

354354
private postProcessStrippedString(str: string): string {
355+
if (typeof process.env.TEST_WORKER_INDEX === 'string' && process.env.TEST_WORKER_INDEX.length) {
356+
// Special case for when running in playwright (those files are reused for session-appium & session-playwright as is).
357+
// When that's the case, we need to replace `<br/>` and `<br/><br/>` with a single space.
358+
// " <br/><br/>" and "<br/>" both become a single space
359+
return str.replace(/\s*(<br\s*\/?>[\s]*)+/gi, ' ').replace(/<[^>]*>/g, '');
360+
}
355361
const strippedString = str.replaceAll(/<[^>]*>/g, '');
356362
return deSanitizeHtmlTags(strippedString, '\u200B');
357363
}

0 commit comments

Comments
 (0)