test: add e2e scenarios for app creation and sign-out (#34285)

Signed-off-by: majiayu000 <1835304752@qq.com>
This commit is contained in:
lif 2026-04-09 11:31:13 +08:00 committed by GitHub
parent 51dcf4ce84
commit 4c6b8f9229
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 78 additions and 0 deletions

View 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

View 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

View 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

View File

@ -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(?:\?.*)?$/)
})

View 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,
})
})