@applitools/eyes-storybook 3.33.0 → 3.34.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
@@ -3,6 +3,19 @@
3
3
  ## Unreleased
4
4
 
5
5
 
6
+ ## 3.34.0 - 2023/5/4
7
+
8
+ ### Features
9
+ - Add the option to send a list of browsers from the component configuration
10
+ ### Bug fixes
11
+
12
+ ## 3.33.1 - 2023/4/26
13
+
14
+ ### Features
15
+ ### Bug fixes
16
+ - Make sure to pass LayoutBreakpoints and WaitBeforeCapture from story config to dom snapshot
17
+ - Map UFG config correctly
18
+
6
19
  ## 3.33.0 - 2023/4/26
7
20
 
8
21
  ### Features
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@applitools/eyes-storybook",
3
- "version": "3.33.0",
3
+ "version": "3.34.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "applitools",
@@ -73,14 +73,14 @@
73
73
  }
74
74
  },
75
75
  "dependencies": {
76
- "@applitools/core": "2.5.5",
77
- "@applitools/driver": "1.11.46",
76
+ "@applitools/core": "2.5.10",
77
+ "@applitools/driver": "1.11.49",
78
78
  "@applitools/functional-commons": "1.6.0",
79
79
  "@applitools/logger": "1.1.52",
80
80
  "@applitools/monitoring-commons": "1.0.19",
81
- "@applitools/spec-driver-puppeteer": "1.1.57",
81
+ "@applitools/spec-driver-puppeteer": "1.1.60",
82
82
  "@applitools/test-server": "1.1.31",
83
- "@applitools/ufg-client": "1.2.11",
83
+ "@applitools/ufg-client": "1.2.12",
84
84
  "@applitools/utils": "1.3.35",
85
85
  "boxen": "4.2.0",
86
86
  "chalk": "3.0.0",
@@ -94,7 +94,7 @@ async function eyesStorybook({
94
94
  }
95
95
  const client = await makeUFGClient({
96
96
  config: {
97
- ...account.ufg,
97
+ ...account.ufgServer,
98
98
  ...account,
99
99
  proxy,
100
100
  concurrency: testConcurrency,
@@ -112,7 +112,13 @@ async function eyesStorybook({
112
112
  });
113
113
  const pagePool = createPagePool({initPage, logger});
114
114
 
115
- const doTakeDomSnapshots = async ({page, renderers, layoutBreakpoints, waitBeforeCapture}) => {
115
+ const doTakeDomSnapshots = async ({
116
+ page,
117
+ renderers,
118
+ layoutBreakpoints,
119
+ waitBeforeCapture,
120
+ disableBrowserFetching,
121
+ }) => {
116
122
  const driver = await new Driver({spec, driver: page, logger});
117
123
  const skipResources = client.getCachedResourceUrls();
118
124
  const result = await takeDomSnapshots({
@@ -125,6 +131,7 @@ async function eyesStorybook({
125
131
  renderers,
126
132
  waitBeforeCapture,
127
133
  skipResources,
134
+ disableBrowserFetching,
128
135
  },
129
136
  }),
130
137
  provides: {
@@ -175,7 +182,6 @@ async function eyesStorybook({
175
182
  const getStoryData = makeGetStoryData({
176
183
  logger,
177
184
  takeDomSnapshots: doTakeDomSnapshots,
178
- waitBeforeCapture,
179
185
  });
180
186
  const closeSettings = {
181
187
  ...settings,
@@ -13,7 +13,7 @@ function makeGetStoriesWithConfig({config}) {
13
13
  return function getStoriesWithConfig({stories, logger = console}) {
14
14
  const storiesWithTitle = addStoryTitleAndBaselineName(stories);
15
15
  if (!config.storyConfiguration) {
16
- addConfigToStories({config, stories: storiesWithTitle});
16
+ addConfigToStories({config, stories: storiesWithTitle, isStoryConfig: false});
17
17
  } else {
18
18
  const storyConfigurations = Array.isArray(config.storyConfiguration)
19
19
  ? config.storyConfiguration
@@ -37,6 +37,7 @@ function makeGetStoriesWithConfig({config}) {
37
37
  addConfigToStories({
38
38
  config: transformBrowser(allowedProps(storyConfig)),
39
39
  stories: storiesSubset,
40
+ isStoryConfig: true,
40
41
  });
41
42
 
42
43
  remainingStories = remainingStories.filter(story => !storiesSubset.includes(story));
@@ -44,7 +45,7 @@ function makeGetStoriesWithConfig({config}) {
44
45
  }
45
46
 
46
47
  if (remainingStories.length) {
47
- addConfigToStories({config: basicConfig, stories: remainingStories});
48
+ addConfigToStories({config: basicConfig, stories: remainingStories, isStoryConfig: true});
48
49
  }
49
50
  }
50
51
  return {
@@ -53,20 +54,21 @@ function makeGetStoriesWithConfig({config}) {
53
54
  };
54
55
  };
55
56
 
56
- function addConfigToStories({config, stories}) {
57
+ function addConfigToStories({config, stories, isStoryConfig}) {
57
58
  const configs = config.fakeIE ? splitConfigsByBrowser(config) : [config];
58
59
  for (const config of configs) {
59
60
  for (const story of stories) {
60
- addConfigToStoy({
61
+ addConfigToStory({
61
62
  story,
62
63
  config,
63
64
  isIE: shouldRenderIE(config),
65
+ isStoryConfig,
64
66
  });
65
67
  }
66
68
  }
67
69
  }
68
70
 
69
- function addConfigToStoy({story, config, isIE}) {
71
+ function addConfigToStory({story, config, isIE, isStoryConfig}) {
70
72
  const storiesToUpdate = isIE ? storiesWithConfigIE : storiesWithConfig;
71
73
  storiesToUpdate.set(story.baselineName, {
72
74
  ...story,
@@ -74,6 +76,13 @@ function makeGetStoriesWithConfig({config}) {
74
76
  ...basicConfig,
75
77
  ...storiesToUpdate.get(story.baselineName)?.config,
76
78
  ...config,
79
+ ...transformBrowser({...story.parameters?.eyes}),
80
+ properties: [
81
+ ...(isStoryConfig ? basicConfig.properties || [] : []),
82
+ ...(storiesToUpdate.get(story.baselineName)?.config.properties || []),
83
+ ...(config.properties || []),
84
+ ...(story.parameters?.eyes?.properties || []),
85
+ ],
77
86
  },
78
87
  });
79
88
  }
@@ -10,8 +10,8 @@ const PAGE_EVALUATE_TIMEOUT = 120000;
10
10
  const DOM_SNAPSHOTS_TIMEOUT = 5 * 60 * 1000;
11
11
  const utils = require('@applitools/utils');
12
12
 
13
- function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPagePerStory}) {
14
- return async function getStoryData({story, storyUrl, page, renderers, waitBeforeStory}) {
13
+ function makeGetStoryData({logger, takeDomSnapshots, reloadPagePerStory}) {
14
+ return async function getStoryData({story, storyUrl, page}) {
15
15
  const title = getStoryBaselineName(story);
16
16
  logger.log(`getting data from story`, title);
17
17
 
@@ -43,7 +43,7 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPa
43
43
  await renderStoryLegacy();
44
44
  }
45
45
 
46
- const wait = waitBeforeStory || waitBeforeCapture;
46
+ const wait = story.config.waitBeforeCapture;
47
47
  if (typeof wait === 'number') {
48
48
  utils.guard.isGreaterThenOrEqual(wait, 0, {name: 'waitBeforeCapture'});
49
49
  }
@@ -57,14 +57,15 @@ function makeGetStoryData({logger, takeDomSnapshots, waitBeforeCapture, reloadPa
57
57
  logger.log(`running takeDomSnapshot(s) for story ${title}`);
58
58
  const domSnapshotsPromise = takeDomSnapshots({
59
59
  page,
60
- renderers,
61
- layoutBreakpoints: eyesParameters ? eyesParameters.layoutBreakpoints : undefined,
60
+ renderers: story.config.renderers,
61
+ layoutBreakpoints: story.config.layoutBreakpoints,
62
62
  waitBeforeCapture: wait
63
63
  ? async () => {
64
64
  logger.log(`waiting before screenshot of ${title} ${wait}`);
65
65
  await waitFor(page, wait);
66
66
  }
67
67
  : undefined,
68
+ disableBrowserFetching: story.config.disableBrowserFetching,
68
69
  });
69
70
 
70
71
  const result = await ptimeoutWithError(
@@ -58,16 +58,12 @@ function makeRenderStories({
58
58
  const story = stories[currIndex++];
59
59
  const storyUrl = getStoryUrl(story, storybookUrl);
60
60
  const title = getStoryBaselineName(story);
61
- const {waitBeforeCapture} = (story.parameters && story.parameters.eyes) || {};
62
-
63
61
  try {
64
62
  let [error, storyData] = await presult(
65
63
  getStoryData({
66
64
  story,
67
65
  storyUrl,
68
- renderers: story.config.renderers,
69
66
  page,
70
- waitBeforeStory: waitBeforeCapture,
71
67
  }),
72
68
  );
73
69
 
@@ -91,9 +87,7 @@ function makeRenderStories({
91
87
  getStoryData({
92
88
  story,
93
89
  storyUrl,
94
- renderers: story.config.renderers,
95
90
  page: newPageObj.page,
96
- waitBeforeStory: waitBeforeCapture,
97
91
  }),
98
92
  );
99
93
  error = newError;
@@ -115,6 +109,7 @@ function makeRenderStories({
115
109
  });
116
110
  return onDoneStory(testResults, story);
117
111
  } catch (ex) {
112
+ logger.log(`[page ${pageId}] error while processing story "${title}". ${ex}`);
118
113
  return onDoneStory(ex, story);
119
114
  }
120
115
  }
@@ -18,12 +18,6 @@ function makeRenderStory({
18
18
  const {name, kind, parameters, hasPlayFunction} = story;
19
19
  const baselineName = story.baselineName;
20
20
  const title = story.storyTitle;
21
- const eyesParameters = (parameters && parameters.eyes) || {};
22
- const eyesOptions = {
23
- ...config,
24
- ...eyesParameters,
25
- properties: [...(config.properties || []), ...(eyesParameters.properties || [])],
26
- };
27
21
  const {
28
22
  ignoreDisplacements,
29
23
  ignoreRegions,
@@ -58,7 +52,7 @@ function makeRenderStory({
58
52
  ignoreCaret,
59
53
  matchLevel,
60
54
  ignoreBaseline,
61
- } = eyesOptions;
55
+ } = config;
62
56
 
63
57
  if (sizeMode) {
64
58
  console.log(deprecationWarning({deprecatedThing: "'sizeMode'", newThing: "'target'"}));
@@ -2,7 +2,10 @@ function prepareTakeDomSnapshotsSettings({config, options}) {
2
2
  let result = {...options};
3
3
  result.layoutBreakpoints =
4
4
  result.layoutBreakpoints !== undefined ? result.layoutBreakpoints : config.layoutBreakpoints;
5
- result.disableBrowserFetching = config.disableBrowserFetching;
5
+ result.disableBrowserFetching =
6
+ result.disableBrowserFetching !== undefined
7
+ ? result.disableBrowserFetching
8
+ : config.disableBrowserFetching;
6
9
  return result;
7
10
  }
8
11