Skip to content

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?

Copy link
Author

@harshthakkr harshthakkr Mar 13, 2025

Choose a reason for hiding this comment

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

Screen.Recording.2025-03-13.at.10.37.51.AM.mov

Playwright Error

Error: locator.click: Test timeout of 180000ms exceeded.
Call log:

  • waiting for getByRole('button', { name: 'Search patient' })
  • locator resolved to <button type="button" name="SearchPatientIcon" aria-labe…>…</button>
  • attempting click action
  • waiting for element to be visible, enabled and stable
  • element is visible, enabled and stable
  • scrolling into view if needed
  • done scrolling
  • <div role="presentation" data-test-id="overlay" class…>…</div> from <div id="react-joyride-portal">…</div>

@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.

package.json Outdated
},
"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 106
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.

@harshthakkr harshthakkr requested a review from Piumal1999 March 14, 2025 13:26
@harshthakkr
Copy link
Author

@Piumal1999 could you please review it?

@harshthakkr
Copy link
Author

Could you please review it @Piumal1999?
cc: @jayasanka-sack @Vijaykv5

@denniskigen denniskigen force-pushed the test/e2e-tests-for-user-onboarding branch from ed9047b to 1b8ccc7 Compare July 22, 2025 19:42
@denniskigen denniskigen force-pushed the test/e2e-tests-for-user-onboarding branch from 1b8ccc7 to fb3333f Compare July 22, 2025 19:44
Jest was failing to parse ES modules from @carbon/feature-flags, causing
test suite failures with "Unexpected token 'export'" errors. Added the
specific package to `transformIgnorePatterns` to allow proper transformation
while following OpenMRS Jest configuration patterns.
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.

4 participants