Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions e2e/features/datasets/create-dataset.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
@datasets @authenticated @core
Feature: Create dataset
Scenario: Create a new empty dataset
Given I am signed in as the default E2E admin
When I open the datasets page
And I start creating a new dataset
And I select "Create an empty dataset"
And I enter a unique E2E dataset name
And I confirm dataset creation
Then I should land on the dataset document page
36 changes: 36 additions & 0 deletions e2e/features/step-definitions/datasets/create-dataset.steps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import type { DifyWorld } from '../../support/world'
import { Then, When } from '@cucumber/cucumber'
import { expect } from '@playwright/test'

When('I open the datasets page', async function (this: DifyWorld) {
await this.getPage().goto('/datasets')
})

When('I start creating a new dataset', async function (this: DifyWorld) {
const page = this.getPage()
await expect(page.getByRole('button', { name: 'Create Dataset' })).toBeVisible()
await page.getByRole('button', { name: 'Create Dataset' }).click()
})

When('I select {string}', async function (this: DifyWorld, option: string) {
const page = this.getPage()
await expect(page.getByText(option)).toBeVisible()
await page.getByText(option).click()
})

When('I enter a unique E2E dataset name', async function (this: DifyWorld) {
const datasetName = `E2E Dataset ${Date.now()}`
this.lastCreatedDatasetName = datasetName
await this.getPage().getByPlaceholder('Dataset name').fill(datasetName)
})

When('I confirm dataset creation', async function (this: DifyWorld) {
const page = this.getPage()
const createButton = page.getByRole('button', { name: 'Create' }).last()
await expect(createButton).toBeEnabled()
await createButton.click()
})

Then('I should land on the dataset document page', async function (this: DifyWorld) {
await expect(this.getPage()).toHaveURL(/\/datasets\/[^/]+\/documents(?:\?.*)?$/)
})
2 changes: 2 additions & 0 deletions e2e/features/support/world.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class DifyWorld extends World {
scenarioStartedAt: number | undefined
session: AuthSessionMetadata | undefined
lastCreatedAppName: string | undefined
lastCreatedDatasetName: string | undefined
createdAppIds: string[] = []
capturedDownloads: Download[] = []
shareURL: string | undefined
Expand All @@ -26,6 +27,7 @@ export class DifyWorld extends World {
this.consoleErrors = []
this.pageErrors = []
this.lastCreatedAppName = undefined
this.lastCreatedDatasetName = undefined
this.createdAppIds = []
this.capturedDownloads = []
this.shareURL = undefined
Expand Down
Loading