test(e2e): create and delete a webhook

This commit is contained in:
kolaente 2026-04-21 11:21:55 +02:00 committed by kolaente
parent 5a93149849
commit 425889b879
1 changed files with 27 additions and 0 deletions

View File

@ -21,4 +21,31 @@ test.describe('Project webhooks', () => {
await page.getByRole('button', {name: /create webhook/i}).click()
await expect(page.locator('.help.is-danger')).toContainText(/at least one event/i)
})
test('creates and deletes a webhook', async ({authenticatedPage: page}) => {
await page.goto('/projects/1/settings/webhooks')
await page.waitForLoadState('networkidle')
await page.locator('#targetUrl').fill('https://example.com/hook')
await page.locator('.available-events-check', {hasText: 'task.created'})
.locator('.base-checkbox__label').click()
const created = page.waitForResponse(r =>
r.url().includes('/projects/1/webhooks') && r.request().method() === 'PUT',
)
await page.getByRole('button', {name: /create webhook/i}).click()
await created
const row = page.locator('table.table tbody tr', {hasText: 'example.com/hook'})
await expect(row).toBeVisible()
const deleted = page.waitForResponse(r =>
r.url().match(/\/projects\/1\/webhooks\/\d+/) !== null && r.request().method() === 'DELETE',
)
await row.locator('.button.is-danger').click()
await page.locator('dialog[open] .modal-content .actions .button').filter({hasText: 'Do it!'}).click()
await deleted
await expect(row).toHaveCount(0)
})
})