Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix e2e tests on Mac #9401

Merged
merged 1 commit into from
Mar 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions app/gui2/e2e/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export async function goToGraph(page: Page) {
}

export async function expectNodePositionsInitialized(page: Page, yPos: number) {
// Wait until edges are initialized and displayed correctly.
await expect(page.getByTestId('broken-edge')).toHaveCount(0)
// Wait until node sizes are initialized.
await expect(locate.graphNode(page).first().locator('.bgFill')).toBeVisible()
// TODO: The yPos should not need to be a variable. Instead, first automatically positioned nodes
// should always have constant known position. This is a bug caused by incorrect layout after
// entering a function. To be fixed with #9255
Expand Down
10 changes: 10 additions & 0 deletions app/gui2/src/components/GraphEditor/GraphEdge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,15 @@ const sourceRect = computed<Rect | undefined>(() => {
}
})

/** Edges which do not have `sourceRect` and `targetPos` initialized are marked by a special
* `broken-edge` data-testid, for debugging and e2e test purposes. */
const edgeIsBroken = computed(
() =>
sourceRect.value == null ||
targetPos.value == null ||
(sourceRect.value.pos.equals(targetPos.value) && sourceRect.value.size.equals(Vec2.Zero)),
)

type NodeMask = {
id: string
rect: Rect
Expand Down Expand Up @@ -508,6 +517,7 @@ const connected = computed(() => isConnected(props.edge))
class="edge io"
:data-source-node-id="sourceNode"
:data-target-node-id="targetNode"
:data-testid="edgeIsBroken ? 'broken-edge' : null"
@pointerdown.stop="click"
@pointerenter="hovered = true"
@pointerleave="hovered = false"
Expand Down
Loading