cypress-io / cypress

Fast, easy and reliable testing for anything that runs in a browser.
https://cypress.io
MIT License
46.87k stars 3.18k forks source link

cypress `before all` or `after all` hooks fails #19358

Closed Vladislavvk1337 closed 2 years ago

Vladislavvk1337 commented 2 years ago

Current behavior

Working with laravel and vue. I'm trying a simple visit test, but i got everytime the same error. I try it with all this methodes - cy.request('/'), cy.request('http://mysite/'), cy.visit('/'), cy.visit(''http://mysite/') or with a route var thisismyroute = "'http://mysite/" / *Laravelroute ; cy.visit('thisismyroute)

image

This is my error at cypress run image

and at cypress open image

Although you have test retries enabled, we do not retry tests when `before all` or `after all` hooks fail
      at https://example.site/__cypress/runner/cypress_runner.js:140235:19
      at tryCatcher (https://example.site/__cypress/runner/cypress_runner.js:10798:23)
      at https://example.site/__cypress/runner/cypress_runner.js:5920:41
      at tryCatcher (https://example.site/__cypress/runner/cypress_runner.js:10798:23)
      at Promise._settlePromiseFromHandler (https://example.site/__cypress/runner/cypress_runner.js:8733:31)
      at Promise._settlePromise (https://example.site/__cypress/runner/cypress_runner.js:8790:18)
      at Promise._settlePromise0 (https://example.site/__cypress/runner/cypress_runner.js:8835:10)
      at Promise._settlePromises (https://example.site/__cypress/runner/cypress_runner.js:8911:18)
      at _drainQueueStep (https://example.site/__cypress/runner/cypress_runner.js:5505:12)
      at _drainQueue (https://example.site/__cypress/runner/cypress_runner.js:5498:9)
      at Async.../../node_modules/bluebird/js/release/async.js.Async._drainQueues (https://example.site/__cypress/runner/cypress_runner.js:5514:5)
      at Async.drainQueues (https://example.site/__cypress/runner/cypress_runner.js:5384:14)
  From Your Spec Code:
      at Context.eval (https://example.site/__cypress/tests?p=tests\cypress\support\index.js:291:13)

More than this, i haven't...

cypress\support\index.js

before(() => {
    cy.task('activateCypressEnvFile', {}, { log: false });
    cy.artisan('config:clear', {}, { log: false });

    cy.refreshRoutes();
});

after(() => {
    cy.task('activateLocalEnvFile', {}, { log: false });
    cy.artisan('config:clear', {}, { log: false });
});

Specs cypress: 7.4.0 Laravel 8 node 14 vuejs 2.6.12

Desired behavior

No response

Test code to reproduce

Inhouse Repo

Cypress Version

7.4.0

Other

No response

Vladislavvk1337 commented 2 years ago

Got it..

It was the VS Code Terminal. For whatever reason, the VS Code terminal cant execute Cypress properly. I execute Cypress outside of VS Code in CMD oder Powershell and its works!

YakovL commented 1 year ago

it may have been an internet connection issue, like it was for me