Cypress test runner is not instantly running when

2019-08-06 04:48发布

Cypress test runner is not instantly running when the 'example-spec.js' is modified/changed. The versions of test runners are Chrome 68 and Electron 59 in cypress. cypress installed version is 3.1.0. Also using the atom.js editor. The desktop machine is Windows 8.1 Pro

From the command prompt, first I run this command to go to this directory'cd C:\node_modules.bin ' Then run 'cypress open'. This will open the cypress app.

Folder directory below and screenshot added

C:\node_modules.bin\cypress\integration\examples\example-spec.js

Inside the app Settings > Configuration > json settings given below

{
    animationDistanceThreshold: 5,
    baseUrl: null,
    blacklistHosts: null,
    chromeWebSecurity: true,
    defaultCommandTimeout: 4000,
    env: {},
    execTimeout: 60000,
    fileServerFolder: '',
    fixturesFolder: 'cypress/fixtures',
    hosts: null,
    integrationFolder: 'cypress/integration',
    modifyObstructiveCode: true,
    numTestsKeptInMemory: 50,
    pageLoadTimeout: 60000,
    pluginsFile: 'cypress/plugins',
    port: null,
    reporter: 'spec',
    reporterOptions: null,
    requestTimeout: 5000,
    responseTimeout: 30000,
    screenshotsFolder: 'cypress/screenshots',
    supportFile: 'cypress/support',
    taskTimeout: 60000,
    testFiles: '**/*.*',
    trashAssetsBeforeRuns: true,
    userAgent: null,
    video: true,
    videoCompression: 32,
    videoUploadOnPasses: true,
    videosFolder: 'cypress/videos',
    viewportHeight: 660,
    viewportWidth: 1000,
    waitForAnimations: true,
    watchForFileChanges: true}

enter image description here

1条回答
SAY GOODBYE
2楼-- · 2019-08-06 05:15

It looks like you are modifying a test file within the Cypress installation. This is probably not what you meant to do.

There are two important components to Cypress:

  1. The Cypress package installation. In your case this is installed at c:\node_modules\.bin\cypress
  2. The Project under test also has some Cypress related files, including cypress.json in the top level directory of the project, and the test files located in the cypress folder within the project directory (unless you have told Cypress to use a different directory).

When you run Cypress tests on a project, the test files which are watched are those that are located within the project directory - not those within the Cypress installation itself.

When you run cypress open then you can manually select the directory of the project that you want to test, say it is C:\MY_PROJECT. If there is no cypress.json file and no tests found, Cypress will automatically create a cypress.json file and a cypress directory within C:\MY_PROJECT. Inside the C:\MY_PROJECT\cypress\integration\ directory will be some example tests. When you edit tests in this directory with watchForFileChanges=true and manually choosing C:\MY_PROJECT to test, they will automatically rerun when saved.

I have also tested running and modifying the tests in the example directory within the Cypress package within the node_modules directory. I can confirm that when files within that directory are edited, the tests do not rerun. However, it is a mistake to edit those files when you are trying to test one of your own projects.

HTH

查看更多
登录 后发表回答