miro-export 1.3.0 → 1.3.1
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/build/index.js +11 -1
- package/package.json +1 -1
- package/src/index.ts +11 -1
- package/tests/api.test.ts +10 -7
package/build/index.js
CHANGED
|
@@ -138,7 +138,17 @@ export class MiroBoard {
|
|
|
138
138
|
await window.miro.board.select({ id });
|
|
139
139
|
}
|
|
140
140
|
}
|
|
141
|
-
|
|
141
|
+
let error;
|
|
142
|
+
for (let retry = 0; retry < 5; retry++) {
|
|
143
|
+
try {
|
|
144
|
+
return await window.cmd.board.api.export.makeVector();
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
error = e;
|
|
148
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
throw error ?? Error("Failed to export vector");
|
|
142
152
|
}, objectsIds);
|
|
143
153
|
}
|
|
144
154
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -234,7 +234,17 @@ export class MiroBoard {
|
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
|
|
237
|
-
|
|
237
|
+
let error: unknown;
|
|
238
|
+
for (let retry = 0; retry < 5; retry++) {
|
|
239
|
+
try {
|
|
240
|
+
return await window.cmd.board.api.export.makeVector();
|
|
241
|
+
} catch (e) {
|
|
242
|
+
error = e;
|
|
243
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
throw error ?? Error("Failed to export vector");
|
|
238
248
|
}, objectsIds);
|
|
239
249
|
}
|
|
240
250
|
}
|
package/tests/api.test.ts
CHANGED
|
@@ -96,14 +96,17 @@ await it("should throw error for a non-public board", async () => {
|
|
|
96
96
|
await it("should be able to export SVG of a buggy Miro board", async () => {
|
|
97
97
|
// this is a flaky issue on Miro; around 10% of the time the board loads fine
|
|
98
98
|
// so let's repeat this test a couple of times just to be sure
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
99
|
+
for (let i = 0; i < 3; i++) {
|
|
100
|
+
const miroBoard = new MiroBoard({
|
|
101
|
+
boardId: buggyBoardId,
|
|
102
|
+
boardLoadTimeoutMs: 30_000
|
|
103
|
+
});
|
|
104
|
+
try {
|
|
102
105
|
const svg = await miroBoard.getSvg();
|
|
103
106
|
const hasSvgContents = svg.includes("What should we do next?");
|
|
107
|
+
assert.ok(hasSvgContents);
|
|
108
|
+
} finally {
|
|
104
109
|
await miroBoard.dispose();
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
);
|
|
108
|
-
assert.deepStrictEqual(results, Array.from({ length: 10 }).fill(true));
|
|
110
|
+
}
|
|
111
|
+
}
|
|
109
112
|
});
|