Rewrite 3rd party JS code to enforce that parent + top references are always correct
See original GitHub issueCurrent 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)
- Operating System: Arch Linux
- Cypress Version: 2.1.0
- Browser Version: Electron 59
Issue Analytics
- State:
- Created 6 years ago
- Comments:11 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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?
Hi Brian. I confirm the workaround works. Thanks a lot for your help guys, I was running out of options!