I have enabled the "experimentalInteractiveRunEvents": true in cypress.json to run the after:spec event of cypress-testRail-simple plugin through cypress IDE.

link for plugin : https://github.com/bahmutov/cypress-testrail-simple.git

I am using this event in cypress-testRail-simple's plugin.js file.

enter image description here

I have defined plugin in plugins -> index.js enter image description here

enabled the flag in cypress.json file:

enter image description here

I have multiple spec files.

When running through command line : npx cypress run

after:spec - getting called after all the spec run finish.

When running through cypress IDE : npx cypress open

after:spec - called zero time

reference : how to run the cypress in interactive mode with flag enabled

1

There are 1 best solutions below

2
Fody On

There's a fundamental difference between npx cypress open (interactive mode) and npx cypress run (command line mode).

Interactive mode

All the specs are run as in a single continuous run, as if they had been written as one spec. Because of this, before:spec is called only one.

Command line mode

All specs are run as separate runs, hence two calls to before:spec.


From After Spec API

When running cypress via cypress open, the event will fire when the browser closes.