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

After Cypress version migration, cypress-terminal-report no longer prints console output on failure #197

Closed
SketchParker opened this issue Jul 5, 2023 · 9 comments
Labels
bug Something isn't working

Comments

@SketchParker
Copy link

Following up after #194, I've found that while it appeared as if things were working okay, CTR is no longer printing the verbose failure messages while running headless.

The most recent version of CTR is installed using npm install cypress-terminal-report, and other plugins such as cypress-axe are working okay.

In my e2e.js file, I have the following:

const { defineConfig } = require("cypress");

module.exports = defineConfig({
  env: {
//snipped my env variables
  },
  defaultCommandTimeout: 6000,
  pageLoadTimeout: 6000,
  viewportHeight: 900,
  viewportWidth: 1440,
  chromeWebSecurity: false,
  modifyObstructiveCode: false,
  numTestsKeptInMemory: 20,
  videoUploadOnPasses: false,
  e2e: {
    setupNodeEvents(on, config) {
      return require("cypress-terminal-report/src/installLogsPrinter")(on);
    },
  },
});

In my e2e file, I have the following:

require('cypress-terminal-report/src/installLogsCollector')();

I'm not seeing why it's not working, any help would be appreciated.

@devurandom
Copy link

devurandom commented Jul 6, 2023

Which version of Cypress are you using? Which version of cypress-terminal-report?

I am running docker.io/cypress/browsers:node-16.18.1-chrome-110.0.5481.96-1-ff-109.0-edge-110.0.1587.41-1 with cypress-terminal-report@^4.1.3 and have:

// cypress/support/e2e.ts
...
installLogsCollector({
  enableExtendedCollector: true,
  xhr: { printRequestData: true, printHeaderData: true },
});
...
// cypress.config.ts
export default defineConfig({
  e2e: {
    ...
    setupNodeEvents(on, config) {
      installLogsPrinter(on);
      ...
// the test file
...
describe("account", () => {
  before(() => {
    console.log("TEST TEST TEST");
  });
  ...

But I do not see the TEST TEST TEST output.

@devurandom
Copy link

devurandom commented Jul 6, 2023

I think we might be facing #67. console.log output is not supported by cypress-terminal-report.

@SketchParker
Copy link
Author

Cypress Version: 12.16.0

CTR version: 5.3.0

Currently no console/network tab output is displayed on failure while running headless, it's as if CTR doesn't exist. But, afaik it's set up properly. For example, here's some output with failures while running headless:

    ✓ updates listed results to accomodate several filters (1796ms)
    1) further refines a filter by adding a subcategory
    2) only displays one result for strictly filtered content
    3) can remove an overarching filter category, which also removes refinements to the same category
    ✓ does not display irrelevant results in rule system search (5587ms)

These numbered failures usually provide verbose messaging.

@casalribeiro
Copy link

To me what happens is that when updating to version 5.3.0 I start getting the following message when I have @ignored tests:

If I downgrade to 5.2.0 it works.

I simply place a @Focus tag in a test inside a feature file to ignore the others, and then I get that error.

 <failure message="utils2.nonQueueTask is not a function

Because this error occurred during a `after each` hook we are skipping all of the remaining tests." type="TypeError"><![CDATA[TypeError: utils2.nonQueueTask is not a function

Because this error occurred during a `after each` hook we are skipping all of the remaining tests.
    at LogCollectSimpleControl.sendLogsToPrinter 
</failure>

@archfz archfz added the bug Something isn't working label Jul 7, 2023
@archfz
Copy link
Owner

archfz commented Jul 7, 2023

Release a fix for this in 5.3.1 Please verify and report back.

@SketchParker
Copy link
Author

Thanks @archfz for addressing, however after upgrading to 5.3.1, all Cypress tests fail outright with

> Cannot assign to read only property 'exports' of object '#<Object>'

This failure happens before tests start, fully blocking runs

@archfz
Copy link
Owner

archfz commented Jul 7, 2023

An ESM import was left in the code. Check with 5.3.2

@SketchParker
Copy link
Author

It looks like I'm now getting verbose reporting!

However, not all failed tests are providing verbose reporting. For example, in one test series I have one test fail without verbose reporting, and another fail that does provide it right after:

 ✓ can apply the search term after the filter has been applied (1319ms)
 ✓ can search for a system as a subcategory (12027ms)
 ✓ applies the system subcategory filter (1606ms)
 ✓ updates listed results to accomodate several filters (1772ms)
 1) further refines a filter by adding a subcategory                         //no CTR output here?
 2) only displays one result for strictly filtered content
      cy:command ✔  get	[data-cy="addFacet-Format"]
      cy:command ✔  scrollIntoView	
      cy:command ✔  get	[data-cy="addFacet-Format"]
      cy:command ✘  assert	expected **<table.filter-block>** to be **visible**

I'm not sure why some are printing while others aren't, but overall I can confirm cypress-terminal-report is printing output in headless.

Should I open a new ticket for this leftover issue?

@archfz
Copy link
Owner

archfz commented Jul 10, 2023

Closing this. Please open new issue and try to add a reproducible example / fork of demo.

@archfz archfz closed this as completed Jul 10, 2023
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

4 participants