11import { test , expect } from '@playwright/test' ;
2- import { expectExecutionProgressBarSucceeded } from './utils/expect' ;
3- import { readFromCodeEditor } from './utils/editor' ;
2+ import { expectExecutionProgressBarSucceeded , expectToMatchTimestamp } from './utils/expect' ;
3+ import { readFromCodeEditor , readFromCodeEditorAsJson } from './utils/editor' ;
4+ import { getLabeledValueText } from './utils/labeledValue' ;
45
56test . describe ( 'Manual Scripts' , ( ) => {
67 test ( 'Execute CSV Generation With I/O' , async ( { page } ) => {
@@ -16,7 +17,7 @@ test.describe('Manual Scripts', () => {
1617 await page . getByRole ( 'button' , { name : 'Start' } ) . click ( ) ;
1718 await expectExecutionProgressBarSucceeded ( page ) ;
1819
19- const output = await readFromCodeEditor ( page ) ;
20+ const output = await readFromCodeEditor ( page , 'Execution Output' ) ;
2021 expect ( output ) . toContain ( '[SUCCESS] Users CSV report generation ended successfully' ) ;
2122
2223 await page . getByRole ( 'button' , { name : 'Review' } ) . click ( ) ;
@@ -41,5 +42,48 @@ test.describe('Manual Scripts', () => {
4142 await page . getByRole ( 'button' , { name : 'Download Report' } ) . click ( ) ;
4243 const downloadReport = await downloadReportPromise ;
4344 expect ( downloadReport . suggestedFilename ( ) ) . toMatch ( / \. c s v $ / ) ;
45+
46+
47+ await page . getByRole ( 'tab' , { name : 'Details' } ) . click ( ) ;
48+
49+ const executionStatus = page . locator ( '#execution-status' ) ;
50+ const executionId = await getLabeledValueText ( page , 'ID' , executionStatus ) ;
51+ expect ( executionId ) . toMatch ( / ^ 2 0 2 5 \/ \d + \/ \d + \/ \d + \/ \d + \/ / ) ;
52+
53+ await expect ( page . getByText ( 'admin' ) ) . toBeVisible ( ) ;
54+ await expect ( page . getByText ( 'succeeded' , { exact : false } ) ) . toBeVisible ( ) ;
55+
56+ const executionTiming = page . locator ( '#execution-timing' ) ;
57+ const startedAt = await getLabeledValueText ( page , 'Started At' , executionTiming ) ;
58+ expectToMatchTimestamp ( startedAt ) ;
59+
60+ const duration = await getLabeledValueText ( page , 'Duration' , executionTiming ) ;
61+ expect ( duration ) . toMatch ( / \d + m s \( \d + s e c o n d s ? \) / ) ;
62+
63+ const endedAt = await getLabeledValueText ( page , 'Ended At' , executionTiming ) ;
64+ expectToMatchTimestamp ( endedAt ) ;
65+
66+ const inputs = await readFromCodeEditorAsJson < Record < string , any > > ( page , 'Execution Inputs JSON' ) ;
67+ expect ( inputs ) . toEqual ( {
68+ count : 5000 ,
69+ firstNames : 'John\nJane\nJack\nAlice\nBob\nRobert' ,
70+ lastNames : 'Doe\nSmith\nBrown\nJohnson\nWhite\nJordan' ,
71+ } ) ;
72+
73+ const outputs = await readFromCodeEditorAsJson < Array < any > > ( page , 'Execution Outputs JSON' ) ;
74+ expect ( outputs ) . toHaveLength ( 2 ) ;
75+ expect ( outputs [ 0 ] ) . toMatchObject ( {
76+ type : 'FILE' ,
77+ name : 'report' ,
78+ label : 'Report' ,
79+ downloadName : 'report.csv' ,
80+ } ) ;
81+ expect ( outputs [ 1 ] ) . toMatchObject ( {
82+ type : 'TEXT' ,
83+ name : 'summary' ,
84+ value : 'Processed 5000 user(s)' ,
85+ } ) ;
86+
87+ await page . getByRole ( 'button' , { name : 'Close' } ) . click ( ) ;
4488 } ) ;
4589} ) ;
0 commit comments