@applitools/eyes-storybook 3.35.0 → 3.36.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.
package/CHANGELOG.md CHANGED
@@ -4,6 +4,82 @@
4
4
 
5
5
 
6
6
 
7
+ ## [3.36.0](https://github.com/applitools/eyes.sdk.javascript1/compare/js/eyes-storybook-v3.35.1...js/eyes-storybook@3.36.0) (2023-07-05)
8
+
9
+
10
+ ### Features
11
+
12
+ * added support for storybook installed in parent module ([#1060](https://github.com/applitools/eyes.sdk.javascript1/issues/1060)) ([e2b9fbb](https://github.com/applitools/eyes.sdk.javascript1/commit/e2b9fbbb41938b2363a2c675874ad28e41859076))
13
+ * support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * @applitools/core bumped from 3.4.0 to 3.5.0
19
+ #### Features
20
+
21
+ * added auto applitools lib detection ([#1707](https://github.com/applitools/eyes.sdk.javascript1/issues/1707)) ([7d439b5](https://github.com/applitools/eyes.sdk.javascript1/commit/7d439b52af55f3b0596c9d35d6ba85c717448023))
22
+ * support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
23
+
24
+
25
+ #### Bug Fixes
26
+
27
+ * some fix ([660a137](https://github.com/applitools/eyes.sdk.javascript1/commit/660a1376a49dd28f8f399690502cd3d1f77665fa))
28
+
29
+
30
+
31
+ * @applitools/core-base bumped from 1.2.1 to 1.3.0
32
+ #### Features
33
+
34
+ * support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
35
+
36
+
37
+
38
+ * @applitools/req bumped from 1.3.3 to 1.4.0
39
+ #### Features
40
+
41
+ * support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
42
+ * @applitools/driver bumped from 1.12.4 to 1.13.0
43
+ #### Features
44
+
45
+ * added auto applitools lib detection ([#1707](https://github.com/applitools/eyes.sdk.javascript1/issues/1707)) ([7d439b5](https://github.com/applitools/eyes.sdk.javascript1/commit/7d439b52af55f3b0596c9d35d6ba85c717448023))
46
+ * @applitools/ec-client bumped from 1.5.0 to 1.6.0
47
+ #### Features
48
+
49
+ * added support of regional execution cloud servers ([#1711](https://github.com/applitools/eyes.sdk.javascript1/issues/1711)) ([2e26c69](https://github.com/applitools/eyes.sdk.javascript1/commit/2e26c6944bb15f6121fb37c1dba95aba162c1f6a))
50
+ * support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
51
+
52
+
53
+ #### Bug Fixes
54
+
55
+ * fixed auto tunnel cleanup after unexpected end of the process ([3c1ad08](https://github.com/applitools/eyes.sdk.javascript1/commit/3c1ad0837d2d3560becc6d89370aa878becb3270))
56
+
57
+
58
+
59
+ * @applitools/tunnel-client bumped from 0.1.1 to 1.0.0
60
+ #### Features
61
+
62
+ * added binaries and made them available in jfrog ([92033fe](https://github.com/applitools/eyes.sdk.javascript1/commit/92033fed7edc58bbc4a4e37269068418fe3afc3d))
63
+ * release as 1.0.0 ([93bf312](https://github.com/applitools/eyes.sdk.javascript1/commit/93bf31205b07d19bc2cb4f50b974c7bad0f49cea))
64
+
65
+
66
+
67
+ * @applitools/ufg-client bumped from 1.2.22 to 1.3.0
68
+ #### Features
69
+
70
+ * support dns caching ([#1680](https://github.com/applitools/eyes.sdk.javascript1/issues/1680)) ([9bbff34](https://github.com/applitools/eyes.sdk.javascript1/commit/9bbff34f50c9d18758b55a6bcb45571ca1148180))
71
+
72
+
73
+
74
+ * @applitools/spec-driver-webdriver bumped from 1.0.36 to 1.0.37
75
+
76
+ * @applitools/nml-client bumped from 1.5.0 to 1.5.1
77
+
78
+ * @applitools/screenshoter bumped from 3.8.1 to 3.8.2
79
+
80
+ * @applitools/spec-driver-puppeteer bumped from 1.1.67 to 1.1.68
81
+
82
+
7
83
  ## 3.35.0 - 2023/6/13
8
84
 
9
85
  ### Features
package/README.md CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-storybook",
3
- "version": "3.35.0",
3
+ "version": "3.36.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "applitools",
@@ -18,12 +18,7 @@
18
18
  },
19
19
  "license": "SEE LICENSE IN LICENSE",
20
20
  "author": "Applitools Team <team@applitools.com>",
21
- "aliases": [
22
- "storybook"
23
- ],
24
- "bin": {
25
- "eyes-storybook": "./bin/eyes-storybook.js"
26
- },
21
+ "bin": "./bin/eyes-storybook.js",
27
22
  "files": [
28
23
  "src",
29
24
  "bin",
@@ -34,14 +29,13 @@
34
29
  "build": "rollup -c rollup.config.js",
35
30
  "build:heavy": "node scripts/bitmap.js",
36
31
  "test": "yarn build && yarn test:mocha && yarn lint",
37
- "test:sanity": "yarn test:unit && yarn test:it",
38
32
  "test:mocha": "mocha --no-timeouts --trace-warnings 'test/{unit,it,e2e}/*.test.js'",
39
33
  "test:unit": "mocha --no-timeouts --trace-warnings 'test/unit/*.test.js'",
40
34
  "test:it": "mocha --no-timeouts --trace-warnings 'test/it/*.test.js'",
41
35
  "test:versions": "yarn build && yarn test:e2e:versions && yarn lint",
42
36
  "test:e2e": "mocha --no-timeouts --trace-warnings 'test/e2e/*.e2e.test.js'",
43
37
  "test:e2e:versions": "npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
44
- "test:e2e:versions_local": "STORYBOOK_VERSION=latest npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
38
+ "test:e2e:versions_local": "APPLITOOLS_FRAMEWORK_VERSION=latest npx mocha --no-timeouts --trace-warnings --require test/fixtures/storybook-versions/mochaHooks.js test/versions/*.e2e.versions.test.js",
45
39
  "test:heavy": "node bin/eyes-storybook.js -f test/fixtures/heavyStorybook/applitools.config.js",
46
40
  "storybook": "start-storybook -c test/fixtures/appWithStorybook -p 9001 -s test/fixtures",
47
41
  "storybook:httpHeaders": "start-storybook -c test/fixtures/appWithCustomHttpHeaders -p 9007",
@@ -60,44 +54,33 @@
60
54
  "changelog": "git changelog -x -p -f v$npm_package_version > History.md && git add ./History.md && git commit -am 'changelog'",
61
55
  "changelog:init": "git config changelog.format \"* %s [[%h]($(echo $npm_package_repository_url|cut -d+ -f2|cut -d. -f1-2)/commit/%H)]\"",
62
56
  "changelog:install": "sudo apt-get install git-extras",
63
- "gh:publish": "gh workflow run publish-storybook.yml --ref $(git rev-parse --abbrev-ref HEAD)",
64
- "prepublish:setup": "echo 'setup is a no-op. Move along, nothing to see here.'",
65
- "deps": "bongo deps",
66
- "postinstall": "node src/postinstall",
67
- "preversion": "bongo preversion --verifyPendingChanges",
68
- "version": "bongo version --withPendingChanges",
69
- "postversion": "bongo postversion"
70
- },
71
- "husky": {
72
- "hooks": {
73
- "pre-push": "yarn bongo lint"
74
- }
57
+ "postinstall": "node src/postinstall"
75
58
  },
76
59
  "dependencies": {
77
- "@applitools/core": "3.2.1",
78
- "@applitools/driver": "1.12.1",
60
+ "@applitools/core": "3.5.0",
61
+ "@applitools/driver": "1.13.0",
79
62
  "@applitools/functional-commons": "1.6.0",
80
- "@applitools/logger": "2.0.2",
63
+ "@applitools/logger": "2.0.5",
81
64
  "@applitools/monitoring-commons": "1.0.19",
82
- "@applitools/spec-driver-puppeteer": "1.1.64",
83
- "@applitools/test-server": "1.2.2",
84
- "@applitools/ufg-client": "1.2.18",
85
- "@applitools/utils": "1.3.37",
65
+ "@applitools/spec-driver-puppeteer": "1.1.68",
66
+ "@applitools/ufg-client": "1.3.0",
67
+ "@applitools/utils": "1.5.0",
86
68
  "boxen": "4.2.0",
87
69
  "chalk": "3.0.0",
88
70
  "detect-port": "1.3.0",
89
71
  "lodash.flatten": "4.4.0",
90
72
  "lodash.pick": "4.4.0",
91
73
  "ora": "3.4.0",
92
- "puppeteer": "19.5.0",
74
+ "puppeteer": "19.8.0",
93
75
  "strip-ansi": "6.0.0",
94
76
  "throat": "6.0.1",
95
- "yargs": "15.4.1"
77
+ "yargs": "^17.7.2"
96
78
  },
97
79
  "devDependencies": {
98
80
  "@applitools/bongo": "^4.0.0",
99
81
  "@applitools/sdk-shared": "0.9.15",
100
82
  "@applitools/snaptdout": "^1.0.1",
83
+ "@applitools/test-server": "^1.2.2",
101
84
  "@storybook/addon-interactions": "^6.4.18",
102
85
  "@storybook/react": "^6.4.18",
103
86
  "@storybook/testing-library": "^0.0.9",
@@ -116,8 +99,7 @@
116
99
  "eslint-plugin-prettier": "^3.1.1",
117
100
  "express": "^4.17.1",
118
101
  "filenamify": "^4.1.0",
119
- "husky": "^4.3.8",
120
- "mocha": "^8.0.1",
102
+ "mocha": "^10.2.0",
121
103
  "node-fetch": "^2.6.0",
122
104
  "prettier": "^1.19.1",
123
105
  "react": "^16.12.0",
@@ -127,6 +109,9 @@
127
109
  "ua-parser-js": "^0.7.21"
128
110
  },
129
111
  "engines": {
130
- "node": ">=12.13.0"
112
+ "node": ">=14.15.0"
113
+ },
114
+ "publishConfig": {
115
+ "access": "public"
131
116
  }
132
- }
117
+ }
@@ -47,7 +47,14 @@ async function eyesStorybook({
47
47
  : Number(process.env.APPLITOOLS_CONCURRENT_TABS);
48
48
  logger.log(`Running with ${CONCURRENT_TABS} concurrent tabs`);
49
49
 
50
- const {storybookUrl, readStoriesTimeout, reloadPagePerStory, proxy, testConcurrency} = config;
50
+ const {
51
+ storybookUrl,
52
+ readStoriesTimeout,
53
+ reloadPagePerStory,
54
+ proxy,
55
+ testConcurrency,
56
+ useDnsCache,
57
+ } = config;
51
58
 
52
59
  let iframeUrl;
53
60
  try {
@@ -57,6 +64,7 @@ async function eyesStorybook({
57
64
  throw new Error(`Storybook URL is not valid: ${storybookUrl}`);
58
65
  }
59
66
  const agentId = `eyes-storybook/${require('../package.json').version}`;
67
+ process.env.PUPPETEER_DISABLE_HEADLESS_WARNING = true;
60
68
  const browser = await puppeteer.launch(config.puppeteerOptions);
61
69
  logger.log('browser launched');
62
70
  const page = await browser.newPage();
@@ -78,6 +86,7 @@ async function eyesStorybook({
78
86
  serverUrl: config.serverUrl,
79
87
  apiKey: config.apiKey,
80
88
  agentId,
89
+ useDnsCache,
81
90
  };
82
91
  const [error, account] = await presult(core.getAccountInfo({settings, logger}));
83
92
 
@@ -96,6 +105,7 @@ async function eyesStorybook({
96
105
  ...account,
97
106
  proxy,
98
107
  concurrency: testConcurrency,
108
+ useDnsCache,
99
109
  },
100
110
  logger,
101
111
  });
@@ -0,0 +1,46 @@
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+
4
+ /**
5
+ * Find the path to the given npm command.
6
+ * It goes recursively up the directory tree until it finds the command, like npm itself does.
7
+ * @param {string} npmModuleCommand - The npm command to find.
8
+ * @param {string} packageJsonDirPath - the directory in which to start searching for the command.
9
+ * @returns {Promise<string|null>} The path to the command.
10
+ */
11
+ module.exports = async function findNpmModuleCommandPath(npmModuleCommand, packageJsonDirPath) {
12
+ const isWindows = process.platform.startsWith('win');
13
+
14
+ let checkRootPath = path.resolve(packageJsonDirPath);
15
+ while (checkRootPath !== '') {
16
+ const commandPath = path.join(
17
+ checkRootPath,
18
+ 'node_modules',
19
+ '.bin',
20
+ npmModuleCommand + (isWindows ? '.cmd' : ''),
21
+ );
22
+ if (await doesFileExist(commandPath)) return commandPath;
23
+
24
+ const nextPath = path.dirname(checkRootPath);
25
+ if (nextPath === checkRootPath) break; // the top of the file tree is reached
26
+
27
+ checkRootPath = nextPath;
28
+ }
29
+
30
+ return null;
31
+ };
32
+
33
+ /**
34
+ * Check whether a file exists asynchronously.
35
+ * @param {string} filePath
36
+ * @returns {Promise<boolean>}
37
+ */
38
+ function doesFileExist(filePath) {
39
+ return new Promise(resolve => {
40
+ fs.stat(filePath, (err, stats) => {
41
+ if (err) resolve(false);
42
+ else if (stats != null && stats.isFile()) resolve(true);
43
+ else resolve(false);
44
+ });
45
+ });
46
+ }
@@ -15,7 +15,7 @@ class StorybookConnector extends EventEmitter {
15
15
  sbArg,
16
16
  }) {
17
17
  super();
18
- this._storybookPath = `${storybookPath}${isWindows ? '.cmd' : ''}`;
18
+ this._storybookPath = storybookPath;
19
19
  this._storybookPort = storybookPort;
20
20
  this._storybookHost = storybookHost;
21
21
  this._storybookConfigDir = storybookConfigDir;
@@ -11,13 +11,9 @@ const {
11
11
  } = require('./errMessages');
12
12
  const startStorybookServer = require('./startStorybookServer');
13
13
  const {isIE} = require('./shouldRenderIE');
14
- const {resolve} = require('path');
15
- const {exec} = require('child_process');
16
- const {promisify: p} = require('util');
17
- const pexec = p(exec);
18
- // eslint-disable-next-line
19
- const semver = require('semver');
20
14
  const {makeLogger} = require('@applitools/logger');
15
+ const findNpmModuleCommandPath = require('./findNpmModuleCommandPath');
16
+ const {resolve} = require('path');
21
17
 
22
18
  async function validateAndPopulateConfig({config, packagePath = '', logger = makeLogger()}) {
23
19
  if (!config.apiKey) {
@@ -82,23 +78,30 @@ async function validateAndPopulateConfig({config, packagePath = '', logger = mak
82
78
  }
83
79
 
84
80
  async function determineStorybookVersion(packagePath) {
85
- let storybookPath,
86
- sbArg,
81
+ let sbArg,
82
+ storybookPath,
87
83
  isVersion7 = false;
84
+
88
85
  const storybookPathV6 = resolve(packagePath, 'node_modules/.bin/start-storybook');
89
86
  const storybookPathV7 = resolve(packagePath, 'node_modules/.bin/sb');
90
87
 
91
- if (fs.existsSync(storybookPathV7)) {
92
- const version = await pexec(`${storybookPathV7} --version`);
93
- if (semver.satisfies(version.stdout, '<7.0.0')) {
94
- storybookPath = storybookPathV6;
95
- } else {
96
- storybookPath = storybookPathV7;
97
- sbArg = 'dev';
88
+ // first we look for the binaries in the local node_modules/.bin folder in case there are multiple versions of storybook installed
89
+ if (fs.existsSync(storybookPathV6)) {
90
+ storybookPath = storybookPathV6;
91
+ } else if (fs.existsSync(storybookPathV7)) {
92
+ storybookPath = storybookPathV7;
93
+ isVersion7 = true;
94
+ sbArg = 'dev';
95
+ } else {
96
+ // the binary is not in the local node_modules/.bin folder, so we need to find it
97
+ storybookPath = await findNpmModuleCommandPath('start-storybook', packagePath);
98
+ if (!storybookPath) {
99
+ storybookPath = await findNpmModuleCommandPath('sb', packagePath);
98
100
  isVersion7 = true;
101
+ sbArg = 'dev';
102
+ } else {
103
+ isVersion7 = false;
99
104
  }
100
- } else {
101
- storybookPath = storybookPathV6;
102
105
  }
103
106
 
104
107
  return {storybookPath, isVersion7, sbArg};