percy / percy-nightwatch

Visual testing with Nightwatch and Percy
https://percy.io
MIT License
6 stars 9 forks source link

Compatibility with Nightwatch 2.0 #370

Closed pfmchugh closed 2 years ago

pfmchugh commented 2 years ago

The problem

The latest version doesn't see to be compatible with Nightwatch 2.0.x. After updating nightwatch to 2.0.10 and running tests with percy locally, I get the following error when attempting to use browser.percySnapshot

[percy:nightwatch] Could not take DOM snapshot "Business Pro Home" (9655ms)
[percy:nightwatch] TypeError: Cannot read property 'domSnapshot' of undefined

Environment

Debug logs

[percy:config] Found config file: .percy.yml (0ms)
[percy:config] Using config:
{
  version: 2,
  snapshot: {
    widths: [
      375,
      1280
    ],
    minHeight: 1024,
    percyCSS: ''
  },
  discovery: {
    networkIdleTimeout: 100
  },
  static: {
    cleanUrls: false
  },
  upload: {
    files: '**/*.{png,jpg,jpeg}',
    ignore: '',
    stripExtensions: false
  }
} (19ms)
[percy:core:install] Successfully downloaded Chromium 885282 (9794ms)
[percy:core:browser] Launching browser (18ms)
[percy:core:browser] Browser connected [107868]: HeadlessChrome/92.0.4515.0 (496ms)
[percy:core] Percy has started! (4ms)
[percy:cli:exec] Running "npx nightwatch -c config/nightwatch.conf.js -e chrome" (0ms)

... Nightwatch Tests ...

[percy:nightwatch] Could not take DOM snapshot "Business Pro Home" (9655ms)
[percy:nightwatch] TypeError: Cannot read property 'domSnapshot' of undefined
    at CommandInstance.command (C:\...\node_modules\@percy\nightwatch\commands\percySnapshot.js:22:22)
    at processTicksAndRejections (internal/process/task_queues.js:93:5) (0ms)

Code to reproduce issue

To replicate, you can clone the example repo, upgrade Nightwatch to 2.0.10, then try to run the test after setting the PERCY_TOKEN

suk-acquia commented 2 years ago

I had the same issue. After seeing this, I downgraded my nightwatch version to 1.7.13 and it works now.

Robdel12 commented 2 years ago

Closed with #390. ~Will be shipping soon~

Edit: shipped in v2.1.0 https://github.com/percy/percy-nightwatch/releases/tag/v2.1.0