mirror of
https://github.com/langgenius/dify.git
synced 2026-06-17 06:21:07 +08:00
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>
37 lines
1.4 KiB
TypeScript
37 lines
1.4 KiB
TypeScript
import type { DifyWorld } from '../../support/world'
|
|
import { Given, When } from '@cucumber/cucumber'
|
|
import { expect } from '@playwright/test'
|
|
import { createTestApp } from '../../../support/api'
|
|
|
|
Given('there is an existing E2E app available for testing', async function (this: DifyWorld) {
|
|
const name = `E2E Test App ${Date.now()}`
|
|
const app = await createTestApp(name, 'completion')
|
|
this.lastCreatedAppName = app.name
|
|
this.createdAppIds.push(app.id)
|
|
})
|
|
|
|
When('I open the options menu for the last created E2E app', async function (this: DifyWorld) {
|
|
const appName = this.lastCreatedAppName
|
|
if (!appName)
|
|
throw new Error('No app name stored. Run "I enter a unique E2E app name" first.')
|
|
|
|
const page = this.getPage()
|
|
const appLink = page.getByRole('link', { name: appName, exact: true })
|
|
const appCard = page
|
|
.locator('div')
|
|
.filter({ has: appLink })
|
|
.filter({ has: page.getByRole('button', { name: 'More' }) })
|
|
.last()
|
|
await expect(appLink).toBeVisible()
|
|
await appCard.hover()
|
|
await appCard.getByRole('button', { name: 'More' }).click()
|
|
})
|
|
|
|
When('I click {string} in the app options menu', async function (this: DifyWorld, label: string) {
|
|
await this.getPage().getByRole('menuitem', { name: label }).click()
|
|
})
|
|
|
|
When('I confirm the app duplication', async function (this: DifyWorld) {
|
|
await this.getPage().getByRole('button', { name: 'Duplicate' }).click()
|
|
})
|