dify/e2e/features/step-definitions/apps/create-app.steps.ts
Jingyi 9b74df21d0
feat(web): refine onboarding UI (#37433)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
Co-authored-by: Joel <iamjoel007@gmail.com>
Co-authored-by: hjlarry <hjlarry@163.com>
Co-authored-by: fatelei <fatelei@gmail.com>
Co-authored-by: Asuka Minato <i@asukaminato.eu.org>
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Xiyuan Chen <52963600+GareArc@users.noreply.github.com>
Co-authored-by: gigglewang <gigglewang@dify.ai>
Co-authored-by: Yunlu Wen <yunlu.wen@dify.ai>
Co-authored-by: chariri <w@chariri.moe>
Co-authored-by: Evan <2869018789@qq.com>
Co-authored-by: yyh <92089059+lyzno1@users.noreply.github.com>
2026-06-15 08:47:15 +00:00

57 lines
2.2 KiB
TypeScript

import type { DifyWorld } from '../../support/world'
import { Then, When } from '@cucumber/cucumber'
import { expect } from '@playwright/test'
import { openBlankAppCreation } from '../../../support/apps'
When('I start creating a blank app', async function (this: DifyWorld) {
await openBlankAppCreation(this.getPage())
})
When('I enter a unique E2E app name', async function (this: DifyWorld) {
const appName = `E2E App ${Date.now()}`
this.lastCreatedAppName = appName
await this.getPage().getByPlaceholder('Give your app a name').fill(appName)
})
When('I confirm app creation', async function (this: DifyWorld) {
const createButton = this.getPage()
.getByRole('button', { name: /^Create(?:\s|$)/ })
.last()
await expect(createButton).toBeEnabled()
await createButton.click()
})
When('I select the {string} app type', async function (this: DifyWorld, appType: string) {
const dialog = this.getPage().getByRole('dialog')
// The modal defaults to ADVANCED_CHAT, so the preview panel immediately renders
// <h4>Chatflow</h4> alongside the card's <div>Chatflow</div>.
// locator('div').getByText(...) would still match the <h4> because getByText
// searches inside each div for any descendant. Use :text-is() instead, which
// targets only <div> elements whose own normalised text equals appType exactly.
const appTypeCard = dialog.locator(`div:text-is("${appType}")`)
await expect(appTypeCard).toBeVisible()
await appTypeCard.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(?:\?.*)?$/)
})