@@ -579,21 +579,34 @@ test('a link holder can export the room without exporting the room credential',
579579 const url = ( await roomLink . innerText ( ) ) . trim ( )
580580 await page . getByTestId ( 'go-to-room' ) . click ( )
581581
582- // Export is a row in Settings now, not a top-bar menu. The row says what you
583- // would get; the sheet behind it says who is in the file, and hands it over .
582+ // Import/export is one row in Settings. It names both jobs without implying
583+ // that a Splitwise file will be merged into the room currently open .
584584 await page . getByTestId ( 'open-room-settings' ) . click ( )
585585 await expect ( page . getByTestId ( 'settings-sheet' ) ) . toBeVisible ( { timeout : 15_000 } )
586586 const exportRow = page . getByTestId ( 'export-row' )
587- await expect ( exportRow ) . toContainText ( 'CSV · JSON' )
587+ await expect ( exportRow ) . toContainText ( 'Import / export' )
588+ await expect ( exportRow ) . toContainText ( 'Splitwise · CSV · JSON' )
588589 await exportRow . click ( )
589590
590591 const exportSheet = page . getByTestId ( 'export-sheet' )
591592 await expect ( exportSheet ) . toBeVisible ( )
593+ await expect ( exportSheet ) . toContainText ( 'Bring over a Splitwise group' )
594+ await expect ( exportSheet ) . toContainText ( 'This creates a new room. Your current room stays as it is.' )
595+ await expect ( page . getByTestId ( 'open-splitwise-import' ) ) . toBeVisible ( )
592596 // One disclosure sentence, and it does not claim to be the whole money
593597 // history — deleted records are left out, so that wording would be false.
598+ await expect ( exportSheet ) . toContainText ( 'Export this room' )
594599 await expect ( exportSheet ) . toContainText ( 'The file has everyone’s names and every expense and payment.' )
595600 await expect ( exportSheet ) . not . toContainText ( 'money history' )
596601
602+ const csvDownloadPromise = page . waitForEvent ( 'download' )
603+ await exportSheet . getByRole ( 'button' , { name : 'Download CSV' } ) . click ( )
604+ const csvDownload = await csvDownloadPromise
605+ expect ( csvDownload . suggestedFilename ( ) ) . toBe ( 'export-room.csv' )
606+ const csvPath = await csvDownload . path ( )
607+ expect ( csvPath ) . not . toBeNull ( )
608+ expect ( await readFile ( csvPath ! , 'utf8' ) ) . not . toContain ( new URL ( url ) . pathname )
609+
597610 const jsonDownloadPromise = page . waitForEvent ( 'download' )
598611 await exportSheet . getByRole ( 'button' , { name : 'Download JSON' } ) . click ( )
599612 const jsonDownload = await jsonDownloadPromise
@@ -612,4 +625,9 @@ test('a link holder can export the room without exporting the room credential',
612625 await page . getByTestId ( 'close-export-sheet' ) . click ( )
613626 await expect ( exportSheet ) . toHaveAttribute ( 'data-state' , 'closed' )
614627 await expect ( page . getByTestId ( 'settings-sheet' ) ) . toBeVisible ( )
628+
629+ await exportRow . click ( )
630+ await page . getByTestId ( 'open-splitwise-import' ) . click ( )
631+ await page . waitForURL ( '/import' )
632+ await expect ( page . getByTestId ( 'import-choose' ) ) . toBeVisible ( )
615633} )
0 commit comments