From 4cc93af3642f2b672b715a00a670421f694d249b Mon Sep 17 00:00:00 2001 From: Tim van der Meij Date: Sun, 24 Aug 2025 18:48:38 +0200 Subject: [PATCH] Improve the selection check in the "doesn't jump when moving selection" integration test Locally, on Arch Linux, this integration test permafails: ``` 1) Text layer Text selection using selection carets doesn't jump when moving selection Message: second selection: Expected '(frequently executed) bytecode sequences, records them, and compiles them to fast native code. We call such a s' to roughly match /frequently .* We call such a se/s. Stack: at at UserContext. (file:///home/timvandermeij/Documenten/Ontwikkeling/pdf.js/Code/test/integration/text_layer_spec.mjs:521:12) Message: third selection: Expected '(frequently executed) bytecode sequences, records them, and compiles them to fast native code. We call such a s' to roughly match /frequently .* We call such a se/s. Stack: at at UserContext. (file:///home/timvandermeij/Documenten/Ontwikkeling/pdf.js/Code/test/integration/text_layer_spec.mjs:529:12 ``` The exact selection can differ a bit per OS/browser. In this case the last character was consistently not selected while on other platforms it is, so this commit fixes the issue by relaxing the regex to not consider the final character so that the test passes if the rest matches. --- test/integration/text_layer_spec.mjs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/integration/text_layer_spec.mjs b/test/integration/text_layer_spec.mjs index 38c95e015..a9c7fa41e 100644 --- a/test/integration/text_layer_spec.mjs +++ b/test/integration/text_layer_spec.mjs @@ -509,7 +509,7 @@ describe("Text layer", () => { await expectAsync(page) .withContext(`second selection`) - .toHaveRoughlySelected(/frequently .* We call such a se/s); + .toHaveRoughlySelected(/frequently .* We call such a s/s); await page.mouse.down(); await moveInSteps(page, intermediateCaretPos, finalCaretPos, 20); @@ -517,7 +517,7 @@ describe("Text layer", () => { await expectAsync(page) .withContext(`third selection`) - .toHaveRoughlySelected(/frequently .* We call such a se/s); + .toHaveRoughlySelected(/frequently .* We call such a s/s); }); }); });