Skip to content

[Bug]: Intermittent failure in the find integration tests #19999

@timvandermeij

Description

@timvandermeij

Attach (recommended) or Link to PDF file

N/A

Web browser and its version

Firefox 139.0.1

Operating system and its version

Arch Linux

PDF.js version

5.3.31

Is the bug present in the latest PDF.js version?

Yes

Is a browser extension

No

Steps to reproduce the problem

  1. Apply the following diff to the find bar code on master:
diff --git a/web/pdf_find_bar.js b/web/pdf_find_bar.js
index d76d4fe3d..7cc957128 100644
--- a/web/pdf_find_bar.js
+++ b/web/pdf_find_bar.js
@@ -166,7 +166,8 @@ class PDFFindBar {
     }
   }
 
-  open() {
+  async open() {
+    await new Promise(r => setTimeout(r, 2000));
     if (!this.opened) {
       // Potentially update the findbar layout, row vs column, when:
       //  - The width of the viewer itself changes.
  1. Apply the following diff to only run the find integration tests:
diff --git a/test/integration/find_spec.mjs b/test/integration/find_spec.mjs
index 2f3ef1e15..fe7003151 100644
--- a/test/integration/find_spec.mjs
+++ b/test/integration/find_spec.mjs
@@ -24,7 +24,7 @@ function fuzzyMatch(a, b, browserName, pixelFuzz = 3) {
     .toBeGreaterThan(b - pixelFuzz);
 }
 
-describe("find bar", () => {
+fdescribe("find bar", () => {
   describe("highlight all", () => {
     let pages;
  1. Run npx gulp integrationtest.

What is the expected behavior?

The integration tests pass (i.e. do not depend on how long it takes to open the find bar).

What went wrong?

The integration tests fail (i.e. do depend on how long it takes to open the find bar).

Link to a viewer

No response

Additional context

This issue was found during code inspection for another integration test.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions