mirror of
https://github.com/langgenius/dify.git
synced 2026-04-15 09:57:03 +08:00
test: add e2e scenarios for app creation and sign-out (#34285)
Signed-off-by: majiayu000 <1835304752@qq.com>
This commit is contained in:
parent
51dcf4ce84
commit
4c6b8f9229
11
e2e/features/apps/create-chatbot-app.feature
Normal file
11
e2e/features/apps/create-chatbot-app.feature
Normal file
@ -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
|
||||
10
e2e/features/apps/create-workflow-app.feature
Normal file
10
e2e/features/apps/create-workflow-app.feature
Normal file
@ -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
|
||||
8
e2e/features/auth/sign-out.feature
Normal file
8
e2e/features/auth/sign-out.feature
Normal file
@ -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
|
||||
@ -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(?:\?.*)?$/)
|
||||
})
|
||||
|
||||
25
e2e/features/step-definitions/auth/sign-out.steps.ts
Normal file
25
e2e/features/step-definitions/auth/sign-out.steps.ts
Normal file
@ -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,
|
||||
})
|
||||
})
|
||||
Loading…
Reference in New Issue
Block a user