Files
dify/web/e2e/fixtures/index.ts
CodingOnStar 7b968c6c2e feat: add Playwright E2E testing framework and initial test setup
- Introduced Playwright for end-to-end testing, including configuration in .
- Created global setup and teardown scripts for authentication and cleanup.
- Added page object models for key application pages (Apps, SignIn, Workflow).
- Implemented utility functions for API interactions and common test helpers.
- Updated  to exclude Playwright test results and auth files.
- Added initial E2E tests for the Apps page.
- Updated  with new test scripts for E2E testing.
2025-12-09 18:14:57 +08:00

56 lines
1.4 KiB
TypeScript

import { test as base, expect } from '@playwright/test'
import { AppsPage } from '../pages/apps.page'
import { SignInPage } from '../pages/signin.page'
import { WorkflowPage } from '../pages/workflow.page'
/**
* Extended test fixtures for Dify E2E tests
*
* This module provides custom fixtures that inject page objects
* into tests, making it easier to write maintainable tests.
*
* @example
* ```typescript
* import { test, expect } from '@/e2e/fixtures'
*
* test('can create new app', async ({ appsPage }) => {
* await appsPage.goto()
* await appsPage.createApp('My Test App')
* await expect(appsPage.appCard('My Test App')).toBeVisible()
* })
* ```
*/
// Define custom fixtures type
type DifyFixtures = {
appsPage: AppsPage
signInPage: SignInPage
workflowPage: WorkflowPage
}
/**
* Extended test object with Dify-specific fixtures
*/
export const test = base.extend<DifyFixtures>({
// Apps page fixture
appsPage: async ({ page }, run) => {
const appsPage = new AppsPage(page)
await run(appsPage)
},
// Sign in page fixture
signInPage: async ({ page }, run) => {
const signInPage = new SignInPage(page)
await run(signInPage)
},
// Workflow page fixture
workflowPage: async ({ page }, run) => {
const workflowPage = new WorkflowPage(page)
await run(workflowPage)
},
})
// Re-export expect for convenience
export { expect }