@applitools/eyes-storybook 3.27.2 → 3.27.3

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
@@ -3,6 +3,14 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 3.27.3 - 2022/1/26
7
+
8
+ - avoid unwanted page reloading due to unknown query parameters
9
+ - updated to @applitools/driver@1.4.9 (from 1.4.7)
10
+ - updated to @applitools/eyes-sdk-core@13.0.0 (from 12.24.9)
11
+ - updated to @applitools/logger@1.0.9 (from 1.0.8)
12
+ - updated to @applitools/visual-grid-client@15.8.62 (from 15.8.55)
13
+
6
14
  ## 3.27.2 - 2021/12/23
7
15
 
8
16
  - updated to @applitools/driver@1.4.7 (from 1.4.5)
package/README.md CHANGED
@@ -156,9 +156,12 @@ In addition to command-line arguments, it's possible to define the following con
156
156
  | `exitcode` | false | If tests failed close with non-zero exit code (also available as command-line argument). |
157
157
  | `browser` | { width: 800, height: 600, name: 'chrome' } | The size and browser of the generated screenshots. For more info and possible values, see the [browser section below](#configuring-the-browser).|
158
158
  | `showLogs` | false | Whether or not you want to see logs of the Eyes-Storybook plugin. |
159
- | `batchId` | random | Provides ability to group tests into batches. Read more about batches [here](https://applitools.com/docs/topics/working-with-test-batches/how-to-group-tests-into-batches.html). |
160
- | `batchName` | undefined | Provides a name to the batch. |
161
- | `batchSequenceName` | undefined | Name for managing batch statistics. |
159
+ | `batch` | undefined | An object which describes different aspects of the batch. The following lines in this table depict the various ways to configure the batch. |
160
+ | `batch.id` | random | Provides ability to group tests into batches. Read more about batches [here](https://applitools.com/docs/topics/working-with-test-batches/how-to-group-tests-into-batches.html). |
161
+ | `batch.name` | The name of the first test in the batch | Provides a name to the batch (for display purpose only). |
162
+ | `batch.sequenceName` | undefined | Name for managing batch statistics. |
163
+ | `batch.notifyOnCompletion` | false | If `true` batch completion notifications are sent. |
164
+ | `batch.properties` | undefined | Custom properties for the entire batch. The format is an array of objects with name/value properties. For example: `[{name: 'My prop', value:'My value'}]`. |
162
165
  | `baselineEnvName` | undefined | The name of the environment of the baseline. |
163
166
  | `envName` | undefined | A name for the environment in which the application under test is running. |
164
167
  | `ignoreCaret` | false | Whether to ignore or the blinking caret or not when comparing images. |
@@ -180,7 +183,6 @@ In addition to command-line arguments, it's possible to define the following con
180
183
  | `waitBeforeCapture` | undefined | Selector, function or timeout.<br/>If ```number``` then the argument is treated as time in milliseconds to wait before all screenshots.<br/>If ```string``` then the argument is treated as a selector for elements to wait for before all screenshots.<br/>If ```function```, then the argument is treated as a predicate to wait for before all screenshots.<br/><hr/>For per component configuration see [waitBeforeCapture.](#waitBeforeCapture)<br/>Note that we use Puppeteer's [page.waitForTimeout()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitfortimeoutmilliseconds), [page.waitForSelector()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforselectorselector-options), [page.waitForXPath()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforxpathxpath-options) and [page.waitForFunction()](https://github.com/puppeteer/puppeteer/blob/main/docs/api.md#pagewaitforfunctionpagefunction-options-args), checkout it's API for more details. |
181
184
  | `include` | true | A predicate function, a string or a regular expression specifying which stories should be visually tested.<br/>Visual baselines will be created only for the components specified.<br/>The function receives an object with ```name```, ```kind```, ```storyTitle``` and ```parameters``` properties.<br/>For example (exclude all stories with a name that start with [SKIP]):<br/>```({name, kind, storyTitle, parameters}) => !/^\[SKIP\]/.test(name)```<br/>For more information, see [per component configuration - include](#include). |
182
185
  | `variations` | undefined | Specifies additional variations for all or some of the stories. For example, RTL. For more information, see [per component configuration - variations](#variations).|
183
- | `notifyOnCompletion` | false | If `true` batch completion notifications are sent. |
184
186
  | `dontCloseBatches` | false | If true, batches are not closed for notifyOnCompletion.|
185
187
  | `testConcurrency` | 5 | The maximum number of tests that can run concurrently. The default value is the allowed amount for free accounts. For paid accounts, set this number to the quota set for your account. |
186
188
  | `readStoriesTimeout` | 60000 | The amount of time (in milliseconds) Eyes-Storybook waits for storybook to load. For old storybook versions 2 and 3, this is also the time it takes for Eyes-Storybook to acknowledge it is working on those versions. So it is recommended to make this value small (e.g. 3000) when working with Storybook version 2 or 3. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-storybook",
3
- "version": "3.27.2",
3
+ "version": "3.27.3",
4
4
  "description": "",
5
5
  "engines": {
6
6
  "node": ">=8.6.0"
@@ -34,6 +34,7 @@
34
34
  "changelog": "git changelog -x -p -f v$npm_package_version > History.md && git add ./History.md && git commit -am 'changelog'",
35
35
  "changelog:init": "git config changelog.format \"* %s [[%h]($(echo $npm_package_repository_url|cut -d+ -f2|cut -d. -f1-2)/commit/%H)]\"",
36
36
  "changelog:install": "sudo apt-get install git-extras",
37
+ "gh:publish": "gh workflow run publish-storybook.yml --ref $(git rev-parse --abbrev-ref HEAD)",
37
38
  "postinstall": "node src/postinstall",
38
39
  "preversion": "bongo preversion",
39
40
  "version": "bongo version",
@@ -58,14 +59,14 @@
58
59
  "directory": "packages/eyes-storybook"
59
60
  },
60
61
  "dependencies": {
61
- "@applitools/driver": "1.4.7",
62
- "@applitools/eyes-sdk-core": "12.24.9",
62
+ "@applitools/driver": "1.4.9",
63
+ "@applitools/eyes-sdk-core": "13.0.0",
63
64
  "@applitools/functional-commons": "1.6.0",
64
- "@applitools/logger": "1.0.8",
65
+ "@applitools/logger": "1.0.9",
65
66
  "@applitools/monitoring-commons": "1.0.19",
66
67
  "@applitools/spec-driver-puppeteer": "1.1.0",
67
68
  "@applitools/test-server": "1.0.8",
68
- "@applitools/visual-grid-client": "15.8.55",
69
+ "@applitools/visual-grid-client": "15.8.62",
69
70
  "boxen": "4.2.0",
70
71
  "chalk": "3.0.0",
71
72
  "detect-port": "1.3.0",
@@ -77,11 +78,11 @@
77
78
  "yargs": "15.4.1"
78
79
  },
79
80
  "devDependencies": {
80
- "@applitools/scripts": "^1.0.1",
81
- "@applitools/sdk-release-kit": "0.13.4",
81
+ "@applitools/scripts": "^1.1.0",
82
+ "@applitools/sdk-release-kit": "0.13.11",
82
83
  "@applitools/sdk-shared": "0.9.11",
83
84
  "@applitools/snaptdout": "^1.0.1",
84
- "@applitools/utils": "1.2.5",
85
+ "@applitools/utils": "1.2.11",
85
86
  "@storybook/react": "^6.4.0",
86
87
  "@testing-library/dom": "^5.6.1",
87
88
  "babel-core": "^6.26.3",
@@ -82,19 +82,20 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPa
82
82
  return false;
83
83
  }
84
84
 
85
- expectedQueryParams = expectedQueryParams || {};
85
+ const currentQueryParams = url.searchParams.get('eyes-query-params');
86
+ if (!currentQueryParams && !expectedQueryParams) return true;
87
+ if (!currentQueryParams || !expectedQueryParams) return false;
88
+
86
89
  const expectedQueryParamNames = Object.keys(expectedQueryParams);
87
- const actualQueryParamNames = [];
88
- for (const [name, value] of url.searchParams) {
89
- if (['eyes-storybook', 'selectedKind', 'selectedStory'].includes(name)) continue;
90
- if (!expectedQueryParams.hasOwnProperty(name) || !expectedQueryParams[name] === value) {
90
+ const currentQueryParamNames = currentQueryParams.split(',');
91
+
92
+ if (currentQueryParamNames.length !== expectedQueryParamNames.length) return false;
93
+
94
+ for (const queryParamName of currentQueryParamNames) {
95
+ if (url.searchParams.get(queryParamName) !== expectedQueryParams[queryParamName]) {
91
96
  return false;
92
97
  }
93
- actualQueryParamNames.push(name);
94
98
  }
95
-
96
- if (actualQueryParamNames.length !== expectedQueryParamNames.length) return false;
97
-
98
99
  return true;
99
100
  }
100
101
 
@@ -2,15 +2,19 @@
2
2
  const getIframeUrl = require('./getIframeUrl');
3
3
 
4
4
  function getStoryUrl({name, kind, parameters}, baseUrl) {
5
- const queryParams = (parameters && parameters.eyes && parameters.eyes.queryParams) || {};
6
- const queryString = Object.entries(queryParams).reduce(
7
- (queryString, [name, value]) => queryString + `&${name}=${value}`,
8
- '',
9
- );
5
+ let storyUrl = getIframeUrl(baseUrl);
6
+ storyUrl += `&selectedKind=${encodeURIComponent(kind)}`;
7
+ storyUrl += `&selectedStory=${encodeURIComponent(name)}`;
10
8
 
11
- return `${getIframeUrl(baseUrl)}&selectedKind=${encodeURIComponent(
12
- kind,
13
- )}&selectedStory=${encodeURIComponent(name)}${queryString}`;
9
+ const queryParams = parameters && parameters.eyes && parameters.eyes.queryParams;
10
+ if (queryParams) {
11
+ storyUrl += `&eyes-query-params=${Object.keys(queryParams).join(',')}`;
12
+ for (const [name, value] of Object.entries(queryParams)) {
13
+ storyUrl += `&${name}=${encodeURIComponent(value)}`;
14
+ }
15
+ }
16
+
17
+ return storyUrl;
14
18
  }
15
19
 
16
20
  module.exports = getStoryUrl;