@midscene/web 0.4.1-beta-20240910105229.0 → 0.5.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/dist/es/appium.js +11 -8
- package/dist/es/index.js +13 -11
- package/dist/es/playwright-report.js +1 -0
- package/dist/es/playwright.js +13 -11
- package/dist/es/puppeteer.js +11 -9
- package/dist/lib/appium.js +11 -8
- package/dist/lib/index.js +13 -11
- package/dist/lib/playwright-report.js +1 -0
- package/dist/lib/playwright.js +13 -11
- package/dist/lib/puppeteer.js +11 -9
- package/dist/script/htmlElement.js +3 -0
- package/dist/script/htmlElementDebug.js +3 -0
- package/package.json +3 -3
package/dist/es/appium.js
CHANGED
|
@@ -891,6 +891,7 @@ import { getMidscenePkgInfo } from "@midscene/shared/fs";
|
|
|
891
891
|
// src/common/utils.ts
|
|
892
892
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
893
893
|
import assert from "assert";
|
|
894
|
+
import { randomUUID } from "crypto";
|
|
894
895
|
import { readFileSync } from "fs";
|
|
895
896
|
import path from "path";
|
|
896
897
|
import { getTmpFile } from "@midscene/core/utils";
|
|
@@ -970,9 +971,9 @@ function reportFileName(tag = "web") {
|
|
|
970
971
|
function printReportMsg(filepath) {
|
|
971
972
|
console.log("Midscene - report file updated:", filepath);
|
|
972
973
|
}
|
|
973
|
-
function getCurrentExecutionFile() {
|
|
974
|
+
function getCurrentExecutionFile(trace) {
|
|
974
975
|
const error = new Error();
|
|
975
|
-
const stackTrace = error.stack;
|
|
976
|
+
const stackTrace = trace || error.stack;
|
|
976
977
|
const pkgDir = process.cwd() || "";
|
|
977
978
|
if (stackTrace) {
|
|
978
979
|
const stackLines = stackTrace.split("\n");
|
|
@@ -986,15 +987,17 @@ function getCurrentExecutionFile() {
|
|
|
986
987
|
}
|
|
987
988
|
}
|
|
988
989
|
}
|
|
989
|
-
|
|
990
|
-
`Can not find current execution file:
|
|
991
|
-
__dirname: ${__dirname},
|
|
992
|
-
stackTrace: ${stackTrace}`
|
|
993
|
-
);
|
|
990
|
+
return false;
|
|
994
991
|
}
|
|
995
992
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
996
993
|
function generateCacheId(fileName) {
|
|
997
|
-
|
|
994
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
995
|
+
if (!taskFile) {
|
|
996
|
+
taskFile = randomUUID();
|
|
997
|
+
console.warn(
|
|
998
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
999
|
+
);
|
|
1000
|
+
}
|
|
998
1001
|
if (testFileIndex.has(taskFile)) {
|
|
999
1002
|
const currentIndex = testFileIndex.get(taskFile);
|
|
1000
1003
|
if (currentIndex !== void 0) {
|
package/dist/es/index.js
CHANGED
|
@@ -863,7 +863,7 @@ var require_sha256 = __commonJS({
|
|
|
863
863
|
});
|
|
864
864
|
|
|
865
865
|
// src/playwright/ai-fixture.ts
|
|
866
|
-
import { randomUUID } from "crypto";
|
|
866
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
867
867
|
|
|
868
868
|
// src/common/agent.ts
|
|
869
869
|
import {
|
|
@@ -894,6 +894,7 @@ import { getMidscenePkgInfo } from "@midscene/shared/fs";
|
|
|
894
894
|
// src/common/utils.ts
|
|
895
895
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
896
896
|
import assert from "assert";
|
|
897
|
+
import { randomUUID } from "crypto";
|
|
897
898
|
import { readFileSync } from "fs";
|
|
898
899
|
import path from "path";
|
|
899
900
|
import { getTmpFile } from "@midscene/core/utils";
|
|
@@ -980,9 +981,9 @@ function reportFileName(tag = "web") {
|
|
|
980
981
|
function printReportMsg(filepath) {
|
|
981
982
|
console.log("Midscene - report file updated:", filepath);
|
|
982
983
|
}
|
|
983
|
-
function getCurrentExecutionFile() {
|
|
984
|
+
function getCurrentExecutionFile(trace) {
|
|
984
985
|
const error = new Error();
|
|
985
|
-
const stackTrace = error.stack;
|
|
986
|
+
const stackTrace = trace || error.stack;
|
|
986
987
|
const pkgDir = process.cwd() || "";
|
|
987
988
|
if (stackTrace) {
|
|
988
989
|
const stackLines = stackTrace.split("\n");
|
|
@@ -996,15 +997,17 @@ function getCurrentExecutionFile() {
|
|
|
996
997
|
}
|
|
997
998
|
}
|
|
998
999
|
}
|
|
999
|
-
|
|
1000
|
-
`Can not find current execution file:
|
|
1001
|
-
__dirname: ${__dirname},
|
|
1002
|
-
stackTrace: ${stackTrace}`
|
|
1003
|
-
);
|
|
1000
|
+
return false;
|
|
1004
1001
|
}
|
|
1005
1002
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
1006
1003
|
function generateCacheId(fileName) {
|
|
1007
|
-
|
|
1004
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
1005
|
+
if (!taskFile) {
|
|
1006
|
+
taskFile = randomUUID();
|
|
1007
|
+
console.warn(
|
|
1008
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1008
1011
|
if (testFileIndex.has(taskFile)) {
|
|
1009
1012
|
const currentIndex = testFileIndex.get(taskFile);
|
|
1010
1013
|
if (currentIndex !== void 0) {
|
|
@@ -1692,7 +1695,7 @@ var PlaywrightAiFixture = () => {
|
|
|
1692
1695
|
const agentForPage = (page, testInfo) => {
|
|
1693
1696
|
let idForPage = page[midsceneAgentKeyId];
|
|
1694
1697
|
if (!idForPage) {
|
|
1695
|
-
idForPage =
|
|
1698
|
+
idForPage = randomUUID2();
|
|
1696
1699
|
page[midsceneAgentKeyId] = idForPage;
|
|
1697
1700
|
const { testId } = testInfo;
|
|
1698
1701
|
const { taskFile, taskTitle } = groupAndCaseForTest(testInfo);
|
|
@@ -1825,7 +1828,6 @@ var Page = class {
|
|
|
1825
1828
|
quality: 75
|
|
1826
1829
|
});
|
|
1827
1830
|
let buf;
|
|
1828
|
-
console.log(viewportSize);
|
|
1829
1831
|
if (viewportSize.deviceScaleFactor > 1) {
|
|
1830
1832
|
buf = await resizeImg(readFileSync3(path3), {
|
|
1831
1833
|
width: viewportSize.width,
|
|
@@ -322,6 +322,7 @@ var require_dayjs_min = __commonJS({
|
|
|
322
322
|
// src/common/utils.ts
|
|
323
323
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
324
324
|
import assert from "assert";
|
|
325
|
+
import { randomUUID } from "crypto";
|
|
325
326
|
import { readFileSync } from "fs";
|
|
326
327
|
import path from "path";
|
|
327
328
|
import { getTmpFile } from "@midscene/core/utils";
|
package/dist/es/playwright.js
CHANGED
|
@@ -337,7 +337,7 @@ var require_dayjs_min = __commonJS({
|
|
|
337
337
|
});
|
|
338
338
|
|
|
339
339
|
// src/playwright/ai-fixture.ts
|
|
340
|
-
import { randomUUID } from "crypto";
|
|
340
|
+
import { randomUUID as randomUUID2 } from "crypto";
|
|
341
341
|
|
|
342
342
|
// src/common/agent.ts
|
|
343
343
|
import {
|
|
@@ -368,6 +368,7 @@ import { getMidscenePkgInfo } from "@midscene/shared/fs";
|
|
|
368
368
|
// src/common/utils.ts
|
|
369
369
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
370
370
|
import assert from "assert";
|
|
371
|
+
import { randomUUID } from "crypto";
|
|
371
372
|
import { readFileSync } from "fs";
|
|
372
373
|
import path from "path";
|
|
373
374
|
import { getTmpFile } from "@midscene/core/utils";
|
|
@@ -454,9 +455,9 @@ function reportFileName(tag = "web") {
|
|
|
454
455
|
function printReportMsg(filepath) {
|
|
455
456
|
console.log("Midscene - report file updated:", filepath);
|
|
456
457
|
}
|
|
457
|
-
function getCurrentExecutionFile() {
|
|
458
|
+
function getCurrentExecutionFile(trace) {
|
|
458
459
|
const error = new Error();
|
|
459
|
-
const stackTrace = error.stack;
|
|
460
|
+
const stackTrace = trace || error.stack;
|
|
460
461
|
const pkgDir = process.cwd() || "";
|
|
461
462
|
if (stackTrace) {
|
|
462
463
|
const stackLines = stackTrace.split("\n");
|
|
@@ -470,15 +471,17 @@ function getCurrentExecutionFile() {
|
|
|
470
471
|
}
|
|
471
472
|
}
|
|
472
473
|
}
|
|
473
|
-
|
|
474
|
-
`Can not find current execution file:
|
|
475
|
-
__dirname: ${__dirname},
|
|
476
|
-
stackTrace: ${stackTrace}`
|
|
477
|
-
);
|
|
474
|
+
return false;
|
|
478
475
|
}
|
|
479
476
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
480
477
|
function generateCacheId(fileName) {
|
|
481
|
-
|
|
478
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
479
|
+
if (!taskFile) {
|
|
480
|
+
taskFile = randomUUID();
|
|
481
|
+
console.warn(
|
|
482
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
483
|
+
);
|
|
484
|
+
}
|
|
482
485
|
if (testFileIndex.has(taskFile)) {
|
|
483
486
|
const currentIndex = testFileIndex.get(taskFile);
|
|
484
487
|
if (currentIndex !== void 0) {
|
|
@@ -1166,7 +1169,7 @@ var PlaywrightAiFixture = () => {
|
|
|
1166
1169
|
const agentForPage = (page, testInfo) => {
|
|
1167
1170
|
let idForPage = page[midsceneAgentKeyId];
|
|
1168
1171
|
if (!idForPage) {
|
|
1169
|
-
idForPage =
|
|
1172
|
+
idForPage = randomUUID2();
|
|
1170
1173
|
page[midsceneAgentKeyId] = idForPage;
|
|
1171
1174
|
const { testId } = testInfo;
|
|
1172
1175
|
const { taskFile, taskTitle } = groupAndCaseForTest(testInfo);
|
|
@@ -1299,7 +1302,6 @@ var Page = class {
|
|
|
1299
1302
|
quality: 75
|
|
1300
1303
|
});
|
|
1301
1304
|
let buf;
|
|
1302
|
-
console.log(viewportSize);
|
|
1303
1305
|
if (viewportSize.deviceScaleFactor > 1) {
|
|
1304
1306
|
buf = await resizeImg(readFileSync3(path2), {
|
|
1305
1307
|
width: viewportSize.width,
|
package/dist/es/puppeteer.js
CHANGED
|
@@ -365,6 +365,7 @@ import { getMidscenePkgInfo } from "@midscene/shared/fs";
|
|
|
365
365
|
// src/common/utils.ts
|
|
366
366
|
var import_dayjs = __toESM(require_dayjs_min());
|
|
367
367
|
import assert from "assert";
|
|
368
|
+
import { randomUUID } from "crypto";
|
|
368
369
|
import { readFileSync } from "fs";
|
|
369
370
|
import path from "path";
|
|
370
371
|
import { getTmpFile } from "@midscene/core/utils";
|
|
@@ -451,9 +452,9 @@ function reportFileName(tag = "web") {
|
|
|
451
452
|
function printReportMsg(filepath) {
|
|
452
453
|
console.log("Midscene - report file updated:", filepath);
|
|
453
454
|
}
|
|
454
|
-
function getCurrentExecutionFile() {
|
|
455
|
+
function getCurrentExecutionFile(trace) {
|
|
455
456
|
const error = new Error();
|
|
456
|
-
const stackTrace = error.stack;
|
|
457
|
+
const stackTrace = trace || error.stack;
|
|
457
458
|
const pkgDir = process.cwd() || "";
|
|
458
459
|
if (stackTrace) {
|
|
459
460
|
const stackLines = stackTrace.split("\n");
|
|
@@ -467,15 +468,17 @@ function getCurrentExecutionFile() {
|
|
|
467
468
|
}
|
|
468
469
|
}
|
|
469
470
|
}
|
|
470
|
-
|
|
471
|
-
`Can not find current execution file:
|
|
472
|
-
__dirname: ${__dirname},
|
|
473
|
-
stackTrace: ${stackTrace}`
|
|
474
|
-
);
|
|
471
|
+
return false;
|
|
475
472
|
}
|
|
476
473
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
477
474
|
function generateCacheId(fileName) {
|
|
478
|
-
|
|
475
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
476
|
+
if (!taskFile) {
|
|
477
|
+
taskFile = randomUUID();
|
|
478
|
+
console.warn(
|
|
479
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
480
|
+
);
|
|
481
|
+
}
|
|
479
482
|
if (testFileIndex.has(taskFile)) {
|
|
480
483
|
const currentIndex = testFileIndex.get(taskFile);
|
|
481
484
|
if (currentIndex !== void 0) {
|
|
@@ -1175,7 +1178,6 @@ var Page = class {
|
|
|
1175
1178
|
quality: 75
|
|
1176
1179
|
});
|
|
1177
1180
|
let buf;
|
|
1178
|
-
console.log(viewportSize);
|
|
1179
1181
|
if (viewportSize.deviceScaleFactor > 1) {
|
|
1180
1182
|
buf = await resizeImg(readFileSync3(path2), {
|
|
1181
1183
|
width: viewportSize.width,
|
package/dist/lib/appium.js
CHANGED
|
@@ -886,6 +886,7 @@ var import_fs2 = require("@midscene/shared/fs");
|
|
|
886
886
|
|
|
887
887
|
// src/common/utils.ts
|
|
888
888
|
var import_node_assert = __toESM(require("assert"));
|
|
889
|
+
var import_node_crypto = require("crypto");
|
|
889
890
|
var import_node_fs = require("fs");
|
|
890
891
|
var import_node_path = __toESM(require("path"));
|
|
891
892
|
var import_utils = require("@midscene/core/utils");
|
|
@@ -966,9 +967,9 @@ function reportFileName(tag = "web") {
|
|
|
966
967
|
function printReportMsg(filepath) {
|
|
967
968
|
console.log("Midscene - report file updated:", filepath);
|
|
968
969
|
}
|
|
969
|
-
function getCurrentExecutionFile() {
|
|
970
|
+
function getCurrentExecutionFile(trace) {
|
|
970
971
|
const error = new Error();
|
|
971
|
-
const stackTrace = error.stack;
|
|
972
|
+
const stackTrace = trace || error.stack;
|
|
972
973
|
const pkgDir = process.cwd() || "";
|
|
973
974
|
if (stackTrace) {
|
|
974
975
|
const stackLines = stackTrace.split("\n");
|
|
@@ -982,15 +983,17 @@ function getCurrentExecutionFile() {
|
|
|
982
983
|
}
|
|
983
984
|
}
|
|
984
985
|
}
|
|
985
|
-
|
|
986
|
-
`Can not find current execution file:
|
|
987
|
-
__dirname: ${__dirname},
|
|
988
|
-
stackTrace: ${stackTrace}`
|
|
989
|
-
);
|
|
986
|
+
return false;
|
|
990
987
|
}
|
|
991
988
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
992
989
|
function generateCacheId(fileName) {
|
|
993
|
-
|
|
990
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
991
|
+
if (!taskFile) {
|
|
992
|
+
taskFile = (0, import_node_crypto.randomUUID)();
|
|
993
|
+
console.warn(
|
|
994
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
995
|
+
);
|
|
996
|
+
}
|
|
994
997
|
if (testFileIndex.has(taskFile)) {
|
|
995
998
|
const currentIndex = testFileIndex.get(taskFile);
|
|
996
999
|
if (currentIndex !== void 0) {
|
package/dist/lib/index.js
CHANGED
|
@@ -873,7 +873,7 @@ __export(src_exports, {
|
|
|
873
873
|
module.exports = __toCommonJS(src_exports);
|
|
874
874
|
|
|
875
875
|
// src/playwright/ai-fixture.ts
|
|
876
|
-
var
|
|
876
|
+
var import_node_crypto2 = require("crypto");
|
|
877
877
|
|
|
878
878
|
// src/common/agent.ts
|
|
879
879
|
var import_utils6 = require("@midscene/core/utils");
|
|
@@ -892,6 +892,7 @@ var import_fs2 = require("@midscene/shared/fs");
|
|
|
892
892
|
|
|
893
893
|
// src/common/utils.ts
|
|
894
894
|
var import_node_assert = __toESM(require("assert"));
|
|
895
|
+
var import_node_crypto = require("crypto");
|
|
895
896
|
var import_node_fs = require("fs");
|
|
896
897
|
var import_node_path = __toESM(require("path"));
|
|
897
898
|
var import_utils = require("@midscene/core/utils");
|
|
@@ -979,9 +980,9 @@ function reportFileName(tag = "web") {
|
|
|
979
980
|
function printReportMsg(filepath) {
|
|
980
981
|
console.log("Midscene - report file updated:", filepath);
|
|
981
982
|
}
|
|
982
|
-
function getCurrentExecutionFile() {
|
|
983
|
+
function getCurrentExecutionFile(trace) {
|
|
983
984
|
const error = new Error();
|
|
984
|
-
const stackTrace = error.stack;
|
|
985
|
+
const stackTrace = trace || error.stack;
|
|
985
986
|
const pkgDir = process.cwd() || "";
|
|
986
987
|
if (stackTrace) {
|
|
987
988
|
const stackLines = stackTrace.split("\n");
|
|
@@ -995,15 +996,17 @@ function getCurrentExecutionFile() {
|
|
|
995
996
|
}
|
|
996
997
|
}
|
|
997
998
|
}
|
|
998
|
-
|
|
999
|
-
`Can not find current execution file:
|
|
1000
|
-
__dirname: ${__dirname},
|
|
1001
|
-
stackTrace: ${stackTrace}`
|
|
1002
|
-
);
|
|
999
|
+
return false;
|
|
1003
1000
|
}
|
|
1004
1001
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
1005
1002
|
function generateCacheId(fileName) {
|
|
1006
|
-
|
|
1003
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
1004
|
+
if (!taskFile) {
|
|
1005
|
+
taskFile = (0, import_node_crypto.randomUUID)();
|
|
1006
|
+
console.warn(
|
|
1007
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1007
1010
|
if (testFileIndex.has(taskFile)) {
|
|
1008
1011
|
const currentIndex = testFileIndex.get(taskFile);
|
|
1009
1012
|
if (currentIndex !== void 0) {
|
|
@@ -1691,7 +1694,7 @@ var PlaywrightAiFixture = () => {
|
|
|
1691
1694
|
const agentForPage = (page, testInfo) => {
|
|
1692
1695
|
let idForPage = page[midsceneAgentKeyId];
|
|
1693
1696
|
if (!idForPage) {
|
|
1694
|
-
idForPage = (0,
|
|
1697
|
+
idForPage = (0, import_node_crypto2.randomUUID)();
|
|
1695
1698
|
page[midsceneAgentKeyId] = idForPage;
|
|
1696
1699
|
const { testId } = testInfo;
|
|
1697
1700
|
const { taskFile, taskTitle } = groupAndCaseForTest(testInfo);
|
|
@@ -1824,7 +1827,6 @@ var Page = class {
|
|
|
1824
1827
|
quality: 75
|
|
1825
1828
|
});
|
|
1826
1829
|
let buf;
|
|
1827
|
-
console.log(viewportSize);
|
|
1828
1830
|
if (viewportSize.deviceScaleFactor > 1) {
|
|
1829
1831
|
buf = await (0, import_img3.resizeImg)((0, import_node_fs3.readFileSync)(path3), {
|
|
1830
1832
|
width: viewportSize.width,
|
|
@@ -334,6 +334,7 @@ module.exports = __toCommonJS(reporter_exports);
|
|
|
334
334
|
|
|
335
335
|
// src/common/utils.ts
|
|
336
336
|
var import_node_assert = __toESM(require("assert"));
|
|
337
|
+
var import_node_crypto = require("crypto");
|
|
337
338
|
var import_node_fs = require("fs");
|
|
338
339
|
var import_node_path = __toESM(require("path"));
|
|
339
340
|
var import_utils = require("@midscene/core/utils");
|
package/dist/lib/playwright.js
CHANGED
|
@@ -352,7 +352,7 @@ __export(playwright_exports, {
|
|
|
352
352
|
module.exports = __toCommonJS(playwright_exports);
|
|
353
353
|
|
|
354
354
|
// src/playwright/ai-fixture.ts
|
|
355
|
-
var
|
|
355
|
+
var import_node_crypto2 = require("crypto");
|
|
356
356
|
|
|
357
357
|
// src/common/agent.ts
|
|
358
358
|
var import_utils6 = require("@midscene/core/utils");
|
|
@@ -371,6 +371,7 @@ var import_fs2 = require("@midscene/shared/fs");
|
|
|
371
371
|
|
|
372
372
|
// src/common/utils.ts
|
|
373
373
|
var import_node_assert = __toESM(require("assert"));
|
|
374
|
+
var import_node_crypto = require("crypto");
|
|
374
375
|
var import_node_fs = require("fs");
|
|
375
376
|
var import_node_path = __toESM(require("path"));
|
|
376
377
|
var import_utils = require("@midscene/core/utils");
|
|
@@ -458,9 +459,9 @@ function reportFileName(tag = "web") {
|
|
|
458
459
|
function printReportMsg(filepath) {
|
|
459
460
|
console.log("Midscene - report file updated:", filepath);
|
|
460
461
|
}
|
|
461
|
-
function getCurrentExecutionFile() {
|
|
462
|
+
function getCurrentExecutionFile(trace) {
|
|
462
463
|
const error = new Error();
|
|
463
|
-
const stackTrace = error.stack;
|
|
464
|
+
const stackTrace = trace || error.stack;
|
|
464
465
|
const pkgDir = process.cwd() || "";
|
|
465
466
|
if (stackTrace) {
|
|
466
467
|
const stackLines = stackTrace.split("\n");
|
|
@@ -474,15 +475,17 @@ function getCurrentExecutionFile() {
|
|
|
474
475
|
}
|
|
475
476
|
}
|
|
476
477
|
}
|
|
477
|
-
|
|
478
|
-
`Can not find current execution file:
|
|
479
|
-
__dirname: ${__dirname},
|
|
480
|
-
stackTrace: ${stackTrace}`
|
|
481
|
-
);
|
|
478
|
+
return false;
|
|
482
479
|
}
|
|
483
480
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
484
481
|
function generateCacheId(fileName) {
|
|
485
|
-
|
|
482
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
483
|
+
if (!taskFile) {
|
|
484
|
+
taskFile = (0, import_node_crypto.randomUUID)();
|
|
485
|
+
console.warn(
|
|
486
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
487
|
+
);
|
|
488
|
+
}
|
|
486
489
|
if (testFileIndex.has(taskFile)) {
|
|
487
490
|
const currentIndex = testFileIndex.get(taskFile);
|
|
488
491
|
if (currentIndex !== void 0) {
|
|
@@ -1170,7 +1173,7 @@ var PlaywrightAiFixture = () => {
|
|
|
1170
1173
|
const agentForPage = (page, testInfo) => {
|
|
1171
1174
|
let idForPage = page[midsceneAgentKeyId];
|
|
1172
1175
|
if (!idForPage) {
|
|
1173
|
-
idForPage = (0,
|
|
1176
|
+
idForPage = (0, import_node_crypto2.randomUUID)();
|
|
1174
1177
|
page[midsceneAgentKeyId] = idForPage;
|
|
1175
1178
|
const { testId } = testInfo;
|
|
1176
1179
|
const { taskFile, taskTitle } = groupAndCaseForTest(testInfo);
|
|
@@ -1303,7 +1306,6 @@ var Page = class {
|
|
|
1303
1306
|
quality: 75
|
|
1304
1307
|
});
|
|
1305
1308
|
let buf;
|
|
1306
|
-
console.log(viewportSize);
|
|
1307
1309
|
if (viewportSize.deviceScaleFactor > 1) {
|
|
1308
1310
|
buf = await (0, import_img3.resizeImg)((0, import_node_fs3.readFileSync)(path2), {
|
|
1309
1311
|
width: viewportSize.width,
|
package/dist/lib/puppeteer.js
CHANGED
|
@@ -367,6 +367,7 @@ var import_fs2 = require("@midscene/shared/fs");
|
|
|
367
367
|
|
|
368
368
|
// src/common/utils.ts
|
|
369
369
|
var import_node_assert = __toESM(require("assert"));
|
|
370
|
+
var import_node_crypto = require("crypto");
|
|
370
371
|
var import_node_fs = require("fs");
|
|
371
372
|
var import_node_path = __toESM(require("path"));
|
|
372
373
|
var import_utils = require("@midscene/core/utils");
|
|
@@ -454,9 +455,9 @@ function reportFileName(tag = "web") {
|
|
|
454
455
|
function printReportMsg(filepath) {
|
|
455
456
|
console.log("Midscene - report file updated:", filepath);
|
|
456
457
|
}
|
|
457
|
-
function getCurrentExecutionFile() {
|
|
458
|
+
function getCurrentExecutionFile(trace) {
|
|
458
459
|
const error = new Error();
|
|
459
|
-
const stackTrace = error.stack;
|
|
460
|
+
const stackTrace = trace || error.stack;
|
|
460
461
|
const pkgDir = process.cwd() || "";
|
|
461
462
|
if (stackTrace) {
|
|
462
463
|
const stackLines = stackTrace.split("\n");
|
|
@@ -470,15 +471,17 @@ function getCurrentExecutionFile() {
|
|
|
470
471
|
}
|
|
471
472
|
}
|
|
472
473
|
}
|
|
473
|
-
|
|
474
|
-
`Can not find current execution file:
|
|
475
|
-
__dirname: ${__dirname},
|
|
476
|
-
stackTrace: ${stackTrace}`
|
|
477
|
-
);
|
|
474
|
+
return false;
|
|
478
475
|
}
|
|
479
476
|
var testFileIndex = /* @__PURE__ */ new Map();
|
|
480
477
|
function generateCacheId(fileName) {
|
|
481
|
-
|
|
478
|
+
let taskFile = fileName || getCurrentExecutionFile();
|
|
479
|
+
if (!taskFile) {
|
|
480
|
+
taskFile = (0, import_node_crypto.randomUUID)();
|
|
481
|
+
console.warn(
|
|
482
|
+
"Midscene - using random UUID for cache id. Cache may be invalid."
|
|
483
|
+
);
|
|
484
|
+
}
|
|
482
485
|
if (testFileIndex.has(taskFile)) {
|
|
483
486
|
const currentIndex = testFileIndex.get(taskFile);
|
|
484
487
|
if (currentIndex !== void 0) {
|
|
@@ -1178,7 +1181,6 @@ var Page = class {
|
|
|
1178
1181
|
quality: 75
|
|
1179
1182
|
});
|
|
1180
1183
|
let buf;
|
|
1181
|
-
console.log(viewportSize);
|
|
1182
1184
|
if (viewportSize.deviceScaleFactor > 1) {
|
|
1183
1185
|
buf = await (0, import_img3.resizeImg)((0, import_node_fs3.readFileSync)(path2), {
|
|
1184
1186
|
width: viewportSize.width,
|
|
@@ -826,6 +826,9 @@ var midscene_element_inspector = (() => {
|
|
|
826
826
|
const selectedOption = node.options[node.selectedIndex];
|
|
827
827
|
valueContent = selectedOption.textContent || "";
|
|
828
828
|
}
|
|
829
|
+
if ((node.tagName.toLowerCase() === "input" || node.tagName.toLowerCase() === "textarea") && node.value) {
|
|
830
|
+
valueContent = node.value;
|
|
831
|
+
}
|
|
829
832
|
const elementInfo2 = {
|
|
830
833
|
id: nodeHashId2,
|
|
831
834
|
nodePath,
|
|
@@ -816,6 +816,9 @@ var midscene_element_inspector = (() => {
|
|
|
816
816
|
const selectedOption = node.options[node.selectedIndex];
|
|
817
817
|
valueContent = selectedOption.textContent || "";
|
|
818
818
|
}
|
|
819
|
+
if ((node.tagName.toLowerCase() === "input" || node.tagName.toLowerCase() === "textarea") && node.value) {
|
|
820
|
+
valueContent = node.value;
|
|
821
|
+
}
|
|
819
822
|
const elementInfo2 = {
|
|
820
823
|
id: nodeHashId2,
|
|
821
824
|
nodePath,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@midscene/web",
|
|
3
3
|
"description": "Web integration for Midscene.js",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.5.0",
|
|
5
5
|
"jsnext:source": "./src/index.ts",
|
|
6
6
|
"main": "./dist/lib/index.js",
|
|
7
7
|
"module": "./dist/es/index.js",
|
|
@@ -76,8 +76,8 @@
|
|
|
76
76
|
"openai": "4.57.1",
|
|
77
77
|
"inquirer": "10.1.5",
|
|
78
78
|
"@xmldom/xmldom": "0.8.10",
|
|
79
|
-
"@midscene/core": "0.
|
|
80
|
-
"@midscene/shared": "0.
|
|
79
|
+
"@midscene/core": "0.5.0",
|
|
80
|
+
"@midscene/shared": "0.5.0"
|
|
81
81
|
},
|
|
82
82
|
"devDependencies": {
|
|
83
83
|
"@modern-js/module-tools": "2.58.2",
|