@percy/nightwatch 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -19,15 +19,18 @@ module.exports = class PercySnapshotCommand {
19
19
 
20
20
  // Serialize and capture the DOM
21
21
  /* istanbul ignore next: no instrumenting injected code */
22
- let { value: { domSnapshot, url } } = (
23
- await this.api.execute(function(options) {
22
+ let { domSnapshot, url } = await new Promise((resolve) => {
23
+ this.api.execute(function(options) {
24
24
  return {
25
25
  /* eslint-disable-next-line no-undef */
26
26
  domSnapshot: PercyDOM.serialize(options),
27
27
  url: document.URL
28
28
  };
29
- }, [options])
30
- );
29
+ }, [options], function(result) {
30
+ // Check if we're in Nightwatch 1.x (which returns with `.value`)
31
+ result.value ? resolve(result.value) : resolve(result);
32
+ });
33
+ });
31
34
 
32
35
  // Post the DOM to the snapshot endpoint with snapshot options and other info
33
36
  await utils.postSnapshot({
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@percy/nightwatch",
3
3
  "description": "Nightwatch client library for visual testing with Percy",
4
- "version": "2.0.1",
4
+ "version": "2.1.0",
5
5
  "license": "MIT",
6
6
  "author": "Perceptual Inc.",
7
7
  "repository": "https://github.com/percy/percy-nightwatch",
@@ -21,7 +21,7 @@
21
21
  },
22
22
  "scripts": {
23
23
  "lint": "eslint --ignore-path .gitignore .",
24
- "test": "nightwatch",
24
+ "test": "MOZ_HEADLESS=1 nightwatch",
25
25
  "test:coverage": "nyc yarn test",
26
26
  "test:types": "tsd"
27
27
  },
@@ -29,7 +29,7 @@
29
29
  "@percy/sdk-utils": "^1.0.0"
30
30
  },
31
31
  "peerDependencies": {
32
- "nightwatch": "~1"
32
+ "nightwatch": ">=1"
33
33
  },
34
34
  "devDependencies": {
35
35
  "@percy/core": "^1.0.0",
@@ -42,8 +42,8 @@
42
42
  "eslint-plugin-standard": "^5.0.0",
43
43
  "expect": "^27.0.2",
44
44
  "geckodriver": "^3.0.1",
45
- "mocha": "^9.0.0",
46
- "nightwatch": "^1.5.1",
45
+ "mocha": "^10.0.0",
46
+ "nightwatch": "^2.1.3",
47
47
  "nyc": "^15.1.0",
48
48
  "tsd": "^0.20.0"
49
49
  }