@mablhq/mabl-cli 2.11.6 → 2.12.10
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/browserLauncher/playwrightBrowserLauncher/playwrightBrowser.js +2 -2
- package/browserLauncher/playwrightBrowserLauncher/playwrightPage.js +0 -3
- package/commands/tests/testsUtil.js +1 -0
- package/domUtil/index.js +1 -1
- package/execution/index.js +2 -2
- package/mablscript/mobile/steps/EnterTextStep.js +3 -0
- package/mablscript/mobile/steps/stepUtil.js +51 -12
- package/mablscript/mobile/tests/steps/GeneralHumanization.mobiletest.js +144 -7
- package/mablscript/steps/SendHttpRequestStep.js +7 -4
- package/mablscriptFind/index.js +1 -1
- package/package.json +1 -1
- package/resources/mablFind.js +1 -1
- package/resources/pdf-viewer/embeddedPdfDetection.js +22 -6
- package/util/downloadUtil.js +1 -1
|
@@ -117,7 +117,7 @@ mablEmbeddedPdfDetector = () => {
|
|
|
117
117
|
const pdfUrl = pdfElement.src || pdfElement.data;
|
|
118
118
|
const pdfFileName = mablGetPdfFilenameFromUrl(pdfUrl);
|
|
119
119
|
|
|
120
|
-
const embeddedPdfMablId =
|
|
120
|
+
const embeddedPdfMablId = createEmbeddedPdfMablId(pdfFileName);
|
|
121
121
|
// Mark the embedded PDF element so that we can find it to replace it later
|
|
122
122
|
pdfElement.setAttribute(
|
|
123
123
|
MABL_EMBEDDED_PDF_DETECTED_FLAG,
|
|
@@ -125,7 +125,7 @@ mablEmbeddedPdfDetector = () => {
|
|
|
125
125
|
);
|
|
126
126
|
|
|
127
127
|
// Signal embedded PDF detection and pending download
|
|
128
|
-
// Wait for PDF
|
|
128
|
+
// Wait for PDF event be acknowledged by PageFrameContextTracker before continuing
|
|
129
129
|
await window.dispatchMablEvent({
|
|
130
130
|
type: MESSAGE_TYPE_EMBEDDED_PDF_DETECTED,
|
|
131
131
|
baseUri,
|
|
@@ -133,6 +133,8 @@ mablEmbeddedPdfDetector = () => {
|
|
|
133
133
|
pdfFileName,
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
+
mablDownloadEmbeddedPdf(pdfFileName, pdfUrl);
|
|
137
|
+
|
|
136
138
|
// Trigger replacement of the embedded PDF with an interactable version served by PDF server
|
|
137
139
|
window.dispatchMablEvent({
|
|
138
140
|
type: MESSAGE_TYPE_EMBEDDED_PDF_MARKED,
|
|
@@ -168,10 +170,6 @@ mablEmbeddedPdfDetector = () => {
|
|
|
168
170
|
}
|
|
169
171
|
return true;
|
|
170
172
|
}
|
|
171
|
-
|
|
172
|
-
function idSanitize(originalId) {
|
|
173
|
-
return originalId && originalId.replace(/[^a-zA-Z0-9.-]/g, '_');
|
|
174
|
-
}
|
|
175
173
|
};
|
|
176
174
|
|
|
177
175
|
const CHECK_INTERVAL_IN_MILLIS = 300;
|
|
@@ -180,6 +178,14 @@ let checkTimer;
|
|
|
180
178
|
const checkStartTime = Date.now();
|
|
181
179
|
const MABL_DEFAULT_PDF_NAME = 'mablPdf';
|
|
182
180
|
|
|
181
|
+
function mablPdfIdSanitize(originalId) {
|
|
182
|
+
return originalId && originalId.replace(/[^a-zA-Z0-9.-]/g, '_');
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function createEmbeddedPdfMablId(pdfFileName) {
|
|
186
|
+
return '__mabl_pdf_viewer_' + mablPdfIdSanitize(pdfFileName);
|
|
187
|
+
}
|
|
188
|
+
|
|
183
189
|
function documentHasDocType() {
|
|
184
190
|
return document.doctype && document.doctype.name;
|
|
185
191
|
}
|
|
@@ -200,6 +206,16 @@ function mablGetPdfFilenameFromUrl(pdfUrl) {
|
|
|
200
206
|
return pdfUrl.startsWith('blob:') ? 'blob_pdf' : pdfFileName;
|
|
201
207
|
}
|
|
202
208
|
|
|
209
|
+
function mablDownloadEmbeddedPdf(fileName, pdfUrl) {
|
|
210
|
+
const aTag = document.createElement('a');
|
|
211
|
+
aTag.style.display = 'none';
|
|
212
|
+
document.body.appendChild(aTag);
|
|
213
|
+
aTag.href = pdfUrl;
|
|
214
|
+
aTag.setAttribute('download', fileName);
|
|
215
|
+
aTag.click();
|
|
216
|
+
document.body.removeChild(aTag);
|
|
217
|
+
}
|
|
218
|
+
|
|
203
219
|
if (!documentHasDocType()) {
|
|
204
220
|
// If this is executed too quickly, the DOCTYPE has not been loaded yet
|
|
205
221
|
// so wait a bit before checking again.
|
package/util/downloadUtil.js
CHANGED
|
@@ -29,7 +29,7 @@ const fs = __importStar(require("fs"));
|
|
|
29
29
|
const fsExtra = __importStar(require("fs-extra"));
|
|
30
30
|
const util = __importStar(require("util"));
|
|
31
31
|
const testsUtil_1 = require("../commands/tests/testsUtil");
|
|
32
|
-
const AWAIT_DOWNLOAD_MAX_TIMEOUT_MILLIS =
|
|
32
|
+
const AWAIT_DOWNLOAD_MAX_TIMEOUT_MILLIS = 60000;
|
|
33
33
|
const FILE_MIN_STABLE_TIME_MILLIS = 3000;
|
|
34
34
|
const AWAIT_DOWNLOAD_POLLING_INTERVAL_MILLISECONDS = 500;
|
|
35
35
|
function getAwaitDownloadTimeout() {
|