Skip to content

Convert the test-suite to use the Fetch API rather than XMLHttpRequest #14287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from

Conversation

Snuffleupagus
Copy link
Collaborator

@Snuffleupagus Snuffleupagus commented Nov 18, 2021

  • Convert the test-suite to use the Fetch API rather than XMLHttpRequest

    The Fetch API should be well supported across modern browsers, see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility, and allows simplifying the code thanks to all of its method returning Promises.

    This patch also introduces template strings, rather than using manual string concatenation, in a few spots in test/driver.js.
    Finally, in test/driver.js, we'll now use the PDF.js utility function createObjectURL to get rid of the FileReader usage.

  • Convert the writeSVG function, in test/driver.js, to return a Promise

    This allows (some) simplification of the call-sites, since we can now use async/await directly rather than having to manually wrap a lot of code in a Promise.

@Snuffleupagus Snuffleupagus marked this pull request as draft November 18, 2021 16:54
@mozilla mozilla deleted a comment from pdfjsbot Nov 18, 2021
@mozilla mozilla deleted a comment from pdfjsbot Nov 18, 2021
@mozilla mozilla deleted a comment from pdfjsbot Nov 18, 2021
@mozilla mozilla deleted a comment from pdfjsbot Nov 18, 2021
@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/543fcfd64ac6d04/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_test from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/abced55db150cf5/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/abced55db150cf5/output.txt

Total script time: 22.45 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 7
  different first/second rendering: 1

Image differences available at: http://54.241.84.105:8877/abced55db150cf5/reftest-analyzer.html#web=eq.log

@pdfjsbot
Copy link

From: Bot.io (Windows)


Failed

Full output at http://54.193.163.58:8877/543fcfd64ac6d04/output.txt

Total script time: 43.29 mins

  • Font tests: Passed
  • Unit tests: Passed
  • Integration Tests: FAILED
  • Regression tests: FAILED
  different ref/snapshot: 12
  different first/second rendering: 1

Image differences available at: http://54.193.163.58:8877/543fcfd64ac6d04/reftest-analyzer.html#web=eq.log

@Snuffleupagus
Copy link
Collaborator Author

/botio integrationtest

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.241.84.105:8877/7732239a02b2e48/output.txt

@pdfjsbot
Copy link

From: Bot.io (Windows)


Received

Command cmd_integrationtest from @Snuffleupagus received. Current queue size: 0

Live output at: http://54.193.163.58:8877/38cf12f042f9f81/output.txt

@pdfjsbot
Copy link

From: Bot.io (Linux m4)


Failed

Full output at http://54.241.84.105:8877/7732239a02b2e48/output.txt

Total script time: 2.53 mins

  • Integration Tests: FAILED

@pdfjsbot
Copy link

From: Bot.io (Windows)


Success

Full output at http://54.193.163.58:8877/38cf12f042f9f81/output.txt

Total script time: 6.00 mins

  • Integration Tests: Passed

The Fetch API should be well supported across modern browsers, see https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API#browser_compatibility, and allows simplifying the code thanks to all of its method returning Promises.

This patch also introduces template strings, rather than using manual string concatenation, in a few spots in `test/driver.js`.
…mise

This allows (some) simplification of the call-sites, since we can now use `async`/`await` directly rather than having to manually wrap a lot of code in a Promise.
@brendandahl
Copy link
Contributor

Why'd you close this?

@Snuffleupagus
Copy link
Collaborator Author

Why'd you close this?

Because I was getting additional intermittents locally with the latest version of the patch (e.g. in textLayer tests), that I didn't really understand and that didn't really make a lot of sense. Based on that I'm no longer sure if trying to convert everything at once is a good idea, since I really don't want to introduce more intermittent failures in the tests.
Time permitting I'll try to look into this later, but right now I don't think this will work as-is and it does feel somewhat risky (for a small benefit).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants