Files
deepseek-harness/apps/web/tests/linear-connection.e2e.ts
T
gengruilin 98152040cb fix(connector): drop the word "plugin" from the connector titles
The seven connectors' titles named the package kind next to the app:
"飞书插件", "Feishu plugin", "Complemento de Feishu". The Plugins page
and the Connectors tab already say what their entries are, so each
title is now the app's name alone in the eight shipped languages:
飞书, 企业微信, 钉钉, 腾讯会议 and 腾讯文档 in Chinese; Feishu, WeCom,
DingTalk, Tencent Meeting and Tencent Docs in the other seven; Notion
and Linear in all eight.

The Connectors tab keeps its own copy of the 56 titles, and the copy
follows. The tab's Install and Open buttons, its switches and its
switch failure line name the connector by this title, and so does each
card's View button on the Plugins page. Sentences that say "the Feishu
plugin" stay as they are: the activation text, the model guidance, the
skills, the package descriptions and the READMEs.

The tab's unit expectations, its Web e2e spec and expected output, and
the seven connection e2e specs follow the new titles.
2026-11-24 17:29:32 +08:00

78 lines
4.1 KiB
TypeScript

// Web e2e scenario: connecting the Linear plugin from its page on the Plugins
// page. The section reads the MCP manager's real entry, the browser opens the
// loopback authorization server's page, the Host callback answers with its
// completion page, the connection reaches the manager, and sign-out returns the
// section to disconnected. Zero model calls.
import { mkdtemp, rm, writeFile } from 'node:fs/promises'
import { tmpdir } from 'node:os'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import type { Browser, BrowserContext, Page } from 'playwright'
import { chromium } from 'playwright'
import { afterAll, beforeAll, describe, expect, it, onTestFailed } from 'vitest'
import { startLinearOAuthFixture, type LinearOAuthFixture } from './linear-oauth-fixture.ts'
import { launchWebScaffold, watchConsole, type WebScaffold } from './scaffold.ts'
import { ZH_BROWSER_LOCALE, saveFailureShot } from './support.ts'
const LINEAR_DIR = fileURLToPath(new URL('../../../packages/connector/linear', import.meta.url))
describe('web e2e: Linear plugin connection', () => {
let fixture: LinearOAuthFixture
let overlayDir: string
let scaffold: WebScaffold
let browser: Browser
let context: BrowserContext
let page: Page
let tripwire: ReturnType<typeof watchConsole>
beforeAll(async () => {
fixture = await startLinearOAuthFixture()
overlayDir = await mkdtemp(join(tmpdir(), 'dsh-linear-e2e-'))
const overlay = join(overlayDir, 'linear.overlay.yml')
await writeFile(overlay, `- id: linear\n config:\n url: ${fixture.origin}/mcp\n`)
scaffold = await launchWebScaffold({
extraOverlayPath: [fileURLToPath(new URL('./pin-browse-picker.overlay.yml', import.meta.url)), overlay],
profile: { packages: [{ dir: LINEAR_DIR, enabled: true }] },
})
browser = await chromium.launch()
context = await browser.newContext({ viewport: { width: 1680, height: 1000 }, locale: ZH_BROWSER_LOCALE })
page = await context.newPage()
tripwire = watchConsole(page)
await page.goto(scaffold.authenticatedUrl, { waitUntil: 'load' })
await page.waitForSelector('[class*="frame"]', { timeout: 30_000 })
}, 120_000)
afterAll(async () => {
await browser?.close()
await scaffold?.close()
await fixture?.close()
if (overlayDir !== undefined) await rm(overlayDir, { recursive: true, force: true })
})
it('connects the account from the plugin page and signs out after confirmation', async () => {
onTestFailed(() => saveFailureShot(page, 'web-e2e-linear-connection'))
await page.getByRole('navigation', { name: '全局面板' }).getByRole('button', { name: '插件', exact: true }).click()
const panel = page.locator('[data-plugin-panel]')
await panel.getByRole('button', { name: '查看 Linear', exact: true }).click({ timeout: 20_000 })
const section = panel.locator('[data-connector-account]')
await expect.poll(() => section.getAttribute('data-connector-account'), { timeout: 20_000 }).toBe('disconnected')
expect(await panel.locator('[data-plugin-detail]').getByText('未连接', { exact: true }).count()).toBe(2)
const opened = context.waitForEvent('page')
await section.getByRole('button', { name: '连接 Linear', exact: true }).click()
const authorization = await opened
await expect.poll(async () => await authorization.locator('body').textContent(), { timeout: 20_000 })
.toContain('已收到授权。可以关闭此页,回到 DSH 查看连接结果。')
await expect.poll(() => section.getAttribute('data-connector-account'), { timeout: 20_000 }).toBe('connected')
await page.getByText('Linear 已连接', { exact: true }).waitFor({ timeout: 10_000 })
expect(fixture.authorizations()).toBe(1)
await authorization.close()
await section.getByRole('button', { name: '退出登录', exact: true }).click()
await page.getByRole('dialog', { name: '退出 Linear 登录?' }).getByRole('button', { name: '退出登录', exact: true }).click()
await expect.poll(() => section.getAttribute('data-connector-account'), { timeout: 20_000 }).toBe('disconnected')
expect(tripwire.pageErrors).toEqual([])
expect(fixture.failures()).toEqual([])
})
})