Skip to content

Commit d9b31e8

Browse files
authored
Merge branch 'master' into 003-toggle-columns-table-names
2 parents 96b6c64 + 3e54268 commit d9b31e8

File tree

7 files changed

+33
-11
lines changed

7 files changed

+33
-11
lines changed

.umirc.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ export default defineConfig({
66
model: {},
77
initialState: {},
88
request: {},
9+
// CI/E2E 时关闭 mock,避免 path-to-regexp 版本冲突导致 dev 服务器报错
10+
mock: process.env.CI ? false : undefined,
911
layout: {
1012
title: 'dbml-editor - free online DBML editor',
1113
locale: false,

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
"@ant-design/pro-components": "^2.4.4",
4141
"@antv/layout": "^0.3.25",
4242
"@antv/x6": "^2.18.1",
43+
"@antv/x6-common": "^2.0.17",
4344
"@antv/x6-plugin-snapline": "^2.1.7",
4445
"@antv/x6-react-shape": "^2.2.3",
4546
"@dbml/core": "^3.4.3",

pnpm-lock.yaml

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/e2e/editor.spec.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { expect, test } from '@playwright/test';
33
test.describe('DBML Editor - Basic Features', () => {
44
test.beforeEach(async ({ page }) => {
55
await page.goto('/');
6-
await page.waitForLoadState('networkidle');
6+
await page.waitForLoadState('load');
7+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
78
});
89

910
test('should load homepage', async ({ page }) => {
@@ -42,7 +43,8 @@ test.describe('DBML Editor - Basic Features', () => {
4243
test.describe('DBML Editor - Editing Features', () => {
4344
test.beforeEach(async ({ page }) => {
4445
await page.goto('/');
45-
await page.waitForLoadState('networkidle');
46+
await page.waitForLoadState('load');
47+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
4648
});
4749

4850
test('should edit DBML code', async ({ page }) => {
@@ -97,7 +99,8 @@ Table orders {
9799
test.describe('DBML Editor - Import Features', () => {
98100
test.beforeEach(async ({ page }) => {
99101
await page.goto('/');
100-
await page.waitForLoadState('networkidle');
102+
await page.waitForLoadState('load');
103+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
101104
});
102105

103106
test('should open import dialog', async ({ page }) => {
@@ -154,7 +157,8 @@ test.describe('DBML Editor - Import Features', () => {
154157
test.describe('DBML Editor - Export Features', () => {
155158
test.beforeEach(async ({ page }) => {
156159
await page.goto('/');
157-
await page.waitForLoadState('networkidle');
160+
await page.waitForLoadState('load');
161+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
158162
});
159163

160164
test('should open export dialog', async ({ page }) => {
@@ -208,7 +212,8 @@ test.describe('DBML Editor - Export Features', () => {
208212
test.describe('DBML Editor - Error Handling', () => {
209213
test.beforeEach(async ({ page }) => {
210214
await page.goto('/');
211-
await page.waitForLoadState('networkidle');
215+
await page.waitForLoadState('load');
216+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
212217
});
213218

214219
test('should display syntax error message', async ({ page }) => {

tests/e2e/er-diagram.spec.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { expect, test } from '@playwright/test';
33
test.describe('ER Diagram - Interaction', () => {
44
test.beforeEach(async ({ page }) => {
55
await page.goto('/');
6-
await page.waitForLoadState('networkidle');
6+
await page.waitForLoadState('load');
7+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
78
await page.waitForSelector('svg', { timeout: 10000 });
89
});
910

@@ -21,7 +22,12 @@ test.describe('ER Diagram - Interaction', () => {
2122
});
2223

2324
test('should display table names', async ({ page }) => {
24-
// Wait for diagram to render table names (CI is slower)
25+
// 等待 ER 图节点和文字渲染完成(layout 与 X6 渲染为异步)
26+
await expect(page.locator('svg g[data-cell-id]').first()).toBeVisible({
27+
timeout: 15000,
28+
});
29+
await expect(page.locator('svg text').first()).toBeVisible({ timeout: 15000 });
30+
2531
const tableNames = page.locator('svg text');
2632
await expect(tableNames.first()).toBeVisible({ timeout: 15000 });
2733

@@ -109,7 +115,8 @@ Ref: posts.user_id > users.id
109115
test.describe('ER Diagram - Layout', () => {
110116
test.beforeEach(async ({ page }) => {
111117
await page.goto('/');
112-
await page.waitForLoadState('networkidle');
118+
await page.waitForLoadState('load');
119+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
113120
await page.waitForSelector('svg', { timeout: 10000 });
114121
});
115122

@@ -181,7 +188,8 @@ Table products {
181188
test.describe('ER Diagram - Visual', () => {
182189
test.beforeEach(async ({ page }) => {
183190
await page.goto('/');
184-
await page.waitForLoadState('networkidle');
191+
await page.waitForLoadState('load');
192+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
185193
await page.waitForSelector('svg', { timeout: 10000 });
186194
await page.waitForTimeout(1000);
187195
});
@@ -197,6 +205,7 @@ test.describe('ER Diagram - Visual', () => {
197205
const rectCount = await rects.count();
198206
expect(rectCount).toBeGreaterThan(0);
199207

208+
await expect(page.locator('svg text').first()).toBeVisible({ timeout: 15000 });
200209
const texts = page.locator('svg text');
201210
const textCount = await texts.count();
202211
expect(textCount).toBeGreaterThan(0);

tests/e2e/export.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { expect, test } from '@playwright/test';
33
test.describe('Export - SQL Export Functionality', () => {
44
test.beforeEach(async ({ page }) => {
55
await page.goto('/');
6-
await page.waitForLoadState('networkidle');
6+
await page.waitForLoadState('load');
7+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
78
});
89

910
test('should open export modal', async ({ page }) => {

tests/e2e/toolbar.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import { expect, test } from '@playwright/test';
33
test.describe('Toolbar - Zoom Controls', () => {
44
test.beforeEach(async ({ page }) => {
55
await page.goto('/');
6-
await page.waitForLoadState('networkidle');
6+
await page.waitForLoadState('load');
7+
await expect(page.locator('.react-shape-app')).toBeVisible({ timeout: 15000 });
78
await page.waitForSelector('.zoom-toolbar', { timeout: 10000 });
89
await page.waitForTimeout(2000); // Wait for initial render
910
});

0 commit comments

Comments
 (0)