@@ -9,36 +9,46 @@ test.describe("column-chart-web", () => {
9
9
test . beforeEach ( async ( { page } ) => {
10
10
await page . goto ( "/" ) ;
11
11
await page . waitForLoadState ( "networkidle" ) ;
12
+ await page . locator ( ".mx-name-actionButton1" ) . click ( ) ;
13
+ await page . waitForLoadState ( "networkidle" ) ;
12
14
} ) ;
13
15
14
16
test . describe ( "column color" , ( ) => {
15
17
test ( "renders column chart with default color and compares with a screenshot baseline" , async ( { page } ) => {
16
- const defaultColorContainer = page . locator ( ".mx-name-containerDefaultColor" ) ;
18
+ const defaultColorContainer = page . locator ( ".mx-name-containerDefaultColor .widget-chart " ) ;
17
19
await defaultColorContainer . scrollIntoViewIfNeeded ( ) ;
18
20
await expect ( defaultColorContainer ) . toBeVisible ( { timeout : 10000 } ) ;
21
+ // Ensure the chart is fully rendered before taking a screenshot
22
+ await page . waitForTimeout ( 1000 ) ; // Wait for 1 second
19
23
await expect ( defaultColorContainer ) . toHaveScreenshot ( `columnChartDefaultColor.png` ) ;
20
24
} ) ;
21
25
22
26
test ( "renders column chart with custom color and compares with a screenshot baseline" , async ( { page } ) => {
23
- const customColorContainer = page . locator ( ".mx-name-containerCustomColor" ) ;
27
+ const customColorContainer = page . locator ( ".mx-name-containerCustomColor .widget-chart " ) ;
24
28
await customColorContainer . scrollIntoViewIfNeeded ( ) ;
25
29
await expect ( customColorContainer ) . toBeVisible ( { timeout : 10000 } ) ;
30
+ // Ensure the chart is fully rendered before taking a screenshot
31
+ await page . waitForTimeout ( 1000 ) ; // Wait for 1 second
26
32
await expect ( customColorContainer ) . toHaveScreenshot ( `columnChartCustomColor.png` ) ;
27
33
} ) ;
28
34
} ) ;
29
35
30
36
test . describe ( "column format" , ( ) => {
31
37
test ( "renders column chart with grouped format and compares with a screenshot baseline" , async ( { page } ) => {
32
- const groupContainer = page . locator ( ".mx-name-containerGroup" ) ;
38
+ const groupContainer = page . locator ( ".mx-name-containerGroup .widget-chart " ) ;
33
39
await groupContainer . scrollIntoViewIfNeeded ( ) ;
34
40
await expect ( groupContainer ) . toBeVisible ( { timeout : 10000 } ) ;
41
+ // Ensure the chart is fully rendered before taking a screenshot
42
+ await page . waitForTimeout ( 1000 ) ; // Wait for 1 second
35
43
await expect ( groupContainer ) . toHaveScreenshot ( `columnChartGrouped.png` ) ;
36
44
} ) ;
37
45
38
46
test ( "renders column chart with stacked format and compares with a screenshot baseline" , async ( { page } ) => {
39
- const stackContainer = page . locator ( ".mx-name-containerStack" ) ;
47
+ const stackContainer = page . locator ( ".mx-name-containerStack .widget-chart " ) ;
40
48
await stackContainer . scrollIntoViewIfNeeded ( ) ;
41
49
await expect ( stackContainer ) . toBeVisible ( { timeout : 10000 } ) ;
50
+ // Ensure the chart is fully rendered before taking a screenshot
51
+ await page . waitForTimeout ( 1000 ) ; // Wait for 1 second
42
52
await expect ( stackContainer ) . toHaveScreenshot ( `columnChartStacked.png` ) ;
43
53
} ) ;
44
54
} ) ;
0 commit comments