question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Rewrite 3rd party JS code to enforce that parent + top references are always correct

See original GitHub issue

Current behavior:

I setup a very simple test that searches for a link in a web page (given an id) and clicks it. Than it checks the content of another element to check it’s correct. What happens is that selectors are found but the test fails. In fact the web page is behaving correctly. I can see an error in the inspector:

Uncaught SyntaxError: Unexpected token <

And another one:

Unhandled rejection TypeError: Cannot read property 'currentRetry' of undefined

Desired behavior:

The test to pass.

How to reproduce:

Just run the test below.

Test code:

describe('Check properties worldwide page', function() {
  beforeEach(function () {
    cy.visit('https://beta.hostelsclub.com/en/hostels');
  })

  it('Opens the correct country page', function () {
    cy.get('a#usa').click();
    cy.get('header.header-country .intro h1').contains('Best hostels in USA');
  })
});

Additional Info (images, stack traces, etc)

err2

  • Operating System: Arch Linux
  • Cypress Version: 2.1.0
  • Browser Version: Electron 59

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
matthewshirleycommented, May 2, 2019

I believe I have reproduced similar behavior with an internal application. I cannot block the 3rd party JS code that is being evaluated. Is there another workaround I can use?

1reaction
whites11commented, Mar 16, 2018

Hi Brian. I confirm the workaround works. Thanks a lot for your help guys, I was running out of options!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Handling common JavaScript problems - MDN Web Docs
Declaring strict mode at the top of your JavaScript code causes it to be parsed with a stricter set of rules, meaning that...
Read more >
typescript-cheatsheet - GitHub Pages
A set of TypeScript related notes used for quick reference. The cheatsheet contains references to types, classes, decorators, and many other TypeScript ...
Read more >
Pass variables by reference in JavaScript - Stack Overflow
"Pass-by-reference" simply means, "the function, to some degree, can change the value of the variable that was passed in as argument." (in the...
Read more >
4 Types of Memory Leaks in JavaScript and How to Get Rid Of ...
In this article we will explore common types of memory leaks in client-side JavaScript code. We will also learn how to use the...
Read more >
Arrow Functions in JavaScript: Fat & Concise Syntax - SitePoint
Learn how to use JavaScript arrow functions, understand fat and concise arrow syntax, and what to be aware of when using them in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found