@@ -38,18 +38,10 @@ const mocks = vi.hoisted(() => {
3838 fields : {
3939 name : { type : 'text' , label : 'Text (Name)' } ,
4040 description : { type : 'textarea' , label : 'Text Area' } ,
41- password : { type : 'password' , label : 'Password' } ,
42- amount : { type : 'number' , label : 'Number (Int)' } ,
43- price : { type : 'currency' , label : 'Currency' } ,
44- percent : { type : 'percent' , label : 'Percentage' } ,
4541 due_date : { type : 'date' , label : 'Date' } ,
46- event_time : { type : 'datetime' , label : 'Date Time' } ,
42+ amount : { type : 'number' , label : 'Number (Int)' , scale : 0 } ,
43+ account : { type : 'lookup' , label : 'Lookup (Account)' , reference_to : 'account' } ,
4744 is_active : { type : 'boolean' , label : 'Boolean (Switch)' } ,
48- category : { type : 'select' , label : 'Select (Dropdown)' , options : [ ] } ,
49- email : { type : 'email' , label : 'Email' } ,
50- url : { type : 'url' , label : 'URL' } ,
51- phone : { type : 'phone' , label : 'Phone' } ,
52- color : { type : 'color' , label : 'Color Picker' }
5345 }
5446 } ;
5547 }
@@ -181,24 +173,21 @@ describe('Console Application Simulation', () => {
181173 const fieldLabels = [
182174 'Text (Name)' ,
183175 'Text Area' ,
184- 'Password ' ,
176+ 'Date ' ,
185177 'Number (Int)' ,
186- 'Currency' ,
187- 'Percentage' ,
188- // 'Date', // Date pickers might require specific mocks not present in JSDOM or are failing to render
189- // 'Date Time',
190- // 'Boolean (Switch)',
191- // 'Select (Dropdown)', // Select might also be complex
192- // 'Email',
193- // 'URL',
194- // 'Phone',
195- // 'Color Picker'
178+ 'Lookup (Account)' ,
179+ 'Boolean (Switch)' ,
196180 ] ;
197181
198182 // Check each label exists
199183 for ( const label of fieldLabels ) {
200184 const escaped = label . replace ( / [ . * + ? ^ $ { } ( ) | [ \] \\ ] / g, '\\$&' ) ;
201- const elements = screen . getAllByText ( new RegExp ( escaped , 'i' ) ) ;
185+ const regex = new RegExp ( escaped , 'i' ) ;
186+ const elements = screen . queryAllByText ( regex ) ;
187+ if ( elements . length === 0 ) {
188+ console . log ( `Failed to find label: ${ label } ` ) ;
189+ // console.log(document.body.innerHTML); // Too large, but useful if localized
190+ }
202191 expect ( elements . length ) . toBeGreaterThan ( 0 ) ;
203192 }
204193
@@ -207,4 +196,25 @@ describe('Console Application Simulation', () => {
207196 // but finding by Text works for verifying presence.
208197 } ) ;
209198
199+ it ( 'Scenario 5: Report Rendering (Report Page)' , async ( ) => {
200+ renderApp ( '/page/report_page' ) ;
201+
202+ // Verify Report Title
203+ await waitFor ( ( ) => {
204+ expect ( screen . getByText ( / S a l e s P e r f o r m a n c e R e p o r t / i) ) . toBeInTheDocument ( ) ;
205+ } ) ;
206+
207+ // Verify Description
208+ expect ( screen . getByText ( / M o n t h l y b r e a k d o w n o f s a l e s / i) ) . toBeInTheDocument ( ) ;
209+
210+ // Verify Data Grid Headers
211+ expect ( screen . getByText ( 'Region' ) ) . toBeInTheDocument ( ) ;
212+ expect ( screen . getByText ( 'Sales' ) ) . toBeInTheDocument ( ) ;
213+ expect ( screen . getByText ( 'Target' ) ) . toBeInTheDocument ( ) ;
214+
215+ // Verify Data Rows
216+ expect ( screen . getByText ( 'North' ) ) . toBeInTheDocument ( ) ;
217+ expect ( screen . getAllByText ( '5000' ) . length ) . toBeGreaterThan ( 0 ) ;
218+ } ) ;
219+
210220} ) ;
0 commit comments