@lvce-editor/renderer-process 30.72.2 → 30.73.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.
@@ -11718,6 +11718,27 @@ const checkConditionError = (fnName, ...params) => {
11718
11718
  const fn = ConditionValues[getConditionName(fnName)];
11719
11719
  return fn(...params);
11720
11720
  };
11721
+ const toMatchScreenShot = async (locator, uri) => {
11722
+ string(uri);
11723
+ const parsedSelector = getParsedSelector(locator);
11724
+ await waitForCondition(() => Boolean(querySelectorOne(parsedSelector)));
11725
+ const element = querySelectorOne(parsedSelector);
11726
+ if (!element) {
11727
+ throw new Error(`[SCREENSHOT_ELEMENT_NOT_FOUND] ${JSON.stringify(parsedSelector)}: ${uri}`);
11728
+ }
11729
+ const host = globalThis;
11730
+ if (!host.lvceMatchScreenshot) {
11731
+ throw new Error(`[SCREENSHOT_RUNNER_UNAVAILABLE] Run with a screenshot-capable test-with-playwright: ${uri}`);
11732
+ }
11733
+ const targets = host.lvceScreenshotTargets ||= new Map();
11734
+ const token = crypto.randomUUID();
11735
+ targets.set(token, element);
11736
+ try {
11737
+ await host.lvceMatchScreenshot(uri, token);
11738
+ } finally {
11739
+ targets.delete(token);
11740
+ }
11741
+ };
11721
11742
 
11722
11743
  const LocalStorage = 1;
11723
11744
  const SessionStorage = 2;
@@ -12290,6 +12311,7 @@ const commandMap = {
12290
12311
  'TestFrameWork.performKeyBoardAction': performKeyboardAction,
12291
12312
  'TestFrameWork.showOverlay': showOverlay,
12292
12313
  'TestFrameWork.showTestResults': showTestResults,
12314
+ 'TestFrameWork.toMatchScreenShot': toMatchScreenShot,
12293
12315
  'TestFrameWork.transfer': transfer,
12294
12316
  'TestFrameWork.transferToWebView': transferToWebView,
12295
12317
  'Viewlet.addKeyBindings': addKeyBindings,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "30.72.2",
3
+ "version": "30.73.0",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "renderer-process"