1+ import type { Page } from "@playwright/test" ;
12import { withRequestedMailbox } from "./harness" ;
23import { expectRequestBudget } from "./request-budget" ;
34import { expect , test } from "./test" ;
4- import { desktop , mobile , screenshot } from "./screenshot" ;
5+ import { screenshot } from "./screenshot" ;
56
67const ACTIVE_CONVERSATION_ID = "slack:CQA123:1770003600.000200" ;
7- const DASHBOARD_QA_CONVERSATION_ID = "internal:dashboard-qa" ;
8+ const FINISHED_CONVERSATION_ID = "slack:CQA777:1770014400.000500" ;
9+
10+ async function openActiveConversation ( page : Page , baseURL : string ) {
11+ await page . goto (
12+ `${ baseURL } /conversations/${ encodeURIComponent ( ACTIVE_CONVERSATION_ID ) } ` ,
13+ ) ;
14+ await expect (
15+ page . getByRole ( "heading" , {
16+ name : "Investigate checkout latency" ,
17+ exact : true ,
18+ } ) ,
19+ ) . toBeVisible ( ) ;
20+ }
821
922test ( "records loaded conversation views" , async ( { page, dashboard } ) => {
1023 let releaseFeed : ( ( ) => void ) | undefined ;
@@ -30,22 +43,31 @@ test("records loaded conversation views", async ({ page, dashboard }) => {
3043 await expect ( composer ) . toBeFocused ( ) ;
3144 await screenshot ( page , "conversation-create-focused" ) ;
3245
46+ // A running Conversation polls every 2 seconds, so a slow load would
47+ // count a poll. Measure a finished one, which does not poll its detail.
3348 await expectRequestBudget (
3449 page ,
3550 async ( ) => {
3651 await page . goto (
37- `${ dashboard . baseURL } /conversations/${ encodeURIComponent ( ACTIVE_CONVERSATION_ID ) } ` ,
52+ `${ dashboard . baseURL } /conversations/${ encodeURIComponent ( FINISHED_CONVERSATION_ID ) } ` ,
3853 { waitUntil : "networkidle" } ,
3954 ) ;
4055 await expect (
4156 page . getByRole ( "heading" , {
42- name : "Investigate checkout latency " ,
57+ name : "Deployment investigation failed " ,
4358 exact : true ,
4459 } ) ,
4560 ) . toBeVisible ( ) ;
4661 } ,
47- { requests : 10 , serialRounds : 2 } ,
62+ { requests : 9 , serialRounds : 2 } ,
4863 ) ;
64+ } ) ;
65+
66+ test ( "keeps the conversation list choice and width after a reload" , async ( {
67+ page,
68+ dashboard,
69+ } ) => {
70+ await openActiveConversation ( page , dashboard . baseURL ) ;
4971 const conversationList = page . getByRole ( "navigation" , {
5072 name : "Your conversations" ,
5173 } ) ;
@@ -84,6 +106,13 @@ test("records loaded conversation views", async ({ page, dashboard }) => {
84106 await expect ( conversationList ) . toBeVisible ( ) ;
85107 // The saved width rounds to whole pixels.
86108 await expect . poll ( listSize ) . toBeCloseTo ( resizedSize , 0 ) ;
109+ } ) ;
110+
111+ test ( "keeps the details panel width and usage after a reload" , async ( {
112+ page,
113+ dashboard,
114+ } ) => {
115+ await openActiveConversation ( page , dashboard . baseURL ) ;
87116
88117 await page
89118 . getByRole ( "button" , { name : "Conversation details" , exact : true } )
@@ -117,7 +146,21 @@ test("records loaded conversation views", async ({ page, dashboard }) => {
117146 await expect ( modelBreakdown ) . toBeVisible ( ) ;
118147 await usage . click ( ) ;
119148 await expect ( modelBreakdown ) . toBeHidden ( ) ;
120- // Turn context takes the details panel and gives it back on close.
149+ } ) ;
150+
151+ test ( "turn context takes the details panel and gives it back" , async ( {
152+ page,
153+ dashboard,
154+ } ) => {
155+ await openActiveConversation ( page , dashboard . baseURL ) ;
156+ await page
157+ . getByRole ( "button" , { name : "Conversation details" , exact : true } )
158+ . click ( ) ;
159+ const details = page . getByRole ( "complementary" , {
160+ name : "Conversation details" ,
161+ exact : true ,
162+ } ) ;
163+ await expect ( details ) . toBeVisible ( ) ;
121164 const contextAction = page . getByRole ( "button" , { name : "View turn context" } ) ;
122165 await contextAction . scrollIntoViewIfNeeded ( ) ;
123166 await contextAction . focus ( ) ;
@@ -170,103 +213,6 @@ test("records loaded conversation views", async ({ page, dashboard }) => {
170213 await expect ( contextSheet ) . toBeHidden ( ) ;
171214 await expect ( contextAction ) . toBeFocused ( ) ;
172215 await screenshot ( page , "conversation-detail" ) ;
173-
174- await page . goto (
175- `${ dashboard . baseURL } /conversations/${ encodeURIComponent ( DASHBOARD_QA_CONVERSATION_ID ) } ` ,
176- { waitUntil : "networkidle" } ,
177- ) ;
178- await expect (
179- page . getByRole ( "heading" , {
180- name : "Dashboard QA edge cases" ,
181- exact : true ,
182- } ) ,
183- ) . toBeVisible ( ) ;
184- const inputImage = page . getByRole ( "img" , { name : "input-chart.png" } ) ;
185- await inputImage . scrollIntoViewIfNeeded ( ) ;
186- await expect ( inputImage ) . toBeVisible ( ) ;
187- await inputImage . click ( ) ;
188- const inputPreview = page . getByRole ( "dialog" , { name : "input-chart.png" } ) ;
189- await expect ( inputPreview ) . toBeVisible ( ) ;
190- // The sent image is not part of the response, so it has no pager.
191- await expect (
192- inputPreview . getByRole ( "button" , { name : "Next image" } ) ,
193- ) . toHaveCount ( 0 ) ;
194- await inputPreview
195- . getByRole ( "button" , { name : "Close" , exact : true } )
196- . click ( ) ;
197- const image = page
198- . locator ( 'a[href*="/attachments/qa-chart-png"]' )
199- . filter ( { has : page . locator ( 'img[alt="chart.png"]' ) } )
200- . first ( ) ;
201- await image . waitFor ( { state : "visible" } ) ;
202- // A resize keeps another scroll position, so center the image in each view.
203- for ( const view of [ desktop , mobile ] ) {
204- await page . setViewportSize ( view ) ;
205- await image . evaluate ( ( element ) =>
206- element . scrollIntoView ( { block : "center" , inline : "nearest" } ) ,
207- ) ;
208- await screenshot ( page , "conversation-attachment" , { view : view . name } ) ;
209- }
210-
211- await image . click ( ) ;
212- const preview = page . getByRole ( "dialog" , { name : "chart.png" } ) ;
213- await expect ( preview ) . toBeVisible ( ) ;
214- await expect ( preview . getByText ( "1 of 2" ) ) . toBeVisible ( ) ;
215- await screenshot ( page , "conversation-attachment-modal" ) ;
216- // The preview pages through the images of one response.
217- await preview . getByRole ( "button" , { name : "Next image" } ) . click ( ) ;
218- const detailPreview = page . getByRole ( "dialog" , { name : "chart-detail.png" } ) ;
219- await expect ( detailPreview . getByText ( "2 of 2" ) ) . toBeVisible ( ) ;
220- await page . keyboard . press ( "ArrowRight" ) ;
221- await expect ( preview . getByText ( "1 of 2" ) ) . toBeVisible ( ) ;
222-
223- // Touch readers swipe to page and dismiss, and pinch to zoom. Real touch
224- // input checks that the frame keeps a gesture after a finger leaves it.
225- await page . setViewportSize ( mobile ) ;
226- const touch = await page . context ( ) . newCDPSession ( page ) ;
227- const pinch = (
228- type : "touchStart" | "touchMove" | "touchEnd" ,
229- points : { id : number ; x : number ; y : number } [ ] ,
230- ) => touch . send ( "Input.dispatchTouchEvent" , { touchPoints : points , type } ) ;
231- const swipe = async (
232- from : { x : number ; y : number } ,
233- dx : number ,
234- dy : number ,
235- ) => {
236- await pinch ( "touchStart" , [ { id : 1 , ...from } ] ) ;
237- for ( const step of [ 0.25 , 0.5 , 0.75 , 1 ] ) {
238- await pinch ( "touchMove" , [
239- { id : 1 , x : from . x + dx * step , y : from . y + dy * step } ,
240- ] ) ;
241- }
242- await pinch ( "touchEnd" , [ ] ) ;
243- } ;
244- await swipe ( { x : 300 , y : 450 } , - 200 , 0 ) ;
245- await expect ( detailPreview . getByText ( "2 of 2" ) ) . toBeVisible ( ) ;
246- await swipe ( { x : 100 , y : 450 } , 200 , 0 ) ;
247- await expect ( preview . getByText ( "1 of 2" ) ) . toBeVisible ( ) ;
248- // A short swipe springs back, so the preview still pages.
249- await swipe ( { x : 200 , y : 300 } , 0 , 30 ) ;
250- await page . keyboard . press ( "ArrowRight" ) ;
251- await expect ( detailPreview . getByText ( "2 of 2" ) ) . toBeVisible ( ) ;
252- await swipe ( { x : 200 , y : 300 } , 0 , 250 ) ;
253- await expect ( detailPreview ) . toBeHidden ( ) ;
254-
255- await image . click ( ) ;
256- await expect ( preview . getByText ( "1 of 2" ) ) . toBeVisible ( ) ;
257- await pinch ( "touchStart" , [
258- { id : 1 , x : 180 , y : 450 } ,
259- { id : 2 , x : 210 , y : 450 } ,
260- ] ) ;
261- await pinch ( "touchMove" , [
262- { id : 1 , x : 120 , y : 450 } ,
263- { id : 2 , x : 300 , y : 700 } ,
264- ] ) ;
265- await pinch ( "touchEnd" , [ ] ) ;
266- await touch . detach ( ) ;
267- await screenshot ( page , "conversation-attachment-zoom" ) ;
268- await page . keyboard . press ( "Escape" ) ;
269- await expect ( preview ) . toBeHidden ( ) ;
270216} ) ;
271217
272218test ( "reuses the fresh conversation feed after window focus" , async ( {
0 commit comments