@@ -40,7 +40,8 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async (
4040 await chat . agentGreeting . waitFor ( { state : "visible" } ) ;
4141
4242 // Store initial background color
43- const initialBackground = await chat . getBackground ( ) ;
43+ const backgroundContainer = page . locator ( '[data-testid="background-container"]' )
44+ const initialBackground = await backgroundContainer . evaluate ( el => getComputedStyle ( el ) . backgroundColor ) ;
4445 console . log ( "Initial background color:" , initialBackground ) ;
4546
4647 // 1. Send message to change background to blue
@@ -50,8 +51,8 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async (
5051 ) ;
5152 await waitForAIResponse ( page ) ;
5253
53- const backgroundBlue = await chat . getBackground ( ) ;
54- expect ( backgroundBlue ) . not . toBe ( initialBackground ) ;
54+ await expect ( backgroundContainer ) . not . toHaveCSS ( 'background-color' , initialBackground , { timeout : 7000 } ) ;
55+ const backgroundBlue = await backgroundContainer . evaluate ( el => getComputedStyle ( el ) . backgroundColor ) ;
5556 // Check if background is blue (string color name or contains blue)
5657 expect ( backgroundBlue . toLowerCase ( ) ) . toMatch ( / b l u e | r g b \( .* , .* , .* \) | # [ 0 - 9 a - f ] { 6 } / ) ;
5758
@@ -62,8 +63,8 @@ test("[LangGraph] Agentic Chat changes background on message and reset", async (
6263 ) ;
6364 await waitForAIResponse ( page ) ;
6465
65- const backgroundPink = await chat . getBackground ( ) ;
66- expect ( backgroundPink ) . not . toBe ( backgroundBlue ) ;
66+ await expect ( backgroundContainer ) . not . toHaveCSS ( 'background-color' , backgroundBlue , { timeout : 7000 } ) ;
67+ const backgroundPink = await backgroundContainer . evaluate ( el => getComputedStyle ( el ) . backgroundColor ) ;
6768 // Check if background is pink (string color name or contains pink)
6869 expect ( backgroundPink . toLowerCase ( ) ) . toMatch ( / p i n k | r g b \( .* , .* , .* \) | # [ 0 - 9 a - f ] { 6 } / ) ;
6970 } ) ;
0 commit comments