2023-05-14 11:52:47 +00:00
|
|
|
import { test } from '@playwright/test'
|
2023-05-25 08:17:01 +00:00
|
|
|
import { Files, getFileChecksum } from '../../files'
|
|
|
|
import { checkLinkDoesNotExist, checkLinkForDownload, checkLinkForText, createNote } from '../../utils'
|
2023-05-14 11:52:47 +00:00
|
|
|
|
|
|
|
test.describe('@web', () => {
|
|
|
|
test('simple pdf', async ({ page }) => {
|
|
|
|
const files = [Files.PDF]
|
|
|
|
const link = await createNote(page, { files })
|
2023-05-25 08:17:01 +00:00
|
|
|
await checkLinkForText(page, { link, text: 'AES.pdf' })
|
2023-05-14 11:52:47 +00:00
|
|
|
await checkLinkDoesNotExist(page, link)
|
|
|
|
})
|
|
|
|
|
|
|
|
test('pdf content', async ({ page }) => {
|
|
|
|
const files = [Files.PDF]
|
|
|
|
const checksum = await getFileChecksum(files[0])
|
|
|
|
const link = await createNote(page, { files })
|
2023-05-25 08:17:01 +00:00
|
|
|
await checkLinkForDownload(page, { link, text: 'AES.pdf', checksum })
|
2023-05-14 11:52:47 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
test('image content', async ({ page }) => {
|
|
|
|
const files = [Files.Image]
|
|
|
|
const checksum = await getFileChecksum(files[0])
|
|
|
|
const link = await createNote(page, { files })
|
2023-05-25 08:17:01 +00:00
|
|
|
await checkLinkForDownload(page, { link, text: 'image.jpg', checksum })
|
|
|
|
})
|
|
|
|
|
|
|
|
test('simple pdf with password', async ({ page }) => {
|
|
|
|
const files = [Files.PDF]
|
|
|
|
const password = 'password'
|
|
|
|
const link = await createNote(page, { files, password })
|
|
|
|
await checkLinkForText(page, { link, text: 'AES.pdf', password })
|
|
|
|
await checkLinkDoesNotExist(page, link)
|
2023-05-14 11:52:47 +00:00
|
|
|
})
|
|
|
|
})
|