Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(test) Add the playwright video tracing feature #148

Merged
merged 8 commits into from
Aug 22, 2023
Merged
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
1 change: 1 addition & 0 deletions e2e/pages/form-builder-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ export class FormBuilderPage {
await this.formNameInput().fill(formName);
await this.formVersionInput().click();
await this.formVersionInput().fill("1.0");
await this.formDescriptionInput().fill("This is a test form");
await this.formEncounterType().selectOption("Admission");
await this.formSaveButton().click();
}
Expand Down
5 changes: 3 additions & 2 deletions e2e/specs/create-form-using-custom-schema.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ test("Create a form using a custom JSON schema", async ({ page }) => {
});

await test.step("Then I paste in a custom JSON schema into the schema editor and click the `Render Changes` button", async () => {
await formBuilderPage.schemaInput().fill(JSON.stringify(customSchema));
// Inputs the custom schema and render changes
await formBuilderPage
.schemaInput()
.fill(JSON.stringify(customSchema, null, 2));
await formBuilderPage.renderChangesButton().click();
});

Expand Down
5 changes: 4 additions & 1 deletion e2e/specs/edit-existing-form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ test("Editing an existing form", async ({ page }) => {
});

await test.step("And I click the `Edit` button on the form I need to edit", async () => {
await page.getByRole('row', { name: form.name }).getByLabel('Edit Schema').click();
await page
.getByRole("row", { name: form.name })
.getByLabel("Edit Schema")
.click();
});

await test.step("Then I click the `Save Form` button then the `Update existing version` button, and finally the `Save` button", async () => {
Expand Down
17 changes: 8 additions & 9 deletions e2e/specs/interactive-builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,13 @@ test("Create a schema using the interactive builder", async ({ page }) => {

await test.step("Then I should see the new schema in the schema editor and a success notification", async () => {
await expect(page.getByText(/new question created/i)).toBeVisible();
await expect(
page
.getByRole("tabpanel", { name: "Schema Editor" })
.locator("div")
.filter({
hasText: '{ "name": "Covid-19 Screening"',
})
.nth(2)
).toBeVisible();
await page
.locator("#schemaEditor div")
.filter({
hasText:
'{ "name": "Covid-19 Screening", "pages": [ { "label": "Screening", "sections": [',
})
.nth(1)
.click();
});
});
6 changes: 4 additions & 2 deletions e2e/support/custom-schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"encounterType": "",
"encounterType": "e22e39fd-7db2-45e7-80f1-60fa0d5a4378",
"name": "UI Select Form Test",
"pages": [
{
Expand All @@ -25,5 +25,7 @@
],
"processor": "EncounterFormProcessor",
"referencedForms": [],
"uuid": "xxx"
"uuid": "xxx",
"version": "1",
"description": "This is test description"
}
4 changes: 3 additions & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,18 @@ const config: PlaywrightTestConfig = {
timeout: 20 * 1000,
},
fullyParallel: true,
outputDir: "../test-results/results",
forbidOnly: !!process.env.CI,
retries: 0,
reporter: process.env.CI
? [["junit", { outputFile: "results.xml" }], ["html"]]
: [["line"]],
: [["html", { outputFolder: "../test-results/report" }]],
globalSetup: require.resolve("./e2e/core/global-setup"),
use: {
baseURL: `${process.env.E2E_BASE_URL}/spa/`,
locale: "en-US",
storageState: "e2e/storageState.json",
video: "retain-on-failure",
},
projects: [
{
Expand Down
Loading