test: scope agent build draft e2e selector (#38563)

This commit is contained in:
yyh 2026-07-08 18:32:57 +08:00 committed by GitHub
parent 94ba597d32
commit 1340bef096
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 4 deletions

View File

@ -1,4 +1,4 @@
import type { Response } from '@playwright/test'
import type { Page, Response } from '@playwright/test'
import type { DifyWorld } from '../../support/world'
import { readFile } from 'node:fs/promises'
import { Given, Then, When } from '@cucumber/cucumber'
@ -34,6 +34,9 @@ import {
const BUILD_DRAFT_RUNTIME_STEP_TIMEOUT_MS = 180_000
const getBuildDraftBar = (page: Page) =>
page.getByRole('group', { name: 'Build draft' })
Given(
'an Agent v2 Build draft adds the supported E2E files, skills, and env',
async function (this: DifyWorld) {
@ -138,7 +141,7 @@ When(
await page.getByRole('button', { name: 'Start build' }).click()
expect((await checkoutResponsePromise).ok()).toBe(true)
expect((await chatResponsePromise).ok()).toBe(true)
await expect(page.getByText('Build draft')).toBeVisible({ timeout: 120_000 })
await expect(getBuildDraftBar(page)).toBeVisible({ timeout: 120_000 })
await expect(page.getByRole('button', { exact: true, name: 'Apply' })).toBeEnabled({ timeout: 120_000 })
await expect(page.getByRole('button', { exact: true, name: 'Discard' })).toBeEnabled()
},
@ -245,7 +248,7 @@ Then('Agent v2 Build chat unavailable Skill and Tool recovery should be availabl
Then('I should see the Agent v2 Build draft pending changes', async function (this: DifyWorld) {
const page = this.getPage()
await expect(page.getByText('Build draft')).toBeVisible({ timeout: 30_000 })
await expect(getBuildDraftBar(page)).toBeVisible({ timeout: 30_000 })
await expect(page.getByRole('button', { exact: true, name: 'Apply' })).toBeEnabled()
await expect(page.getByRole('button', { exact: true, name: 'Discard' })).toBeEnabled()
})
@ -401,7 +404,7 @@ Then(
Then('the Agent v2 Build draft should no longer be active', async function (this: DifyWorld) {
const page = this.getPage()
await expect(page.getByText('Build draft')).not.toBeVisible()
await expect(getBuildDraftBar(page)).not.toBeVisible()
await expect(page.getByRole('button', { name: 'Apply' })).not.toBeVisible()
await expect(page.getByRole('button', { name: 'Discard' })).not.toBeVisible()
})

View File

@ -55,6 +55,8 @@ export function AgentBuildDraftBar({
<CollapsibleRoot
open={open}
onOpenChange={handleOpenChange}
role="group"
aria-label={t('agentDetail.configure.buildDraft.title')}
className="group/build-draft pointer-events-auto relative w-full max-w-full min-w-0 overflow-hidden rounded-xl border-[1.5px] border-[#A0BDFF] bg-components-panel-bg-blur shadow-lg shadow-shadow-shadow-5 backdrop-blur-[10px]"
>
<AgentBuildGridTexture