@@ -279,7 +279,22 @@ test('JSON Schema validation', async ({ page, browserName, workflow }) => {
279279 expect ( exportedData . requiredObject . referencedRequiredNestedObject . optionalMax ) . toEqual ( 5 ) ;
280280 } ) ;
281281
282- await test . step ( 'Attempt to import invalid file' , async ( ) => {
282+ await test . step ( 'Attempt to import a file containing invalid JSON' , async ( ) => {
283+ await page . getByRole ( 'button' , { name : 'Import' } ) . click ( ) ;
284+ const modalTitle = page . locator ( '.modal.show .modal-title' ) ;
285+ await modalTitle . waitFor ( ) ;
286+ await expect ( modalTitle ) . toHaveText ( 'Import arguments' ) ;
287+ const fileChooserPromise = page . waitForEvent ( 'filechooser' ) ;
288+ await page . getByText ( 'Select arguments file' ) . click ( ) ;
289+ const fileChooser = await fileChooserPromise ;
290+ await fileChooser . setFiles ( path . join ( __dirname , 'data' , 'broken.json' ) ) ;
291+ await page . getByRole ( 'button' , { name : 'Confirm' } ) . click ( ) ;
292+ await page . getByText ( "File doesn't contain valid JSON" ) . waitFor ( ) ;
293+ await page . getByRole ( 'button' , { name : 'Close' } ) . click ( ) ;
294+ await waitModalClosed ( page ) ;
295+ } ) ;
296+
297+ await test . step ( 'Attempt to import a file containing invalid arguments' , async ( ) => {
283298 const invalidData = { ...exportedData , requiredEnum : 'invalid' } ;
284299 fs . writeFileSync ( downloadedFile , JSON . stringify ( invalidData ) ) ;
285300 await page . getByRole ( 'button' , { name : 'Import' } ) . click ( ) ;
0 commit comments