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

Not working when cypress run #160

Closed
andrewaldasoro opened this issue Aug 4, 2022 · 10 comments
Closed

Not working when cypress run #160

andrewaldasoro opened this issue Aug 4, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@andrewaldasoro
Copy link

andrewaldasoro commented Aug 4, 2022

When we use outputTarget: cypress-log.json the file is being created but it overwrites it in between every test.
If we use outputTarget: cypress-log|json the file is not being created

We have some some scripts to run cypress in our package.json

{
 "cypress:open": "cypress open",
  "cypress:run": "cypress run",
} 

with cypress:open the directory form it's working fine, but not with cypress:run

@andrewaldasoro
Copy link
Author

The configuration:

const options = {
    outputRoot: config.projectRoot + "/logs/",
    specRoot: "cypress/e2e",
    outputTarget: {
      "cypress-logs|json": "json",
    },
    printLogsToFile: "always",
    printLogsToConsole: "onFail",
  };
  require("cypress-terminal-report/src/installLogsPrinter")(on, options);

@archfz
Copy link
Owner

archfz commented Aug 5, 2022

Please also post the version of the plugin and of cypress.

@andrewaldasoro
Copy link
Author

4.1.1

@archfz
Copy link
Owner

archfz commented Aug 5, 2022

And cypress version?

@andrewaldasoro
Copy link
Author

10.3.1

@archfz
Copy link
Owner

archfz commented Aug 5, 2022

I cannot reproduce this issue. Both single file output and nested outputs work correctly.

Maybe more details could help, like what browser are the tests running in? is it reproducing locally and in pipelines as well? do you use any other plugins? what are your support install options? or can you maybe provide a reproducible setup (issue repo link)?

If you know how to use the nodejs debugger you could also do your own investigation: starting with a breakpoint here https://github.com/archfz/cypress-terminal-report/blob/master/src/installLogsPrinter.js#L107

@harithavupputuru
Copy link

harithavupputuru commented Aug 8, 2022

Browser : chrome
Reproducing locally as well as in pipelines.
We are using cypress-grep plugin too.
Plugin configuration in support/e2e.ts:

import registerCypressGrep from "cypress-grep";
import registerCypressLogCollector, {
  SupportOptions,
} from "cypress-terminal-report/src/installLogsCollector";
registerCypressGrep();
const options: SupportOptions = {
  collectTypes: ["cy:log", "cy:command"],
  enableContinuousLogging: false,
  enableExtendedCollector: false,
  debug: false,
};
registerCypressLogCollector(options);

@archfz
Copy link
Owner

archfz commented Aug 8, 2022

@harithavupputuru There must be something else going on. I have attempted unsuccessfully to reproduce based on the options from the comments, using chrome (Ubuntu). See here https://github.com/archfz/cypress-terminal-report-demo/pull/6/files

Can you check if it is working correctly for you on that branch? Maybe report back if you seem some critical difference in configuration.

@harithavupputuru
Copy link

With above configuration:
Logs generated for command -> cypress run configFile=smoke --browser chrome
Log not generated for command -> cypress run --env grepTags="smoke" configFile=smoke --browser chrome

@archfz archfz added the bug Something isn't working label Aug 12, 2022
@archfz
Copy link
Owner

archfz commented Aug 12, 2022

Fix released in 4.1.2

@archfz archfz closed this as completed Aug 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants