Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
brauliodiez committed Dec 12, 2024
1 parent d7324fe commit 0c96c94
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions e2e/helpers/position.helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Locator, Page } from '@playwright/test';
import { Group } from 'konva/lib/Group';

export interface Position {
x: number;
y: number;
Expand All @@ -20,13 +19,17 @@ export const getLocatorPosition = async (
};

export const getCanvasBoundingBox = async (page: Page) => {
const canvasWindowPos = await page
.locator('#konva-stage canvas')
.boundingBox();
const locator = page.locator('#konva-stage canvas').nth(1);

// Ensure that the canvas is visible before continuie
await locator.waitFor({ state: 'visible' });

const canvasWindowPos = await locator.boundingBox();

if (canvasWindowPos) {
return canvasWindowPos;
} else {
throw new Error('Canvas is not loaded on ui');
throw new Error('Canvas is not loaded on UI');
}
};

Expand Down

0 comments on commit 0c96c94

Please sign in to comment.