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