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

Error [object Object] on node_modules/cypress-visual-regression/dist/command.js:33 #50

Closed
skjnldsv opened this issue Aug 25, 2020 · 15 comments

Comments

@skjnldsv
Copy link
Contributor

Hi, I'm having an error, but the logs are not helpful.
Snapshots files are in the base folder, diffs are not generated.

Cypress version 5.0.0.
Node version 10.x

Capture d’écran_2020-08-25_17-52-27

Error: [object Object]
    at Context.eval (http://localhost:36223/__cypress/tests?p=cypress/support/index.js:507:17)
From previous event:
    at Context.thenFn (http://localhost:36223/__cypress/runner/cypress_runner.js:154868:26)
    at Context.then (http://localhost:36223/__cypress/runner/cypress_runner.js:155308:21)
    at Context.<anonymous> (http://localhost:36223/__cypress/runner/cypress_runner.js:168808:21)
    at http://localhost:36223/__cypress/runner/cypress_runner.js:168241:15
From previous event:
    at runCommand (http://localhost:36223/__cypress/runner/cypress_runner.js:168220:8)
    at next (http://localhost:36223/__cypress/runner/cypress_runner.js:168366:14)
    at http://localhost:36223/__cypress/runner/cypress_runner.js:168394:16
From previous event:
    at next (http://localhost:36223/__cypress/runner/cypress_runner.js:168366:34)
From previous event:
    at http://localhost:36223/__cypress/runner/cypress_runner.js:168407:37
From previous event:
    at run (http://localhost:36223/__cypress/runner/cypress_runner.js:168400:19)
    at $Cy.cy.<computed> [as window] (http://localhost:36223/__cypress/runner/cypress_runner.js:168852:11)
    at Context.runnable.fn (http://localhost:36223/__cypress/runner/cypress_runner.js:169078:21)
    at callFn (http://localhost:36223/__cypress/runner/cypress_runner.js:103957:21)
    at Test.../driver/node_modules/mocha/lib/runnable.js.Runnable.run (http://localhost:36223/__cypress/runner/cypress_runner.js:103944:7)
    at http://localhost:36223/__cypress/runner/cypress_runner.js:174727:28
From previous event:
    at Object.onRunnableRun (http://localhost:36223/__cypress/runner/cypress_runner.js:174715:20)
    at $Cypress.action (http://localhost:36223/__cypress/runner/cypress_runner.js:165051:61)
    at Test.Runnable.run (http://localhost:36223/__cypress/runner/cypress_runner.js:173050:13)
    at Runner.../driver/node_modules/mocha/lib/runner.js.Runner.runTest (http://localhost:36223/__cypress/runner/cypress_runner.js:104616:10)
    at http://localhost:36223/__cypress/runner/cypress_runner.js:104742:12
    at next (http://localhost:36223/__cypress/runner/cypress_runner.js:104525:14)
    at http://localhost:36223/__cypress/runner/cypress_runner.js:104535:7
    at next (http://localhost:36223/__cypress/runner/cypress_runner.js:104437:14)
    at http://localhost:36223/__cypress/runner/cypress_runner.js:104503:5
    at timeslice (http://localhost:36223/__cypress/runner/cypress_runner.js:98429:27)
logError @ cypress_runner.js:199987
(anonymous) @ cypress_runner.js:199628
emit @ cypress_runner.js:51075
(anonymous) @ cypress_runner.js:183967
emit @ cypress_runner.js:51075
emit @ cypress_runner.js:184010
onPrint @ cypress_runner.js:182829
_onPrintClick @ cypress_runner.js:182834
(anonymous) @ cypress_runner.js:184221
executeAction @ cypress_runner.js:48940
n @ cypress_runner.js:48940
ca @ cypress_runner.js:59472
ja @ cypress_runner.js:59473
ka @ cypress_runner.js:59473
wa @ cypress_runner.js:59475
Aa @ cypress_runner.js:59476
ya @ cypress_runner.js:59476
Da @ cypress_runner.js:59479
Ad @ cypress_runner.js:59542
Gi @ cypress_runner.js:59708
Kb @ cypress_runner.js:59497
Dd @ cypress_runner.js:59544
(anonymous) @ cypress_runner.js:59709
../../node_modules/scheduler/cjs/scheduler.production.min.js.exports.unstable_runWithPriority @ cypress_runner.js:63856
Ii @ cypress_runner.js:59709
Cd @ cypress_runner.js:59543

cypress.json:

{
  "projectId": "3paxvy",
  "viewportWidth": 1920, 
  "viewportHeight": 1080,
  "defaultCommandTimeout": 6000,
  "experimentalComponentTesting": true,
  "componentFolder": "tests/visual",
  "nodeVersion": "system",
  "env": {
    "failSilently": false,
    "type": "actual"
  },
  "screenshotsFolder": "cypress/snapshots/actual",
  "trashAssetsBeforeRuns": true
}
@skjnldsv
Copy link
Contributor Author

Found the issue, it happens when the filename contains newlines and/or tabs.

@gabbersepp
Copy link
Contributor

gabbersepp commented Aug 26, 2020

Hi, I stumbled across another error and also found no helpful error in the log. After investigating a bit I found out that reject(new Error(...)) does not work while reject(...) leads to a error message in the log. The reject for my issue is found in plugin.js [parseImage].

Not sure why rejecting an Error leads leads to a corrupt error message in the log. maybe here a similar situation is responsible for the wrong "Error [object Object]" log.

@fabriciols
Copy link

I had the same exception, and my filenames are fine

image

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Aug 27, 2020

@fabriciols @gabbersepp it also does this if you don't have the base files in snapshots/base

@mjhea0
Copy link
Collaborator

mjhea0 commented Aug 27, 2020

@skjnldsv yes, so I think that by sanitizing the file names it will actually display this in the log since it won't be able to find the file: Error: [object Object].

My guess is that it's blowing up somewhere else, causing the error to be caught somewhere where it's not being handled correctly with new Error(...).

@mjhea0
Copy link
Collaborator

mjhea0 commented Aug 27, 2020

Can you fix the broken build for your PR @skjnldsv. I'm curious to see the results of this.

https://travis-ci.org/github/mjhea0/cypress-visual-regression/builds/721099784

@skjnldsv
Copy link
Contributor Author

Can you fix the broken build for your PR @skjnldsv. I'm curious to see the results of this.

I have no ideas on how to fix this. My pr properly include the required deps, If the tests uses different ones, maybe the travis workflow should be adapted to use the dependencies from cypress-visual-regression ?

@mjhea0
Copy link
Collaborator

mjhea0 commented Aug 27, 2020

After investigating a bit I found out that reject(new Error(...)) does not work while reject(...) leads to a error message in the log. .

@gabbersepp reject needs to take an error object. It won't work if you pass a string to it. My guess is that it's blowing up somewhere else and sending a non-error object to reject which causes it to display Error: [object Object].

@mjhea0
Copy link
Collaborator

mjhea0 commented Aug 27, 2020

Can you fix the broken build for your PR @skjnldsv. I'm curious to see the results of this.

I have no ideas on how to fix this. My pr properly include the required deps, If the tests uses different ones, maybe the travis workflow should be adapted to use the dependencies from cypress-visual-regression ?

Ok. I'll look into it.

@mjhea0
Copy link
Collaborator

mjhea0 commented Aug 27, 2020

changes: 24dc726

@skjnldsv

do you want to incorporate into your pr?

also, i'd like to add a few quick test cases. what's an example of a filename on your end that's causing it to break?

@skjnldsv
Copy link
Contributor Author

also, i'd like to add a few quick test cases. what's an example of a filename on your end that's causing it to break?

Thanks :)
here you go:

https://github.com/nextcloud/nextcloud-vue/blob/27c0c29302e57e3a9a03b2e9547a9995ca39faa3/tests/visual/components/AppSidebar/AppSidebar.visual.js#L71-L76

					const fileName = `AppSidebar.vue
						 - starred_${star === null ? 'null' : star ? 'true' : 'false'}
						 - compact_${comp ? 'true' : 'false'}
						 - header_${head ? 'image' : 'none'}
						 - secondary_${second ? 'button' : 'none'}
					`

@mjhea0
Copy link
Collaborator

mjhea0 commented Aug 28, 2020

@skjnldsv

is this correct?

  1. AppSidebar.vue-starred_null
  2. AppSidebar.vue-compact_false
  3. AppSidebar.vue-header_none
  4. AppSidebar.vue-secondary_none

@mjhea0
Copy link
Collaborator

mjhea0 commented Sep 6, 2020

@skjnldsv none of those names break the test. I'm going to hold off on merging #56 for now.

@mjhea0 mjhea0 mentioned this issue Sep 6, 2020
@skjnldsv
Copy link
Contributor Author

skjnldsv commented Sep 7, 2020

@skjnldsv none of those names break the test. I'm going to hold off on merging #56 for now.

No, you need breaklines in the string.

@skjnldsv
Copy link
Contributor Author

skjnldsv commented Sep 7, 2020

					const fileName = `AppSidebar.vue
						 - starred_${star === null ? 'null' : star ? 'true' : 'false'}
						 - compact_${comp ? 'true' : 'false'}
						 - header_${head ? 'image' : 'none'}
						 - secondary_${second ? 'button' : 'none'}
					`

This is only one string. This is using the new es6 multi line template string feature.

@mjhea0 mjhea0 closed this as completed Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants