增加 Chromium 浏览器逐站权限管理
This commit is contained in:
1 parent
0b89634af2
commit
f4ea1f8e03
8 files changed
+165
-6
No files matched your search
@@ -96,6 +96,21 @@ test('双端联系人实时同步,桌面浏览器独立分区与 UA', { timeou
|
||||
const userAgent = requests.find((entry) => entry.path === '/first').userAgent
|
||||
assert.ok(userAgent.includes('Chrome/' + site.version))
|
||||
assert.match(userAgent, /XHChat\/0\.1\.0/)
|
||||
const permission = (location) => app.evaluate(async ({ webContents }, location) => {
|
||||
const page = webContents.getAllWebContents().find((entry) => entry.getURL() === location)
|
||||
if (!page) throw new Error('找不到权限测试网页')
|
||||
return page.executeJavaScript('navigator.permissions.query({name:"notifications"}).then(x=>x.state)')
|
||||
}, location)
|
||||
assert.notEqual(await permission(url + '/first'), 'granted')
|
||||
await toolbar.getByRole('button', { name: '网站权限', exact: true }).click()
|
||||
await toolbar.locator('#permission-origin').getByText(url, { exact: true }).waitFor()
|
||||
await toolbar.getByLabel('通知', { exact: true }).check()
|
||||
await toolbar.getByRole('button', { name: '网站权限', exact: true }).click()
|
||||
assert.equal(await permission(url + '/first'), 'granted')
|
||||
await toolbar.getByRole('button', { name: '网站权限', exact: true }).click()
|
||||
await toolbar.getByLabel('通知', { exact: true }).uncheck()
|
||||
await toolbar.getByRole('button', { name: '网站权限', exact: true }).click()
|
||||
assert.notEqual(await permission(url + '/first'), 'granted')
|
||||
await toolbar.getByRole('button', { name: '添加书签', exact: true }).click()
|
||||
await toolbar.getByRole('button', { name: '取消书签', exact: true }).waitFor()
|
||||
await toolbar.getByRole('button', { name: '书签与历史', exact: true }).click()
|
||||
|
||||
Reference in new issue
Block a user