Skip to content

Commit 27f0872

Browse files
committed
fix e2e tests - pick serializable props
1 parent ef33fbd commit 27f0872

File tree

1 file changed

+27
-8
lines changed

1 file changed

+27
-8
lines changed

packages/compass-e2e-tests/tests/data-modeling-tab.test.ts

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ import os from 'os';
2424
import fs from 'fs/promises';
2525
import type { ChainablePromiseElement } from 'webdriverio';
2626

27-
interface Node {
27+
type Node = {
2828
id: string;
2929
position: { x: number; y: number };
30-
}
30+
};
3131

3232
interface Edge {
3333
id: string;
@@ -162,9 +162,17 @@ async function getDiagramNodes(
162162
if (!node) {
163163
throw new Error(`Element with selector ${selector} not found`);
164164
}
165-
return (
166-
node as Element & { _diagram: DiagramInstance }
167-
)._diagram.getNodes();
165+
166+
return (node as Element & { _diagram: DiagramInstance })._diagram
167+
.getNodes()
168+
.map(
169+
(node: Node): Node => ({
170+
// do not add any non-serializable properties here,
171+
// the result of browser.execute must be serializable
172+
id: node.id,
173+
position: node.position,
174+
})
175+
);
168176
}, Selectors.DataModelEditor);
169177
return nodes.length === expectedCount;
170178
});
@@ -182,9 +190,20 @@ async function getDiagramEdges(
182190
if (!node) {
183191
throw new Error(`Element with selector ${selector} not found`);
184192
}
185-
return (
186-
node as Element & { _diagram: DiagramInstance }
187-
)._diagram.getEdges();
193+
return (node as Element & { _diagram: DiagramInstance })._diagram
194+
.getEdges()
195+
.map(
196+
(edge: Edge): Edge => ({
197+
// do not add any non-serializable properties here,
198+
// the result of browser.execute must be serializable
199+
id: edge.id,
200+
source: edge.source,
201+
target: edge.target,
202+
markerStart: edge.markerStart,
203+
markerEnd: edge.markerEnd,
204+
selected: edge.selected,
205+
})
206+
);
188207
}, Selectors.DataModelEditor);
189208
return edges.length === expectedCount;
190209
});

0 commit comments

Comments
 (0)