bookreader icon indicating copy to clipboard operation
bookreader copied to clipboard

Testcafe E2E tests failing

Open cdrini opened this issue 4 years ago • 2 comments

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

cdrini avatar Dec 29 '20 16:12 cdrini

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

shreyaswikriti avatar Jan 26 '21 07:01 shreyaswikriti

@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.

SaravgiYash avatar Jan 31 '21 17:01 SaravgiYash

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

cdrini avatar Oct 24 '22 09:10 cdrini