internetarchive / bookreader

The Internet Archive BookReader
https://openlibrary.org/dev/docs/bookreader
GNU Affero General Public License v3.0
982 stars 418 forks source link

Testcafe E2E tests failing #591

Closed cdrini closed 1 year ago

cdrini commented 3 years ago

One of the E2E tests is failing! See e.g. https://github.com/internetarchive/bookreader/runs/1622579194?check_suite_focus=true

Evidence / Screenshot (if possible)

 ✖ Canonical URL shows parameters if cookie set (unstable)

   1) An error occurred in ClientFunction code:

      ReferenceError: br is not defined

      Browser: Chrome 87.0.4280.88 / Linux 0.0

          92 |
          93 |    // reload canonical URL, wait for URL change
          94 |    await t.navigateTo(initialUrl);
          95 |    await t.wait(PAGE_FLIP_WAIT_TIME);
          96 |
       >  97 |    if (await usesResume()) {
          98 |      await t.expect(isPageInUrl()).eql(true, initialUrl);
          99 |      await t.expect(isModeInUrl('2up')).eql(true,
      initialUrl)
         100 |    } else {
         101 |      // No plugin, no br-resume cookie
         102 |      await t.expect(getUrl()).notContains('#page/');

         at <anonymous>
      (/home/runner/work/bookreader/bookreader/tests/e2e/helpers/base.js:97:15)

   2) A JavaScript error occurred on

   "http://127.0.0.1:8000/BookReaderDemo/demo-internetarchive.html?ocaid=theworksofplato01platiala#page/n7/mode/2up".
      Repeat test actions in the browser and check the console for errors.
      If you see this error, it means that the tested website caused it.
      You can fix it or disable tracking JavaScript errors in TestCafe. To
      do the latter, enable the "--skip-js-errors" option.
      If this error does not occur, please write a new issue at:

   "https://github.com/DevExpress/testcafe/issues/new?template=bug-report.md".

      JavaScript error details:
      [object Object]
          No stack trace available

      Browser: Firefox 83.0 / Linux 0.0

         89 |    // Set Cookie by page navigation, wait for cookie
         90 |    await t.click(nav.desktop.goNext);
         91 |    await t.wait(PAGE_FLIP_WAIT_TIME);
         92 |
         93 |    // reload canonical URL, wait for URL change
       > 94 |    await t.navigateTo(initialUrl);
         95 |    await t.wait(PAGE_FLIP_WAIT_TIME);
         96 |
         97 |    if (await usesResume()) {
         98 |      await t.expect(isPageInUrl()).eql(true, initialUrl);
         99 |      await t.expect(isModeInUrl('2up')).eql(true,
      initialUrl)

         at <anonymous>
      (/home/runner/work/bookreader/bookreader/tests/e2e/helpers/base.js:94:13)

Expectation

What should be happening? What will it look like / how will it behave when fixed?

Context

What operating system? What browser type and version?

Proposal & Constraints

What is the proposed solution / implementation? Is there a precedent of this approach succeeding elsewhere?

Stakeholders

@iisa

shreyaswikriti commented 3 years ago

can anybody help me how to get started. I can't find any suitable contribution guide here.help needed!!!!

SaravgiYash commented 3 years ago

@cdrini https://github.com/DevExpress/testcafe/issues/1721#issuecomment-370283655 according to this we need to set the URL before setting the cookie or it will not work. And according to comments on lines 89 and 93 we are setting the cookie before the URL so that might be the problem. If this solution is correct I would like to create a PR for the same.

cdrini commented 1 year ago

This appears to go longer be an issue; testcafe is running normally