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-3863: E2E tests for user onboarding tutorials #23

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

Conversation

harshthakkr
Copy link

@harshthakkr harshthakkr commented Mar 7, 2025

Requirements

  • This PR has a title that briefly describes the work done including a conventional commit type prefix and a Jira ticket number if applicable. See existing PR titles for inspiration.

For changes to apps

If applicable

  • My work includes tests or is validated by existing tests.

Summary

This PR adds E2E tests for the following tutorials:

  1. Basic overview
  2. Demo tutorial
  3. Finding a patient
  4. Patient chart
  5. Recording vitals
  6. Registering a patient
  7. Starting a patient visit

Related Issue

O3-3863

Other

The related JIRA ticket also suggests adding E2E tests for the Patient Lists tutorial. However, since the functionality is not working at the moment, I have excluded it from this PR.


await test.step('And I click the `Appointments` button', async () => {
await page.evaluate(() => {
document.querySelector('.react-joyride__overlay')?.setAttribute('style', 'z-index: 1 !important');
Copy link
Author

Choose a reason for hiding this comment

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

I had to use this at multiple instances (mostly for a button click) because Playwright was unable to interact with the button as it was covered by a tooltip overlay.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @harshthakkr, Could you please send a screenshot of this scenario?

@harshthakkr
Copy link
Author

@jayasanka-sack, @denniskigen Could you please review this PR?

@jayasanka-sack
Copy link
Member

This is awesome @harshthakkr! 😍

@Vijaykv5 @Piumal1999 Could you please review this PR?

@jayasanka-sack
Copy link
Member

@harshthakkr I made a commit to the main branch, could you please take a pull?

@harshthakkr
Copy link
Author

Sure @jayasanka-sack !

@harshthakkr
Copy link
Author

Can you please re-trigger the E2E tests @jayasanka-sack?

Copy link
Collaborator

@Piumal1999 Piumal1999 left a comment

Choose a reason for hiding this comment

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

Good job! @harshthakkr

I have requested some minor changes.

Btw, the build is failing due to a playwright issue. Let's bump the Playwright version to ^1.50.1, which is used in other esm repos.

"react": "18.x",
"react-i18next": "11.x",
"react-router-dom": "6.x",
"rxjs": "6.x"
},
"devDependencies": {
"@openmrs/esm-framework": "next",
"@openmrs/esm-framework": "^6.2.1-pre.2752",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Keep the openmrs and @openmrs/esm-framework versions as next

@@ -0,0 +1,97 @@
import { type APIRequestContext, expect } from '@playwright/test';

export interface Patient {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's reuse the interfaces defined in e2e/types/index.ts here as well, to avoid redundancy.


await test.step('And I click the `Help` button', async () => {
await page
.locator('[id="single-spa-application\\:\\@openmrs\\/esm-help-menu-app-page-0"]')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Are there any other selectors we can use for this? It would be better if we could query using a visual property.


await test.step('And I click the `Appointments` button', async () => {
await page.evaluate(() => {
document.querySelector('.react-joyride__overlay')?.setAttribute('style', 'z-index: 1 !important');
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @harshthakkr, Could you please send a screenshot of this scenario?

Comment on lines +100 to +126
await test.step('When I fill `37` as the temperature', async () => {
await page.getByRole('spinbutton', { name: /temperature/i }).fill('37');
});

await test.step('And I fill `120` as the systolic', async () => {
await page.getByRole('spinbutton', { name: /systolic/i }).fill('120');
});

await test.step('And I fill `100` as the diastolic', async () => {
await page.getByRole('spinbutton', { name: /diastolic/i }).fill('100');
});

await test.step('And I fill `65` as the pulse', async () => {
await page.getByRole('spinbutton', { name: /pulse/i }).fill('65');
});

await test.step('And I fill `16` as the respiration rate', async () => {
await page.getByRole('spinbutton', { name: /respiration rate/i }).fill('16');
});

await test.step('And I fill `98` as the oxygen saturation', async () => {
await page.getByRole('spinbutton', { name: /oxygen saturation/i }).fill('98');
});

await test.step('And I add additional notes', async () => {
await page.getByPlaceholder(/type any additional notes here/i).fill('Test notes');
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

Merge these kinds of steps into a single step.

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.

3 participants