Files
gsfdc/demo-dify/dify/e2e/features/step-definitions/common/navigation.steps.ts
T
wuzilongandCursor 6519682885 chore: 纳入本地 Dify 1.19.0 源码及品牌与免登改动
演示目录只保留可重建的源码。运行密钥、数据卷、依赖和带口令的本地配置不进入仓库。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-18 13:59:25 +08:00

44 lines
1.5 KiB
TypeScript

import type { DifyWorld } from '../../support/world.ts'
import { Then, When } from '@cucumber/cucumber'
import { expect } from '@playwright/test'
import { waitForAppsConsole } from '../../../support/apps.ts'
import { waitForConsoleHome } from '../../../support/home.ts'
When('I open the default console entry', async function (this: DifyWorld) {
await this.getPage().goto('/')
})
When('I open the apps console', async function (this: DifyWorld) {
await this.getPage().goto('/apps')
})
When('I refresh the current page', async function (this: DifyWorld) {
await this.getPage().reload()
})
Then('I should stay on the apps console', async function (this: DifyWorld) {
await waitForAppsConsole(this.getPage())
})
Then('I should be on the console home', async function (this: DifyWorld) {
await waitForConsoleHome(this.getPage())
})
Then('I should be redirected to the signin page', async function (this: DifyWorld) {
await expect(this.getPage()).toHaveURL(/\/signin(?:\?.*)?$/)
})
Then('I should see the {string} button', async function (this: DifyWorld, label: string) {
await expect(this.getPage().getByRole('button', { name: label })).toBeVisible()
})
Then('I should not see the {string} button', async function (this: DifyWorld, label: string) {
await expect(this.getPage().getByRole('button', { name: label })).not.toBeVisible()
})
Then('I should see the {string} link', async function (this: DifyWorld, label: string) {
await expect(this.getPage().getByRole('link', { exact: true, name: label })).toBeVisible({
timeout: 30_000,
})
})