chore: perauset customer project
This commit is contained in:
63
e2e/tests/steps/tasks.steps.ts
Normal file
63
e2e/tests/steps/tasks.steps.ts
Normal file
@@ -0,0 +1,63 @@
|
||||
import { When } from '@cucumber/cucumber'
|
||||
import { strict as assert } from 'assert'
|
||||
import type { PerausetWorld } from '../support/world.js'
|
||||
import { getUserId } from '../support/db.js'
|
||||
|
||||
When('I create a task template with title {string} category {string}', async function (this: PerausetWorld, title: string, category: string) {
|
||||
await this.post('/tasks/templates', {
|
||||
title,
|
||||
category,
|
||||
})
|
||||
})
|
||||
|
||||
When('I create a task instance with title {string} category {string}', async function (this: PerausetWorld, title: string, category: string) {
|
||||
await this.post('/tasks', {
|
||||
title,
|
||||
category,
|
||||
})
|
||||
})
|
||||
|
||||
When('I assign the task to user {string}', async function (this: PerausetWorld, email: string) {
|
||||
const taskId = (this as any).taskId
|
||||
|
||||
// Look up userId from DB
|
||||
let userId = this.createdUsers[email]
|
||||
if (!userId) {
|
||||
userId = getUserId(email)
|
||||
this.createdUsers[email] = userId
|
||||
}
|
||||
|
||||
await this.post(`/tasks/${taskId}/assign`, {
|
||||
taskId,
|
||||
userId,
|
||||
})
|
||||
})
|
||||
|
||||
When('I start the task', async function (this: PerausetWorld) {
|
||||
const taskId = (this as any).taskId
|
||||
await this.post(`/tasks/${taskId}/start`, {
|
||||
taskId,
|
||||
})
|
||||
})
|
||||
|
||||
When('I complete the task', async function (this: PerausetWorld) {
|
||||
const taskId = (this as any).taskId
|
||||
await this.post(`/tasks/${taskId}/complete`, {
|
||||
taskId,
|
||||
})
|
||||
})
|
||||
|
||||
When('I claim the task', async function (this: PerausetWorld) {
|
||||
const taskId = (this as any).taskId
|
||||
await this.post(`/tasks/${taskId}/claim`, {
|
||||
taskId,
|
||||
})
|
||||
})
|
||||
|
||||
When('I mark the task as blocked with reason {string}', async function (this: PerausetWorld, reason: string) {
|
||||
const taskId = (this as any).taskId
|
||||
await this.post(`/tasks/${taskId}/block`, {
|
||||
taskId,
|
||||
reason,
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user