mirror of
https://github.com/shumaiOne/shumai.git
synced 2026-12-05 23:54:25 +00:00
test(e2e): guard clipboard permissions in copy-menu spec for cross-browser support
This commit is contained in:
@@ -1,10 +1,15 @@
|
|||||||
import { expect, test } from '../../fixtures'
|
import { expect, test } from '../../fixtures'
|
||||||
import { fileCard } from '../../helpers/files'
|
import { fileCard } from '../../helpers/files'
|
||||||
|
|
||||||
test('owner sees Copy submenu in context menu and copies file name', async ({ file }) => {
|
test('owner sees Copy submenu in context menu and copies file name', async ({
|
||||||
|
file,
|
||||||
|
browserName,
|
||||||
|
}) => {
|
||||||
const { page, projectId, fileName } = file
|
const { page, projectId, fileName } = file
|
||||||
|
|
||||||
await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
|
if (browserName === 'chromium') {
|
||||||
|
await page.context().grantPermissions(['clipboard-read', 'clipboard-write'])
|
||||||
|
}
|
||||||
await page.goto(`/projects/${projectId}`)
|
await page.goto(`/projects/${projectId}`)
|
||||||
await expect(fileCard(page, fileName)).toBeVisible()
|
await expect(fileCard(page, fileName)).toBeVisible()
|
||||||
|
|
||||||
@@ -31,6 +36,8 @@ test('owner sees Copy submenu in context menu and copies file name', async ({ fi
|
|||||||
})
|
})
|
||||||
await expect(toast).toBeVisible()
|
await expect(toast).toBeVisible()
|
||||||
|
|
||||||
const clipboardText = await page.evaluate(() => navigator.clipboard.readText())
|
if (browserName === 'chromium') {
|
||||||
expect(clipboardText).toBe(fileName)
|
const clipboardText = await page.evaluate(() => navigator.clipboard.readText())
|
||||||
|
expect(clipboardText).toBe(fileName)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user