@@ -9,36 +9,46 @@ test.describe("column-chart-web", () => {
99 test . beforeEach ( async ( { page } ) => {
1010 await page . goto ( "/" ) ;
1111 await page . waitForLoadState ( "networkidle" ) ;
12+ await page . locator ( ".mx-name-actionButton1" ) . click ( ) ;
13+ await page . waitForLoadState ( "networkidle" ) ;
1214 } ) ;
1315
1416 test . describe ( "column color" , ( ) => {
1517 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 " ) ;
1719 await defaultColorContainer . scrollIntoViewIfNeeded ( ) ;
1820 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
1923 await expect ( defaultColorContainer ) . toHaveScreenshot ( `columnChartDefaultColor.png` ) ;
2024 } ) ;
2125
2226 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 " ) ;
2428 await customColorContainer . scrollIntoViewIfNeeded ( ) ;
2529 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
2632 await expect ( customColorContainer ) . toHaveScreenshot ( `columnChartCustomColor.png` ) ;
2733 } ) ;
2834 } ) ;
2935
3036 test . describe ( "column format" , ( ) => {
3137 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 " ) ;
3339 await groupContainer . scrollIntoViewIfNeeded ( ) ;
3440 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
3543 await expect ( groupContainer ) . toHaveScreenshot ( `columnChartGrouped.png` ) ;
3644 } ) ;
3745
3846 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 " ) ;
4048 await stackContainer . scrollIntoViewIfNeeded ( ) ;
4149 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
4252 await expect ( stackContainer ) . toHaveScreenshot ( `columnChartStacked.png` ) ;
4353 } ) ;
4454 } ) ;
0 commit comments