fix tests

This commit is contained in:
peterkogo
2025-04-16 17:36:05 +02:00
parent 13fdd15f59
commit 2474c8be14
7 changed files with 746 additions and 126 deletions

View File

@@ -47,7 +47,7 @@ test.describe('Nodes', () => {
test('selectable=false prevents selection', async ({ page }) => {
const locator = page.locator(`.${FRAMEWORK}-flow__node`).and(page.locator('[data-id="notSelectable"]'));
await expect(page.locator(`.${FRAMEWORK}-flow__nodes`).first()).toHaveCSS('visibility', 'visible');
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await locator.click();
await expect(locator).not.toHaveClass(/selected/);
@@ -165,7 +165,7 @@ test.describe('Nodes', () => {
const outputSourceHandle = page.locator(`.${FRAMEWORK}-flow__handle`).and(page.locator('[data-nodeid="Node-1"]'));
const inputSourceHandle = page.locator(`.${FRAMEWORK}-flow__handle`).and(page.locator('[data-nodeid="Node-4"]'));
await expect(page.locator(`.${FRAMEWORK}-flow__nodes`).first()).toHaveCSS('visibility', 'visible');
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await expect(outputSourceHandle).toBeInViewport();
await expect(inputSourceHandle).toBeInViewport();
@@ -189,7 +189,7 @@ test.describe('Nodes', () => {
const firstOutputHandle = page.locator(`.${FRAMEWORK}-flow__handle`).and(page.locator('[data-nodeid="Node-2"]'));
const secondOutputHandle = page.locator(`.${FRAMEWORK}-flow__handle`).and(page.locator('[data-nodeid="Node-4"]'));
await expect(page.locator(`.${FRAMEWORK}-flow__nodes`).first()).toHaveCSS('visibility', 'visible');
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await expect(firstOutputHandle).toBeInViewport();
await expect(secondOutputHandle).toBeInViewport();
@@ -220,7 +220,7 @@ test.describe('Nodes', () => {
.and(page.locator('[data-nodeid="Node-3"]'))
.and(page.locator('.source'));
await expect(page.locator(`.${FRAMEWORK}-flow__nodes`).first()).toHaveCSS('visibility', 'visible');
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await expect(firstInputHandle).toBeInViewport();
await expect(secondInputHandle).toBeInViewport();
@@ -251,7 +251,7 @@ test.describe('Nodes', () => {
const notConnectableBox = await notConnectableHandle.boundingBox();
await expect(page.locator(`.${FRAMEWORK}-flow__nodes`).first()).toHaveCSS('visibility', 'visible');
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await expect(outputHandle).toBeInViewport();
await expect(notConnectableHandle).toBeInViewport();

View File

@@ -6,17 +6,19 @@ test.describe('Props', () => {
test.describe('colorMode', async () => {
test('render default light color mode', async ({ page }) => {
await page.goto('/examples/color-mode');
const locator = page.locator(`.${FRAMEWORK}-flow`);
await expect(locator).not.toHaveClass(/dark/);
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await expect(page.locator(`.${FRAMEWORK}-flow`)).not.toHaveClass(/dark/);
});
test('render dark color mode', async ({ page }) => {
await page.goto('/examples/color-mode');
const locator = page.locator(`.${FRAMEWORK}-flow`);
await expect(page.locator(`.${FRAMEWORK}-flow__node`).first()).toHaveCSS('visibility', 'visible');
await page.getByTestId('colormode-select').selectOption({ label: 'dark' });
await expect(locator).toHaveClass(/dark/);
await expect(page.locator(`.${FRAMEWORK}-flow`)).toHaveClass(/dark/);
});
});
});

File diff suppressed because it is too large Load Diff

View File

@@ -14,11 +14,11 @@
"author": "",
"license": "ISC",
"devDependencies": {
"@playwright/test": "^1.49.1",
"@playwright/test": "^1.51.1",
"@types/node": "^20.14.6"
},
"dependencies": {
"@playwright/experimental-ct-react": "^1.49.1",
"@playwright/experimental-ct-react": "^1.51.1",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"react": "^18.3.1",