meinaart / cypress-plugin-snapshots

Plugin for snapshot tests in Cypress.io
MIT License
497 stars 118 forks source link

cypress-plugin-snapshots does not support headless mode #176

Open tchiaspko opened 3 years ago

tchiaspko commented 3 years ago

Describe the bug Using cypress with --headless works fine on jenkins However adding cypress-plugin-snapshots causes the following error on jenkins


resize:  can't open terminal /dev/tty
tput: No value for $TERM and no -T specified
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! @spokeo/styleguide@0.0.5 test:run-cypress: `cypress run --headless`
npm ERR! Exit status 2

Manually executing the test on laptop or when ssh into the jenkins slave works fine because there is an interactive shell session. However when it's auto executed with on jenkins it doesn't have interactive session.

I have tried to add $TERM and $DISPLAY env var but it stil it doesn't work

When I logged in to jenkins, TERM is set to xterm-256color so I put that in the Jenkinsfile. It got rid of the "tput: No value for $TERM and no -T specified" but still it has "resize: can't open terminal /dev/tty"

cypress was executed with --headless and works fine without this plugin

To Reproduce Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

FrankL-git commented 11 months ago

I had the same output of resize and tput when running cypress in headless mode via crontab on linux. But no plugin has been used in cypress. It seems that a call to resize is done if one of the environment variables COLUMNS or LINES is not set. After calling my cronjob in this way:

47 * * * * export TERM=xterm && export COLUMNS=80 && export LINES=80 && my.sh

both error messages vanished. Perhaps that might help.