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) O3-3953: Update the e2e test coverage #382

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

harshthakkr
Copy link

@harshthakkr harshthakkr commented Jan 25, 2025

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

This PR adds e2e tests for the following actions:

  1. Deleting an existing form
  2. Downloading an existing form
  3. Renaming a form
  4. Renaming a page
  5. Deleting a page
  6. Renaming a section
  7. Deleting a section
  8. Renaming a question label
  9. Deleting a question
  10. Duplicating a question

Related Issue

O3-3953

@NethmiRodrigo NethmiRodrigo self-requested a review January 27, 2025 05:49
Copy link
Collaborator

@NethmiRodrigo NethmiRodrigo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @harshthakkr! Sorry about the late review. This is really great work and much needed, too! Left a few minor suggestions, but other than that all good!

@@ -224,6 +224,123 @@ test('Create a form using the interactive builder', async ({ page, context }) =>
const editFormPageURL = page.url();
formUuid = editFormPageURL.split('/').slice(-1)[0];
});

await test.step('Then I click the `Edit` button on the form name I need to edit', async () => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll be better if we break this into a separate spec on its own like edit-form-with-interactive-builder (that starts similar to how you delete a form, as in edits an existing form) so that it can in parallel, and rename this current file into something like create-form-with-interactive-builder.spec


await test.step('And then I fill in the updated form name', async () => {
await formBuilderPage.editFormNameInput().click();
await formBuilderPage.editFormNameInput().fill('An edited form');
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After each update step (either updating/deleting form name, section or question) we should check whether the JSON schema got updated too.

// },
// ],
// });
});
Copy link
Author

@harshthakkr harshthakkr Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have commented out this portion for now only. The reason is that JSON schema I get is missing some key-value pairs and that's why I get this error:
SyntaxError: Expected double-quoted property name in JSON at position 935 (line 1 column 936)

The JSON schema I get is:
{ "encounterType": "e22e39fd-7db2-45e7-80f1-60fa0d5a4378", "name": "An edited form", "pages": [ { "label": "An edited page", "sections": [ { "label": "An edited section", "isExpanded": "true", "questions": [ { "label": "An edited question label", "type": "obs", "required": false, "id": "sampleQuestion", "questionOptions": { "rendering": "text", "concept": "a-system-defined-concept-uuid" } }, { "label": "An edited question label", "type": "obs", "required": false, "id": "sampleQuestionDuplicate", "questionOptions": { "rendering": "text", "concept": "a-system-defined-concept-uuid" } } ] } ] } ],

It is missing content at the end. Strangely, this issue occurs only for the duplicate action. I’m unsure why this happens.

@@ -61,7 +61,7 @@ test('Clicking on a form should navigate me to the editor', async ({ page }) =>
});

await test.step('And I click the `A sample test form` form', async () => {
await formBuilderPage.page.getByText('A sample test form').click();
await formBuilderPage.page.getByText('A sample test form').first().click();
Copy link
Author

@harshthakkr harshthakkr Jan 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added .first() in multiple places because, during testing, there were instances where multiple forms appeared in the UI. To prevent errors and ensure the correct element was selected, I had to include it.
Screenshot 2025-01-28 at 9 39 41 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants