Files
dify/e2e/features/step-definitions/apps/switch-app-mode.steps.ts
yyh 1ae2f95f7c test(e2e): add agent v2 core coverage (#38209)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-07-02 06:18:38 +00:00

30 lines
1.1 KiB
TypeScript

import type { DifyWorld } from '../../support/world'
import { Given, Then, When } from '@cucumber/cucumber'
import { expect } from '@playwright/test'
import { createTestApp } from '../../../support/api'
import { createE2EResourceName } from '../../../support/naming'
Given(
'there is an existing E2E completion app available for testing',
async function (this: DifyWorld) {
const name = createE2EResourceName('App', 'Test')
const app = await createTestApp(name, 'completion')
this.lastCreatedAppName = app.name
this.createdAppIds.push(app.id)
},
)
When('I confirm the app switch', async function (this: DifyWorld) {
await this.getPage().getByRole('button', { name: 'Start switch' }).click()
})
Then('I should land on the switched app', async function (this: DifyWorld) {
const page = this.getPage()
await expect(page).toHaveURL(/\/app\/[^/]+\/workflow(?:\?.*)?$/, { timeout: 15_000 })
// Capture the new app's ID so the After hook can clean it up
const match = page.url().match(/\/app\/([^/]+)\/workflow/)
if (match?.[1])
this.createdAppIds.push(match[1])
})