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.

All event handlers are cleaned after the document.open function call

See original GitHub issue

What is your Test Scenario?

Testing Google Apps Script web app, which adds two levels of iframe to your content.

What is the Current behavior?

Test hangs on await Selector(..)()

What is the Expected behavior?

Test runs normally

What is your web application and your TestCafe test code?

Your website URL (or attach your complete example): https://script.google.com/macros/s/AKfycbznLgTmhAx4iz4tdfY__7I_326s3ZLqWQaR3HKoJi37R0U4OcM/exec

Your complete test code (or attach your test files):
fixture`Testcafe nested iframe freezing issue repro`
  .page('https://script.google.com/macros/s/AKfycbznLgTmhAx4iz4tdfY__7I_326s3ZLqWQaR3HKoJi37R0U4OcM/exec');

import { Selector } from 'testcafe';

test('It stucks on nested iframe selector', async t => {
  await t
    .switchToIframe('#sandboxFrame')
    .switchToIframe('#userHtmlFrame');

  await Selector('#helloworld')();
  console.log("This is never logged as it's stuck");
});
Your complete test report: None.

Steps to Reproduce:

  1. Run the test
  2. See the test hangs

Your Environment details:

  • testcafe version: 0.23.2
  • node.js version: v11.2.0
  • command-line arguments: testcafe chrome test.js
  • browser name and version: Chrome 70.0.3538
  • platform and version: Mac OS X 10.14.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
fnlctrlcommented, Feb 12, 2019

The current workaround I’m using is to avoid using selector api and to use client functions like t.eval(() => document.querySelector(....)) This is ugly, but is ok for my use case.

1reaction
fnlctrlcommented, Dec 24, 2019

🎉 🎉 🎉 🎉 🎉

Read more comments on GitHub >

github_iconTop Results From Across the Web

document.open removes all window listeners - Stack Overflow
The general idea is to setup a listener for a custom event called TestEvent , which clears a timeout.
Read more >
Event handling (overview) - Event reference - MDN Web Docs
A notable event listener feature is the ability to use an abort signal to clean up multiple event handlers at the same time....
Read more >
How to Cleanup Event Listeners in React - Pluralsight
Be a good citizen. Always cleanup your event listeners. Do this with window.removeEventListener when your component unmounts. By cleaning up, ...
Read more >
Integration Services (SSIS) Event Handlers - Microsoft Learn
Event handlers can perform tasks such as the following: Clean up temporary data storage when a package or task finishes running.
Read more >
Event listeners not working? 3 key areas to troubleshoot
addEventListener(EVENT_TYPE, function(event) { console.log( event.type, // The type of the event event.target, // The target of the event event, ...
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