test files in cli and cross with password

This commit is contained in:
2023-05-25 10:17:01 +02:00
parent b43b802221
commit fb95a68b0d
13 changed files with 225 additions and 62 deletions

View File

@@ -1,5 +0,0 @@
export default {
PDF: 'test/assets/AES.pdf',
Image: 'test/assets/image.jpg',
Zip: 'test/assets/Pigeons.zip',
}

View File

@@ -1,13 +1,13 @@
import { test } from '@playwright/test'
import { checkLinkForDownload, createNote, getFileChecksum } from '../../utils'
import Files from './files'
import { Files, getFileChecksum } from '../../files'
import { checkLinkForDownload, createNote } from '../../utils'
test.describe('@web', () => {
test('multiple', async ({ page }) => {
const files = [Files.PDF, Files.Image]
const checksums = await Promise.all(files.map(getFileChecksum))
const link = await createNote(page, { files, views: 2 })
await checkLinkForDownload(page, link, 'image.jpg', checksums[1])
await checkLinkForDownload(page, link, 'AES.pdf', checksums[0])
await checkLinkForDownload(page, { link, text: 'image.jpg', checksum: checksums[1] })
await checkLinkForDownload(page, { link, text: 'AES.pdf', checksum: checksums[0] })
})
})

View File

@@ -1,12 +1,12 @@
import { test } from '@playwright/test'
import { checkLinkDoesNotExist, checkLinkForDownload, checkLinkForText, createNote, getFileChecksum } from '../../utils'
import Files from './files'
import { Files, getFileChecksum } from '../../files'
import { checkLinkDoesNotExist, checkLinkForDownload, checkLinkForText, createNote } from '../../utils'
test.describe('@web', () => {
test('simple pdf', async ({ page }) => {
const files = [Files.PDF]
const link = await createNote(page, { files })
await checkLinkForText(page, link, 'AES.pdf')
await checkLinkForText(page, { link, text: 'AES.pdf' })
await checkLinkDoesNotExist(page, link)
})
@@ -14,13 +14,21 @@ test.describe('@web', () => {
const files = [Files.PDF]
const checksum = await getFileChecksum(files[0])
const link = await createNote(page, { files })
await checkLinkForDownload(page, link, 'AES.pdf', checksum)
await checkLinkForDownload(page, { link, text: 'AES.pdf', checksum })
})
test('image content', async ({ page }) => {
const files = [Files.Image]
const checksum = await getFileChecksum(files[0])
const link = await createNote(page, { files })
await checkLinkForDownload(page, link, 'image.jpg', checksum)
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)
})
})

View File

@@ -1,6 +1,6 @@
import { test } from '@playwright/test'
import { createNote } from '../../utils'
import Files from './files'
import { Files } from '../../files'
test.describe('@web', () => {
test.skip('to big zip', async ({ page }) => {