Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CLI - Browser doesn't close and hangs forever #4182

Closed
venu opened this issue May 13, 2019 · 3 comments
Closed

CLI - Browser doesn't close and hangs forever #4182

venu opened this issue May 13, 2019 · 3 comments
Labels
type: duplicate This issue or pull request already exists

Comments

@venu
Copy link

venu commented May 13, 2019

Current behavior:

DEBUG=cypress:* ./node_modules/.bin/cypress run  --spec "cypress/integration/test_spec.js" --headed

When test is finished, browser is supposed to close and move to next testsuite. But it hangs forever.

cypress:server:project onMocha suite end +0ms
  cypress:server:reporter got mocha event 'suite end' with args: [ { id: 'r1', title: '', root: true, type: 'suite' } ] +0ms
  cypress:server:timers clearing timer id 82 from queue { '82': { args: [], ms: 85000, cb: [Function] } } +17ms
  cypress:server:timers queuing timer id 83 after 85000 ms +0ms
  cypress:server:timers child received timer id 83 +18ms
  cypress:server:project onMocha end +1ms
  cypress:server:reporter got mocha event 'end' with args: [ { end: '2019-05-13T08:03:29.340Z' } ] +0ms

  1 passing (10s)


  (Results)

  ┌──────────────────────────────────────────────────────┐
  │ Tests:        1                                      │
  │ Passing:      1                                      │
  │ Failing:      0                                      │
  │ Pending:      0                                      │
  │ Skipped:      0                                      │
  │ Screenshots:  0                                      │
  │ Video:        false                                  │
  │ Duration:     9 seconds                              │
  │ Spec Ran:     test_spec.js │
  └──────────────────────────────────────────────────────┘

  cypress:server:run attempting to close the browser +11ms
  cypress:server:browsers killing browser process +0ms
  cypress:server:timers clearing timer id 83 from queue { '83': { args: [], ms: 85000, cb: [Function] } } +13s
  cypress:server:timers queuing timer id 84 after 85000 ms +4ms
  cypress:server:timers child received timer id 84 +13s
  cypress:server:timers child sending timer id 3 +3s

image

Desired behavior:

When test is finished, browser is supposed to close and move to next testsuite. But it hangs forever.

Steps to reproduce: (app code and test code)

App Code

function onButtonClick() {
   window.location.hash = '/test/new'
}

Test Code

cy.visit("/#/test");
cy.get('.test-btn').click()
cy.hash().should('eq', '#/test/new')

Versions

Cypress - 3.2.0
OS - Ubuntu 18.04

@venu
Copy link
Author

venu commented May 13, 2019

It looks like, its related to onbeforeunload event.

@venu
Copy link
Author

venu commented May 13, 2019

For now, I have fixed this by disabling onbeforeunload after test finished, so browser can close.

afterEach(function() {
  cy.window().then(win => win.onbeforeunload = undefined);
})

@jennifer-shehane
Copy link
Member

Yes, this is a duplicate of #2118

@jennifer-shehane jennifer-shehane added the type: duplicate This issue or pull request already exists label May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants