-
Notifications
You must be signed in to change notification settings - Fork 83
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
db6dc01
commit b593bee
Showing
4 changed files
with
219 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { test } from '../core'; | ||
import { createForm, createValueReference, addFormResources, deleteForm } from '../commands/form-operations'; | ||
import type { Form } from '../../src/types'; | ||
import { FormBuilderPage } from '../pages'; | ||
import { expect } from '@playwright/test'; | ||
|
||
let form: Form = null; | ||
test.beforeEach(async ({ api }) => { | ||
form = await createForm(api, false); | ||
const valueReference = await createValueReference(api); | ||
await addFormResources(api, valueReference, form.uuid); | ||
}); | ||
|
||
test('Delete an existing form', async ({ page }) => { | ||
const formBuilderPage = new FormBuilderPage(page); | ||
|
||
await test.step('When I visit the form builder', async () => { | ||
await formBuilderPage.gotoFormBuilder(); | ||
}); | ||
|
||
await test.step('And I search for the form I need to delete', async () => { | ||
await formBuilderPage.searchForForm(form.name); | ||
}); | ||
|
||
await test.step('And I click the `Delete` button on the form I need to delete', async () => { | ||
await formBuilderPage.page | ||
.getByRole('row', { name: form.name }) | ||
.getByLabel(/delete schema/i) | ||
.click(); | ||
}); | ||
|
||
await test.step('Then I click the `Delete` button on the modal', async () => { | ||
await formBuilderPage.deleteFormConfirmationButton().click(); | ||
}); | ||
|
||
await test.step('Then I should get a success message and the row with the form name should be removed', async () => { | ||
await expect(formBuilderPage.page.getByText(/form deleted/i)).toBeVisible(); | ||
await expect(formBuilderPage.page.getByRole('row', { name: form.name })).toHaveCount(0); | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ api }) => { | ||
if (form) { | ||
await deleteForm(api, form.uuid); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import { test } from '../core'; | ||
import { createForm, createValueReference, addFormResources, deleteForm } from '../commands/form-operations'; | ||
import type { Form } from '../../src/types'; | ||
import { FormBuilderPage } from '../pages'; | ||
import { expect } from '@playwright/test'; | ||
|
||
let form: Form = null; | ||
|
||
test.beforeEach(async ({ api }) => { | ||
form = await createForm(api, false); | ||
const valueReference = await createValueReference(api); | ||
await addFormResources(api, valueReference, form.uuid); | ||
}); | ||
|
||
test('Download an existing form', async ({ page }) => { | ||
const formBuilderPage = new FormBuilderPage(page); | ||
|
||
await test.step('When I visit the form builder', async () => { | ||
await formBuilderPage.gotoFormBuilder(); | ||
}); | ||
|
||
await test.step('And I search for the form I need to download', async () => { | ||
await formBuilderPage.searchForForm(form.name); | ||
}); | ||
|
||
await test.step('And I click the `Download` button on the form I need to download', async () => { | ||
const downloadPromise = page.waitForEvent('download'); | ||
await formBuilderPage.page | ||
.getByRole('row', { name: form.name }) | ||
.getByLabel(/download schema/i) | ||
.click(); | ||
const download = await downloadPromise; | ||
expect(download).toBeDefined(); | ||
}); | ||
}); | ||
|
||
test.afterEach(async ({ api }) => { | ||
if (form) { | ||
await deleteForm(api, form.uuid); | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters