native-environment.spec.ts 1.5 KB

12345678910111213
  1. import {test,expect} from '@playwright/test'
  2. import {mkdirSync} from 'node:fs'
  3. test('Web shows native desktop permissions',async({page})=>{
  4. const evidence='test-results/native-environment';mkdirSync(evidence,{recursive:true})
  5. await page.goto('/conversations');await page.getByRole('textbox',{name:'账号',exact:true}).fill('fixture');await page.getByRole('textbox',{name:'密码',exact:true}).fill('fixture-pass');await page.getByRole('button',{name:'登录',exact:true}).click()
  6. await page.locator('.desktop-sidebar .sidebar-create-trigger').click();await page.getByRole('menuitem',{name:'新建 Bot',exact:true}).click();const editor=page.getByRole('dialog');await editor.getByRole('textbox',{name:'名称',exact:true}).fill('本机控制验收');await editor.getByRole('button',{name:'保存',exact:true}).click()
  7. await page.getByRole('button',{name:'电脑与定时任务',exact:true}).click()
  8. const panel=page.getByRole('complementary',{name:'机器人电脑面板'})
  9. await expect(panel.getByRole('tab',{name:'本机',exact:true})).toBeEnabled({timeout:15000});await panel.getByRole('tab',{name:'本机',exact:true}).click()
  10. await expect(panel.getByRole('button',{name:'在桌面端授权',exact:true})).toBeVisible();await expect(panel.getByText(/连接电脑:/)).toBeVisible();await page.screenshot({path:evidence+'/desktop-native-permissions.png'})
  11. await expect(panel.getByRole('tab',{name:'仅浏览器',exact:true})).toHaveCount(0)
  12. await expect(panel.getByRole('checkbox',{name:'脚本机浏览器',exact:true})).toHaveCount(0)
  13. })