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: add e2e scenarios for app creation and sign-out (#34285)

lif4c6b8f9229f4
diff --git a/e2e/features/apps/create-chatbot-app.feature b/e2e/features/apps/create-chatbot-app.feature
new file mode 100644
index 00000000000..4f506e4f409
--- /dev/null
+++ b/e2e/features/apps/create-chatbot-app.feature
@@ -0,0 +1,11 @@
+@apps @authenticated
+Feature: Create Chatbot app
+ Scenario: Create a new Chatbot app and redirect to the configuration page
+ Given I am signed in as the default E2E admin
+ When I open the apps console
+ And I start creating a blank app
+ And I expand the beginner app types
+ And I select the "Chatbot" app type
+ And I enter a unique E2E app name
+ And I confirm app creation
+ Then I should land on the app configuration page
diff --git a/e2e/features/apps/create-workflow-app.feature b/e2e/features/apps/create-workflow-app.feature
new file mode 100644
index 00000000000..b88d94d899c
--- /dev/null
+++ b/e2e/features/apps/create-workflow-app.feature
@@ -0,0 +1,10 @@
+@apps @authenticated
+Feature: Create Workflow app
+ Scenario: Create a new Workflow app and redirect to the workflow editor
+ Given I am signed in as the default E2E admin
+ When I open the apps console
+ And I start creating a blank app
+ And I select the "Workflow" app type
+ And I enter a unique E2E app name
+ And I confirm app creation
+ Then I should land on the workflow editor
diff --git a/e2e/features/auth/sign-out.feature b/e2e/features/auth/sign-out.feature
new file mode 100644
index 00000000000..0f377ea1334
--- /dev/null
+++ b/e2e/features/auth/sign-out.feature
@@ -0,0 +1,8 @@
+@auth @authenticated
+Feature: Sign out
+ Scenario: Sign out from the apps console
+ Given I am signed in as the default E2E admin
+ When I open the apps console
+ And I open the account menu
+ And I sign out
+ Then I should be on the sign-in page
diff --git a/e2e/features/step-definitions/apps/create-app.steps.ts b/e2e/features/step-definitions/apps/create-app.steps.ts
index b8e76c6f064..6bc9ae30b65 100644
--- a/e2e/features/step-definitions/apps/create-app.steps.ts
+++ b/e2e/features/step-definitions/apps/create-app.steps.ts
@@ -24,6 +24,30 @@ When('I confirm app creation', async function (this: DifyWorld) {
await createButton.click()
})
+When('I select the {string} app type', async function (this: DifyWorld, appType: string) {
+ const dialog = this.getPage().getByRole('dialog')
+ const appTypeTitle = dialog.getByText(appType, { exact: true })
+
+ await expect(appTypeTitle).toBeVisible()
+ await appTypeTitle.click()
+})
+
+When('I expand the beginner app types', async function (this: DifyWorld) {
+ const page = this.getPage()
+ const toggle = page.getByRole('button', { name: 'More basic app types' })
+
+ await expect(toggle).toBeVisible()
+ await toggle.click()
+})
+
Then('I should land on the app editor', async function (this: DifyWorld) {
await expect(this.getPage()).toHaveURL(/\/app\/[^/]+\/(workflow|configuration)(?:\?.*)?$/)
})
+
+Then('I should land on the workflow editor', async function (this: DifyWorld) {
+ await expect(this.getPage()).toHaveURL(/\/app\/[^/]+\/workflow(?:\?.*)?$/)
+})
+
+Then('I should land on the app configuration page', async function (this: DifyWorld) {
+ await expect(this.getPage()).toHaveURL(/\/app\/[^/]+\/configuration(?:\?.*)?$/)
+})
diff --git a/e2e/features/step-definitions/auth/sign-out.steps.ts b/e2e/features/step-definitions/auth/sign-out.steps.ts
new file mode 100644
index 00000000000..935b73c3afa
--- /dev/null
+++ b/e2e/features/step-definitions/auth/sign-out.steps.ts
@@ -0,0 +1,25 @@
+import { Then, When } from '@cucumber/cucumber'
+import { expect } from '@playwright/test'
+import type { DifyWorld } from '../../support/world'
+
+When('I open the account menu', async function (this: DifyWorld) {
+ const page = this.getPage()
+ const trigger = page.getByRole('button', { name: 'Account' })
+
+ await expect(trigger).toBeVisible()
+ await trigger.click()
+})
+
+When('I sign out', async function (this: DifyWorld) {
+ const page = this.getPage()
+
+ await expect(page.getByText('Log out')).toBeVisible()
+ await page.getByText('Log out').click()
+})
+
+Then('I should be on the sign-in page', async function (this: DifyWorld) {
+ await expect(this.getPage()).toHaveURL(/\/signin/)
+ await expect(this.getPage().getByRole('button', { name: /^Sign in$/i })).toBeVisible({
+ timeout: 30_000,
+ })
+})