mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-11-22 20:57:45 +00:00
Add six domain-level web app e2e tests covering team member removal, file upload/delete/restore, share link creation and password protection, and collection creation. Introduce a parametrized 'file' fixture with configurable media types (text/binary/image/video/pdf) for future type-scoped tests, plus helpers for share APIs and team member seeding. Also document all web app e2e test cases in apps/web/e2e/README.md and require this documentation in AGENTS.md.
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
import { expect, test } from '../../fixtures'
|
|
import { fileCard } from '../../helpers/files'
|
|
|
|
test('owner deletes a file, finds it in recently deleted, and restores it', async ({
|
|
file,
|
|
prisma,
|
|
}) => {
|
|
const { page, projectId, fileName, fileId } = file
|
|
|
|
await page.goto(`/projects/${projectId}`)
|
|
await expect(fileCard(page, fileName)).toBeVisible()
|
|
|
|
// Delete through the context menu + confirmation dialog
|
|
await fileCard(page, fileName).click({ button: 'right' })
|
|
await page.getByRole('menuitem', { name: 'Delete' }).click()
|
|
|
|
const deleteDialog = page.getByRole('alertdialog')
|
|
await expect(deleteDialog.getByText('Delete Asset?')).toBeVisible()
|
|
await deleteDialog.getByRole('button', { name: 'Delete' }).click()
|
|
|
|
await expect(fileCard(page, fileName)).not.toBeVisible()
|
|
|
|
let asset = await prisma.asset.findUnique({ where: { id: fileId } })
|
|
expect(asset?.isDeleted).toBe(true)
|
|
expect(asset?.deletedAt).not.toBeNull()
|
|
|
|
// Navigate to the Recently Deleted view
|
|
await page.getByText('Recently Deleted').click()
|
|
await expect(page).toHaveURL(/\/recently-deleted/)
|
|
await expect(fileCard(page, fileName)).toBeVisible()
|
|
|
|
// Restore through the context menu
|
|
await fileCard(page, fileName).click({ button: 'right' })
|
|
await page.getByRole('menuitem', { name: 'Restore' }).click()
|
|
|
|
await expect(fileCard(page, fileName)).not.toBeVisible()
|
|
|
|
asset = await prisma.asset.findUnique({ where: { id: fileId } })
|
|
expect(asset?.isDeleted).toBe(false)
|
|
expect(asset?.deletedAt).toBeNull()
|
|
|
|
// Back at the project root the file is visible again
|
|
await page.goto(`/projects/${projectId}`)
|
|
await expect(fileCard(page, fileName)).toBeVisible()
|
|
})
|