Skip to content

watchForFileChanges during cypress run and rerun tests #3665

@delucca

Description

@delucca

Current behavior:

The command cypress run is not watching for file changes. Even if I set it on the cypress.json. If I run only successful tests, I got the following output on terminal:

> cypress run

===================

  (Run Starting)

  ┌───────────────────────┐
  │ Cypress:    3.1.5                                                    │
  │ Browser:    Electron 59 (headless)                        │
  │ Specs:      1 found (Loader.test.js)                        │
  └───────────────────────┘


─────────
                                                                                                    
  Running: Loader.test.js...                                                               (1 of 1) 


  BIG DESKTOPS: Loader
    ✓ It should be a fullscreen loader with a purple background (963ms)


  1 passing (1s)


  (Results)

  ┌─────────────┐
  │ Tests:        1                        │
  │ Passing:      1                      │
  │ Failing:      0                        │
  │ Pending:      0                      │
  │ Skipped:      0                      │
  │ Screenshots:  0                   │
  │ Video:        true                    │
  │ Duration:     1 second          │
  │ Spec Ran:     Loader.test.js │
  └─────────────┘


  (Video)

  - Started processing:   Compressing to 32 CRF
  - Finished processing:  /home/odelucca/Servers/yurah/v2/frontends/admin/cypress/videos/Loader.test.js.mp4 (0 seconds)


======================

  (Run Finished)


      Spec                                                Tests  Passing  Failing  Pending  Skipped 
  ┌────────────────────────────────┐
  │ ✔ Loader.test.js                            00:01        1        1        -        -        - │
  └────────────────────────────────┘
    All specs passed!                           00:01        1        1        -        -        -  

➜  admin git:(develop) ✗ 

Then, it exits

If any of the tests fails, I got the following:

> cypress run


====================

  (Run Starting)

  ┌──────────────────────────────┐
  │ Cypress:    3.1.5                                                                              │
  │ Browser:    Electron 59 (headless)                                                  │
  │ Specs:      1 found (Loader.test.js)                                                  │
  └──────────────────────────────┘


──────────────────────────────────
                                                                                                    
  Running: Loader.test.js...                                                               (1 of 1) 


  BIG DESKTOPS: Loader
    1) It should be align the loader to center horizontally and vertically


  0 passing (1s)
  1 failing

  1) BIG DESKTOPS: Loader It should be align the loader to center horizontally and vertically:

      AssertionError: expected 845 to equal 450
      + expected - actual

      -845
      +450
      
      at callback (http://localhost:3000/__cypress/runner/cypress_runner.js:54247:20)
      at getRet (http://localhost:3000/__cypress/runner/cypress_runner.js:53986:16)
      at tryCatcher (http://localhost:3000/__cypress/runner/cypress_runner.js:127195:23)
      at Function.Promise.attempt.Promise.try (http://localhost:3000/__cypress/runner/cypress_runner.js:124569:29)
      at thenFn (http://localhost:3000/__cypress/runner/cypress_runner.js:54000:26)
      at yieldItem (http://localhost:3000/__cypress/runner/cypress_runner.js:54253:16)
      at tryCatcher (http://localhost:3000/__cypress/runner/cypress_runner.js:127195:23)
      at Object.gotValue (http://localhost:3000/__cypress/runner/cypress_runner.js:126383:18)
      at Object.gotAccum (http://localhost:3000/__cypress/runner/cypress_runner.js:126372:25)
      at Object.tryCatcher (http://localhost:3000/__cypress/runner/cypress_runner.js:127195:23)
      at Promise._settlePromiseFromHandler (http://localhost:3000/__cypress/runner/cypress_runner.js:125213:31)
      at Promise._settlePromise (http://localhost:3000/__cypress/runner/cypress_runner.js:125270:18)
      at Promise._settlePromiseCtx (http://localhost:3000/__cypress/runner/cypress_runner.js:125307:10)
      at Async._drainQueue (http://localhost:3000/__cypress/runner/cypress_runner.js:122124:12)
      at Async._drainQueues (http://localhost:3000/__cypress/runner/cypress_runner.js:122129:10)
      at Async.drainQueues (http://localhost:3000/__cypress/runner/cypress_runner.js:122003:14)




  (Results)

  ┌─────────────┐
  │ Tests:        1                         │
  │ Passing:      0                       │
  │ Failing:      1                         │
  │ Pending:      0                       │
  │ Skipped:      0                       │
  │ Screenshots:  1                    │
  │ Video:        true                     │
  │ Duration:     1 second           │
  │ Spec Ran:     Loader.test.js  │
  └─────────────┘


  (Screenshots)

  - /home/odelucca/Servers/yurah/v2/frontends/admin/cypress/screenshots/Loader.test.js/BIG DESKTOPS Loader -- It should be align the loader to center horizontally and vertically (failed).png (1280x720)


  (Video)

  - Started processing:   Compressing to 32 CRF
  - Finished processing:  /home/odelucca/Servers/yurah/v2/frontends/admin/cypress/videos/Loader.test.js.mp4 (0 seconds)


======================

  (Run Finished)


      Spec                                                Tests  Passing  Failing  Pending  Skipped 
  ┌────────────────────────────────┐
  │ ✖ Loader.test.js                            00:01        1        -        1        -        - │
  └────────────────────────────────┘
    1 of 1 failed (100%)                        00:01        1        -        1        -        -  

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! admin@0.1.0 cy:run: `cypress run`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the admin@0.1.0 cy:run script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/odelucca/.npm/_logs/2019-03-07T13_50_22_294Z-debug.log
➜  admin git:(develop) ✗ 

Desired behavior:

It should be waiting for file changes and re run all tests if there is any change

Steps to reproduce: (app code and test code)

Just run cypress run

Versions

Cypress version: 3.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    E2EIssue related to end-to-end testingtype: featureNew feature that does not currently exist

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions