Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

test(e2e): split agent build draft apply coverage (#38431)

yyh95102479c625
diff --git a/e2e/features/agent-v2/build-draft.feature b/e2e/features/agent-v2/build-draft.feature
index 9ef9cc3ab17..b3476541e34 100644
--- a/e2e/features/agent-v2/build-draft.feature
+++ b/e2e/features/agent-v2/build-draft.feature
@@ -75,12 +75,10 @@ Feature: Agent v2 build draft
Then I should see the updated E2E prompt in the Agent v2 prompt editor
And the Agent v2 Build draft should no longer be active
- @external-model @agent-backend-runtime @stable-model @skill-fixture
+ @core @skill-fixture
Scenario: Applying a Build draft updates supported configuration sections
Given I am signed in as the default E2E admin
- And the Agent Builder stable chat model is available
- And the Agent v2 runtime backend is available
- And a runnable Agent v2 test agent has been created via API
+ And a basic configured Agent v2 test agent has been created via API
And an Agent v2 Build draft adds the supported E2E files, skills, and env
When I open the Agent v2 configure page
Then I should see the Agent v2 Build draft pending changes
@@ -89,13 +87,8 @@ Feature: Agent v2 build draft
And I should see the e2e-summary-skill Skill in the Skills section
And I should see the supported E2E environment variable in Advanced Settings
And the normal Agent v2 draft should still use the normal E2E prompt
- When I apply the Agent v2 Build draft
- Then I should see the updated E2E prompt in the Agent v2 prompt editor
- And I should see the small Agent v2 file in the Files section
- And I should see the e2e-summary-skill Skill in the Skills section
- And I should see the supported E2E environment variable in Advanced Settings
- And the Agent v2 draft should include the supported Build draft config
- And the Agent v2 Build draft should no longer be active
+ When I apply the Agent v2 Build draft via API
+ Then the Agent v2 draft should include the supported Build draft config
When I refresh the current page
Then I should see the updated E2E prompt in the Agent v2 prompt editor
And I should see the small Agent v2 file in the Files section
@@ -103,24 +96,21 @@ Feature: Agent v2 build draft
And I should see the supported E2E environment variable in Advanced Settings
And the Agent v2 Build draft should no longer be active
- @external-model @agent-backend-runtime @stable-model @skill-fixture
+ @core @skill-fixture
Scenario: Applying a Build draft with an existing Skill keeps a single Skill entry
Given I am signed in as the default E2E admin
- And the Agent Builder stable chat model is available
- And the Agent v2 runtime backend is available
- And a runnable Agent v2 test agent has been created via API
+ And a basic configured Agent v2 test agent has been created via API
And an Agent v2 Build draft includes the existing e2e-summary-skill Skill
When I open the Agent v2 configure page
Then I should see the Agent v2 Build draft pending changes
And I should see one e2e-summary-skill Skill in the Skills section
And the Agent v2 draft should include one e2e-summary-skill Skill
- When I apply the Agent v2 Build draft
- Then I should see one e2e-summary-skill Skill in the Skills section
- And the Agent v2 draft should include one e2e-summary-skill Skill
- And the Agent v2 Build draft should no longer be active
+ When I apply the Agent v2 Build draft via API
+ Then the Agent v2 draft should include one e2e-summary-skill Skill
When I refresh the current page
Then I should see one e2e-summary-skill Skill in the Skills section
And the Agent v2 draft should include one e2e-summary-skill Skill
+ And the Agent v2 Build draft should no longer be active
@core
Scenario: Pending Build draft remains protected after leaving Configure
diff --git a/e2e/features/agent-v2/support/agent-build-draft.ts b/e2e/features/agent-v2/support/agent-build-draft.ts
index 68227e39d5f..3e65cd4f75d 100644
--- a/e2e/features/agent-v2/support/agent-build-draft.ts
+++ b/e2e/features/agent-v2/support/agent-build-draft.ts
@@ -39,6 +39,17 @@ export async function saveAgentBuildDraft(
}
}
+export async function applyAgentBuildDraft(agentId: string): Promise<void> {
+ const ctx = await createApiContext()
+ try {
+ const response = await ctx.post(`/console/api/agent/${agentId}/build-draft/apply`)
+ await expectApiResponseOK(response, `Apply Agent v2 build draft for ${agentId}`)
+ }
+ finally {
+ await ctx.dispose()
+ }
+}
+
export async function discardAgentBuildDraft(agentId: string): Promise<void> {
const ctx = await createApiContext()
try {
diff --git a/e2e/features/step-definitions/agent-v2/build-draft.steps.ts b/e2e/features/step-definitions/agent-v2/build-draft.steps.ts
index b9e5ff7335b..9443197e6e8 100644
--- a/e2e/features/step-definitions/agent-v2/build-draft.steps.ts
+++ b/e2e/features/step-definitions/agent-v2/build-draft.steps.ts
@@ -7,7 +7,10 @@ import {
getAgentComposerDraft,
saveAgentComposerDraft,
} from '../../agent-v2/support/agent'
-import { saveAgentBuildDraft } from '../../agent-v2/support/agent-build-draft'
+import {
+ applyAgentBuildDraft,
+ saveAgentBuildDraft,
+} from '../../agent-v2/support/agent-build-draft'
import { agentBuilderFixedInputs, agentBuilderPreseededResources } from '../../agent-v2/support/agent-builder-resources'
import { uploadAgentConfigFileToDraft } from '../../agent-v2/support/agent-drive'
import {
@@ -184,6 +187,10 @@ When(
},
)
+When('I apply the Agent v2 Build draft via API', async function (this: DifyWorld) {
+ await applyAgentBuildDraft(getCurrentAgentId(this))
+})
+
async function skipBuildDraftToolWriteback(world: DifyWorld) {
return skipBlockedPrecondition(
world,