@@ -3,7 +3,8 @@ import { expect, test } from '@playwright/test';
33test . 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
109115test . 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 {
181188test . 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 ) ;
0 commit comments