FileManagerPage.test.tsx 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762
  1. /**
  2. * Tests for the FileManagerPage component.
  3. */
  4. import { describe, it, expect, beforeEach } from 'vitest';
  5. import { screen, waitFor } from '@testing-library/react';
  6. import userEvent from '@testing-library/user-event';
  7. import { render } from '../utils';
  8. import { FileManagerPage } from '../../pages/FileManagerPage';
  9. import { http, HttpResponse } from 'msw';
  10. import { server } from '../mocks/server';
  11. // Mock data
  12. const mockFolders = [
  13. {
  14. id: 1,
  15. name: 'Functional Parts',
  16. parent_id: null,
  17. file_count: 5,
  18. project_id: null,
  19. archive_id: null,
  20. project_name: null,
  21. archive_name: null,
  22. children: [
  23. {
  24. id: 2,
  25. name: 'Brackets',
  26. parent_id: 1,
  27. file_count: 3,
  28. project_id: null,
  29. archive_id: null,
  30. project_name: null,
  31. archive_name: null,
  32. children: [],
  33. },
  34. ],
  35. },
  36. {
  37. id: 3,
  38. name: 'Art Projects',
  39. parent_id: null,
  40. file_count: 2,
  41. project_id: 1,
  42. archive_id: null,
  43. project_name: 'My Art Project',
  44. archive_name: null,
  45. children: [],
  46. },
  47. ];
  48. const mockFiles = [
  49. {
  50. id: 1,
  51. filename: 'benchy.gcode.3mf',
  52. file_path: '/library/benchy.gcode.3mf',
  53. file_size: 1048576,
  54. file_type: '3mf',
  55. folder_id: null,
  56. thumbnail_path: '/thumbnails/1.png',
  57. print_name: 'Benchy',
  58. print_time_seconds: 3600,
  59. print_count: 5,
  60. duplicate_count: 0,
  61. created_at: '2024-01-01T00:00:00Z',
  62. },
  63. {
  64. id: 2,
  65. filename: 'bracket.stl',
  66. file_path: '/library/bracket.stl',
  67. file_size: 524288,
  68. file_type: 'stl',
  69. folder_id: null,
  70. thumbnail_path: null,
  71. print_name: null,
  72. print_time_seconds: null,
  73. print_count: 0,
  74. duplicate_count: 2,
  75. created_at: '2024-01-02T00:00:00Z',
  76. },
  77. {
  78. id: 3,
  79. filename: 'cube.gcode.3mf',
  80. file_path: '/library/cube.gcode.3mf',
  81. file_size: 2048576,
  82. file_type: '3mf',
  83. folder_id: null,
  84. thumbnail_path: '/thumbnails/3.png',
  85. print_name: 'Cube',
  86. print_time_seconds: 1800,
  87. print_count: 2,
  88. duplicate_count: 0,
  89. created_at: '2024-01-03T00:00:00Z',
  90. },
  91. ];
  92. const mockStats = {
  93. total_files: 10,
  94. total_folders: 3,
  95. total_size_bytes: 104857600,
  96. disk_free_bytes: 10737418240,
  97. disk_total_bytes: 107374182400,
  98. };
  99. describe('FileManagerPage', () => {
  100. beforeEach(() => {
  101. // Clear localStorage to ensure consistent view mode
  102. localStorage.clear();
  103. server.use(
  104. http.get('/api/v1/library/folders', () => {
  105. return HttpResponse.json(mockFolders);
  106. }),
  107. http.get('/api/v1/library/files', () => {
  108. return HttpResponse.json(mockFiles);
  109. }),
  110. http.get('/api/v1/library/stats', () => {
  111. return HttpResponse.json(mockStats);
  112. }),
  113. http.get('/api/v1/settings/', () => {
  114. return HttpResponse.json({
  115. check_updates: false,
  116. check_printer_firmware: false,
  117. library_disk_warning_gb: 5,
  118. });
  119. }),
  120. http.post('/api/v1/library/folders', async ({ request }) => {
  121. const body = await request.json() as { name: string };
  122. return HttpResponse.json({ id: 4, name: body.name, parent_id: null, children: [] });
  123. }),
  124. http.delete('/api/v1/library/folders/:id', () => {
  125. return HttpResponse.json({ success: true });
  126. }),
  127. http.delete('/api/v1/library/files/:id', () => {
  128. return HttpResponse.json({ success: true });
  129. }),
  130. http.post('/api/v1/library/files/move', () => {
  131. return HttpResponse.json({ success: true });
  132. }),
  133. http.post('/api/v1/library/files/add-to-queue', () => {
  134. return HttpResponse.json({ added: [{ file_id: 1, queue_id: 1 }], errors: [] });
  135. }),
  136. http.get('/api/v1/projects/', () => {
  137. return HttpResponse.json([{ id: 1, name: 'Test Project', color: '#00ae42' }]);
  138. }),
  139. http.get('/api/v1/archives/', () => {
  140. return HttpResponse.json([{ id: 1, print_name: 'Test Archive', filename: 'test.3mf' }]);
  141. })
  142. );
  143. });
  144. describe('rendering', () => {
  145. it('renders the page title', async () => {
  146. render(<FileManagerPage />);
  147. await waitFor(() => {
  148. expect(screen.getByText('File Manager')).toBeInTheDocument();
  149. });
  150. });
  151. it('renders the page description', async () => {
  152. render(<FileManagerPage />);
  153. await waitFor(() => {
  154. expect(screen.getByText('Organize and manage your print files')).toBeInTheDocument();
  155. });
  156. });
  157. it('shows New Folder button', async () => {
  158. render(<FileManagerPage />);
  159. await waitFor(() => {
  160. expect(screen.getByText('New Folder')).toBeInTheDocument();
  161. });
  162. });
  163. it('shows Upload button', async () => {
  164. render(<FileManagerPage />);
  165. await waitFor(() => {
  166. expect(screen.getByText('Upload')).toBeInTheDocument();
  167. });
  168. });
  169. });
  170. describe('stats display', () => {
  171. it('shows file count', async () => {
  172. render(<FileManagerPage />);
  173. await waitFor(() => {
  174. expect(screen.getByText('Files:')).toBeInTheDocument();
  175. expect(screen.getByText('10')).toBeInTheDocument();
  176. });
  177. });
  178. it('shows folder count', async () => {
  179. render(<FileManagerPage />);
  180. await waitFor(() => {
  181. expect(screen.getByText('Folders:')).toBeInTheDocument();
  182. // Folder count appears multiple places, just verify the label is present
  183. const foldersLabel = screen.getByText('Folders:');
  184. expect(foldersLabel.nextElementSibling?.textContent).toBe('3');
  185. });
  186. });
  187. it('shows total size', async () => {
  188. render(<FileManagerPage />);
  189. await waitFor(() => {
  190. expect(screen.getByText('Size:')).toBeInTheDocument();
  191. expect(screen.getByText('100.0 MB')).toBeInTheDocument();
  192. });
  193. });
  194. it('shows free space', async () => {
  195. render(<FileManagerPage />);
  196. await waitFor(() => {
  197. expect(screen.getByText('Free:')).toBeInTheDocument();
  198. });
  199. });
  200. });
  201. describe('folder sidebar', () => {
  202. it('shows All Files option', async () => {
  203. render(<FileManagerPage />);
  204. await waitFor(() => {
  205. expect(screen.getByText('All Files')).toBeInTheDocument();
  206. });
  207. });
  208. it('shows folder tree', async () => {
  209. render(<FileManagerPage />);
  210. await waitFor(() => {
  211. expect(screen.getByText('Functional Parts')).toBeInTheDocument();
  212. expect(screen.getByText('Art Projects')).toBeInTheDocument();
  213. });
  214. });
  215. it('shows nested folders', async () => {
  216. render(<FileManagerPage />);
  217. await waitFor(() => {
  218. expect(screen.getByText('Brackets')).toBeInTheDocument();
  219. });
  220. });
  221. it('shows linked folder indicator', async () => {
  222. render(<FileManagerPage />);
  223. await waitFor(() => {
  224. // Art Projects has a project_id
  225. expect(screen.getByText('Art Projects')).toBeInTheDocument();
  226. });
  227. });
  228. });
  229. describe('file display', () => {
  230. it('shows files in grid', async () => {
  231. render(<FileManagerPage />);
  232. await waitFor(() => {
  233. expect(screen.getByText('Benchy')).toBeInTheDocument();
  234. });
  235. });
  236. it('shows file type badges', async () => {
  237. render(<FileManagerPage />);
  238. await waitFor(() => {
  239. // File type badges show uppercase type
  240. expect(screen.getAllByText('3MF').length).toBeGreaterThan(0);
  241. expect(screen.getAllByText('STL').length).toBeGreaterThan(0);
  242. });
  243. });
  244. it('shows print count', async () => {
  245. render(<FileManagerPage />);
  246. await waitFor(() => {
  247. expect(screen.getByText('Printed 5x')).toBeInTheDocument();
  248. });
  249. });
  250. it('shows duplicate badge', async () => {
  251. render(<FileManagerPage />);
  252. await waitFor(() => {
  253. // Duplicate badge shows count, there may be multiple "2"s on the page
  254. // so we check that at least one element with "2" exists
  255. const elements = screen.getAllByText('2');
  256. expect(elements.length).toBeGreaterThan(0);
  257. });
  258. });
  259. });
  260. describe('view modes', () => {
  261. it('has grid view button', async () => {
  262. render(<FileManagerPage />);
  263. await waitFor(() => {
  264. expect(screen.getByTitle('Grid view')).toBeInTheDocument();
  265. });
  266. });
  267. it('has list view button', async () => {
  268. render(<FileManagerPage />);
  269. await waitFor(() => {
  270. expect(screen.getByTitle('List view')).toBeInTheDocument();
  271. });
  272. });
  273. it('can switch to list view', async () => {
  274. const user = userEvent.setup();
  275. render(<FileManagerPage />);
  276. // Wait for files to load first
  277. await waitFor(() => {
  278. expect(screen.getByText('Benchy')).toBeInTheDocument();
  279. });
  280. // Both view mode buttons should be present and clickable
  281. const gridButton = screen.getByTitle('Grid view');
  282. const listButton = screen.getByTitle('List view');
  283. expect(gridButton).toBeInTheDocument();
  284. expect(listButton).toBeInTheDocument();
  285. // Click list view button - verify no errors occur
  286. await user.click(listButton);
  287. // Clicking grid button should also work
  288. await user.click(gridButton);
  289. // Verify files are still displayed after toggling
  290. expect(screen.getByText('Benchy')).toBeInTheDocument();
  291. });
  292. });
  293. describe('search and filter', () => {
  294. it('has search input', async () => {
  295. render(<FileManagerPage />);
  296. await waitFor(() => {
  297. expect(screen.getByPlaceholderText('Search files...')).toBeInTheDocument();
  298. });
  299. });
  300. it('has type filter', async () => {
  301. render(<FileManagerPage />);
  302. await waitFor(() => {
  303. expect(screen.getByText('All types')).toBeInTheDocument();
  304. });
  305. });
  306. it('has sort options', async () => {
  307. render(<FileManagerPage />);
  308. await waitFor(() => {
  309. // Sort dropdown should show Name as default option (persisted to localStorage)
  310. expect(screen.getByDisplayValue('Name')).toBeInTheDocument();
  311. });
  312. });
  313. });
  314. describe('selection', () => {
  315. it('shows select all button', async () => {
  316. render(<FileManagerPage />);
  317. await waitFor(() => {
  318. expect(screen.getByText('Select All')).toBeInTheDocument();
  319. });
  320. });
  321. it('can select files', async () => {
  322. const user = userEvent.setup();
  323. render(<FileManagerPage />);
  324. await waitFor(() => {
  325. expect(screen.getByText('Benchy')).toBeInTheDocument();
  326. });
  327. // Click on the file card to select it
  328. const fileCard = screen.getByText('Benchy').closest('div[class*="cursor-pointer"]');
  329. if (fileCard) {
  330. await user.click(fileCard);
  331. }
  332. await waitFor(() => {
  333. expect(screen.getByText('1 selected')).toBeInTheDocument();
  334. });
  335. });
  336. it('shows bulk actions when files selected', async () => {
  337. const user = userEvent.setup();
  338. render(<FileManagerPage />);
  339. await waitFor(() => {
  340. expect(screen.getByText('Select All')).toBeInTheDocument();
  341. });
  342. await user.click(screen.getByText('Select All'));
  343. await waitFor(() => {
  344. expect(screen.getByText('Move')).toBeInTheDocument();
  345. expect(screen.getByText('Delete')).toBeInTheDocument();
  346. });
  347. });
  348. });
  349. describe('new folder modal', () => {
  350. it('opens new folder modal', async () => {
  351. const user = userEvent.setup();
  352. render(<FileManagerPage />);
  353. await waitFor(() => {
  354. expect(screen.getByText('New Folder')).toBeInTheDocument();
  355. });
  356. await user.click(screen.getByText('New Folder'));
  357. await waitFor(() => {
  358. expect(screen.getByText('Folder Name')).toBeInTheDocument();
  359. expect(screen.getByPlaceholderText('e.g., Functional Parts')).toBeInTheDocument();
  360. });
  361. });
  362. it('can create a folder', async () => {
  363. const user = userEvent.setup();
  364. render(<FileManagerPage />);
  365. await waitFor(() => {
  366. expect(screen.getByText('New Folder')).toBeInTheDocument();
  367. });
  368. await user.click(screen.getByText('New Folder'));
  369. await waitFor(() => {
  370. expect(screen.getByPlaceholderText('e.g., Functional Parts')).toBeInTheDocument();
  371. });
  372. const input = screen.getByPlaceholderText('e.g., Functional Parts');
  373. await user.type(input, 'My New Folder');
  374. const createButton = screen.getByRole('button', { name: 'Create' });
  375. await user.click(createButton);
  376. // Modal should close after creation
  377. await waitFor(() => {
  378. expect(screen.queryByText('Folder Name')).not.toBeInTheDocument();
  379. });
  380. });
  381. });
  382. describe('empty state', () => {
  383. it('shows empty state when no files', async () => {
  384. server.use(
  385. http.get('/api/v1/library/files', () => {
  386. return HttpResponse.json([]);
  387. })
  388. );
  389. render(<FileManagerPage />);
  390. await waitFor(() => {
  391. expect(screen.getByText('No files yet')).toBeInTheDocument();
  392. expect(screen.getByText('Upload Files')).toBeInTheDocument();
  393. });
  394. });
  395. });
  396. describe('schedule print', () => {
  397. it('shows schedule print button when one sliced file is selected', async () => {
  398. const user = userEvent.setup();
  399. render(<FileManagerPage />);
  400. await waitFor(() => {
  401. expect(screen.getByText('Benchy')).toBeInTheDocument();
  402. });
  403. // Select a sliced file (benchy.gcode.3mf) by clicking on its card
  404. const fileCard = screen.getByText('Benchy').closest('div[class*="cursor-pointer"]');
  405. if (fileCard) {
  406. await user.click(fileCard);
  407. }
  408. await waitFor(() => {
  409. expect(screen.getByText(/Schedule/)).toBeInTheDocument();
  410. });
  411. });
  412. it('hides schedule print button when multiple files are selected', async () => {
  413. const user = userEvent.setup();
  414. render(<FileManagerPage />);
  415. await waitFor(() => {
  416. expect(screen.getByText('Select All')).toBeInTheDocument();
  417. });
  418. // Select all files
  419. await user.click(screen.getByText('Select All'));
  420. await waitFor(() => {
  421. // Schedule button should not be present when multiple files are selected
  422. expect(screen.queryByText(/Schedule/)).not.toBeInTheDocument();
  423. });
  424. });
  425. });
  426. describe('STL thumbnail generation', () => {
  427. it('shows Generate Thumbnails button', async () => {
  428. render(<FileManagerPage />);
  429. await waitFor(() => {
  430. expect(screen.getByText('Generate Thumbnails')).toBeInTheDocument();
  431. });
  432. });
  433. it('Generate Thumbnails button has correct title', async () => {
  434. render(<FileManagerPage />);
  435. await waitFor(() => {
  436. const button = screen.getByTitle('Generate thumbnails for STL files missing them');
  437. expect(button).toBeInTheDocument();
  438. });
  439. });
  440. it('can click Generate Thumbnails button', async () => {
  441. const user = userEvent.setup();
  442. server.use(
  443. http.post('/api/v1/library/generate-stl-thumbnails', () => {
  444. return HttpResponse.json({
  445. processed: 1,
  446. succeeded: 1,
  447. failed: 0,
  448. results: [{ file_id: 2, success: true }],
  449. });
  450. })
  451. );
  452. render(<FileManagerPage />);
  453. await waitFor(() => {
  454. expect(screen.getByText('Generate Thumbnails')).toBeInTheDocument();
  455. });
  456. const button = screen.getByText('Generate Thumbnails');
  457. await user.click(button);
  458. // Button should work without error
  459. await waitFor(() => {
  460. expect(screen.getByText('Generate Thumbnails')).toBeInTheDocument();
  461. });
  462. });
  463. it('shows STL file without thumbnail in file list', async () => {
  464. render(<FileManagerPage />);
  465. await waitFor(() => {
  466. // bracket.stl has no thumbnail_path
  467. expect(screen.getByText('bracket.stl')).toBeInTheDocument();
  468. expect(screen.getAllByText('STL').length).toBeGreaterThan(0);
  469. });
  470. });
  471. });
  472. describe('upload modal with advanced 3MF support', () => {
  473. it('opens upload modal', async () => {
  474. const user = userEvent.setup();
  475. render(<FileManagerPage />);
  476. await waitFor(() => {
  477. expect(screen.getByText('Upload')).toBeInTheDocument();
  478. });
  479. await user.click(screen.getByText('Upload'));
  480. await waitFor(() => {
  481. expect(screen.getByText('Upload Files')).toBeInTheDocument();
  482. expect(screen.getByText(/Drag & drop/)).toBeInTheDocument();
  483. });
  484. });
  485. it('shows 3MF extraction info when 3MF file is added', async () => {
  486. const user = userEvent.setup();
  487. render(<FileManagerPage />);
  488. await waitFor(() => {
  489. expect(screen.getByText('Upload')).toBeInTheDocument();
  490. });
  491. await user.click(screen.getByText('Upload'));
  492. await waitFor(() => {
  493. expect(screen.getByText('Upload Files')).toBeInTheDocument();
  494. });
  495. // Create a mock 3MF file
  496. const threemfFile = new File(['content'], 'model.gcode.3mf', { type: 'application/octet-stream' });
  497. // Get the hidden file input
  498. const fileInput = document.querySelector('input[type="file"]') as HTMLInputElement;
  499. expect(fileInput).toBeInTheDocument();
  500. // Simulate file selection
  501. await user.upload(fileInput, threemfFile);
  502. // 3MF extraction info should appear
  503. await waitFor(() => {
  504. expect(screen.getByText('3MF files detected')).toBeInTheDocument();
  505. expect(screen.getByText(/Printer model.*will be automatically extracted/i)).toBeInTheDocument();
  506. });
  507. });
  508. it('shows STL thumbnail option when STL file is added', async () => {
  509. const user = userEvent.setup();
  510. render(<FileManagerPage />);
  511. await waitFor(() => {
  512. expect(screen.getByText('Upload')).toBeInTheDocument();
  513. });
  514. await user.click(screen.getByText('Upload'));
  515. await waitFor(() => {
  516. expect(screen.getByText('Upload Files')).toBeInTheDocument();
  517. });
  518. // Create a mock STL file
  519. const stlFile = new File(['solid test'], 'model.stl', { type: 'application/sla' });
  520. // Get the hidden file input
  521. const fileInput = document.querySelector('input[type="file"]') as HTMLInputElement;
  522. expect(fileInput).toBeInTheDocument();
  523. // Simulate file selection
  524. await user.upload(fileInput, stlFile);
  525. // STL thumbnail option should appear
  526. await waitFor(() => {
  527. expect(screen.getByText('STL thumbnail generation')).toBeInTheDocument();
  528. expect(screen.getByText(/Thumbnails can be generated/i)).toBeInTheDocument();
  529. });
  530. });
  531. });
  532. describe('authentication-based UI changes', () => {
  533. it('hides "Uploaded By" column and user filter when auth is disabled', async () => {
  534. // Mock auth disabled (default)
  535. server.use(
  536. http.get('*/api/v1/auth/status', () => {
  537. return HttpResponse.json({
  538. auth_enabled: false,
  539. requires_setup: false,
  540. });
  541. }),
  542. http.get('/api/v1/library/files', () => {
  543. return HttpResponse.json([
  544. {
  545. id: 1,
  546. filename: 'test.3mf',
  547. file_path: '/library/test.3mf',
  548. file_size: 1048576,
  549. file_type: '3mf',
  550. folder_id: null,
  551. thumbnail_path: null,
  552. print_name: 'Test File',
  553. print_time_seconds: 3600,
  554. print_count: 0,
  555. duplicate_count: 0,
  556. created_at: '2024-01-01T00:00:00Z',
  557. created_by_username: 'testuser',
  558. },
  559. ]);
  560. })
  561. );
  562. render(<FileManagerPage />);
  563. // Switch to list view to see the column headers
  564. await waitFor(() => {
  565. expect(screen.getByText('Test File')).toBeInTheDocument();
  566. });
  567. const user = userEvent.setup();
  568. const listViewButton = screen.getByRole('button', { name: /list/i });
  569. await user.click(listViewButton);
  570. // "Uploaded By" column header should not be present
  571. await waitFor(() => {
  572. expect(screen.queryByText('Uploaded By')).not.toBeInTheDocument();
  573. });
  574. // User filter dropdown should not be present
  575. expect(screen.queryByPlaceholderText('Filter by user')).not.toBeInTheDocument();
  576. });
  577. it('shows "Uploaded By" column and user filter when auth is enabled', async () => {
  578. // Mock auth enabled
  579. server.use(
  580. http.get('*/api/v1/auth/status', () => {
  581. return HttpResponse.json({
  582. auth_enabled: true,
  583. requires_setup: false,
  584. });
  585. }),
  586. http.get('/api/v1/library/files', () => {
  587. return HttpResponse.json([
  588. {
  589. id: 1,
  590. filename: 'test.3mf',
  591. file_path: '/library/test.3mf',
  592. file_size: 1048576,
  593. file_type: '3mf',
  594. folder_id: null,
  595. thumbnail_path: null,
  596. print_name: 'Test File',
  597. print_time_seconds: 3600,
  598. print_count: 0,
  599. duplicate_count: 0,
  600. created_at: '2024-01-01T00:00:00Z',
  601. created_by_username: 'testuser',
  602. },
  603. ]);
  604. }),
  605. http.get('/api/v1/users/', () => {
  606. return HttpResponse.json([
  607. { id: 1, username: 'testuser' },
  608. { id: 2, username: 'admin' },
  609. ]);
  610. })
  611. );
  612. render(<FileManagerPage />);
  613. // Switch to list view to see the column headers
  614. await waitFor(() => {
  615. expect(screen.getByText('Test File')).toBeInTheDocument();
  616. });
  617. const user = userEvent.setup();
  618. const listViewButton = screen.getByRole('button', { name: /list/i });
  619. await user.click(listViewButton);
  620. // "Uploaded By" column header should be present
  621. await waitFor(() => {
  622. expect(screen.getByText('Uploaded By')).toBeInTheDocument();
  623. });
  624. // User filter dropdown should be present
  625. expect(screen.getByPlaceholderText('Filter by user')).toBeInTheDocument();
  626. // Username should be displayed in the column
  627. expect(screen.getByText('testuser')).toBeInTheDocument();
  628. });
  629. });
  630. });