-
Notifications
You must be signed in to change notification settings - Fork 9
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-3601 : E2E tests for User onboarding #7
Conversation
Getting this error while running E2E tests and failure in getting the first step itself for getting the help menu button. |
Hi @Vijaykv5 , I couldn't reproduce the above-mentioned error. Did that occur when you were running the tests locally? Btw, the GitHub action is failing due to an incorrect script. To fix it, just replace the |
The test fails because it starts before the page is fully loaded. The simplest way to fix this is by using the Playwright home-page.ts file: async goto() {
await this.page.goto(`home`);
await this.page.waitForLoadState('networkidle');
} This will make it wait until there are no network connections for at least 500 ms. However, the Playwright documentation discourages using this method, as the best practice is to rely on visual components. Another way to fix this issue is to wait for a specific component to load, such as the search button, which usually loads last. However, this method does not guarantee that all other components are fully loaded, so the error might occur again. @jayasanka-sack WDYT? |
This is very helpful @Piumal1999 ! I prefer the second option; making sure all relevant elements are loaded before triggering the tutorial by adding some assertions. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vijaykv5 Looks like some the selectors you used are no longer there in the UI. Can you recheck those locally and update the tests?
Still the same issue in second step to wait for the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Vijaykv5 could you please address these comments (it applies to all other places.)
I'd recommend keeping videos on all the time because:
- If a test fails, we know something went wrong.
- If a test passes, we can see all the steps, but we still can't be sure the tooltips are in the right place. So, having videos helps us manually confirm when needed.
e2e/specs/onboarding-test.spec.ts
Outdated
}); | ||
|
||
await test.step('And I click on the Basic Tutorial walkthrough', async () => { | ||
await page.getByText('Walkthrough').nth(1).click(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't guarantee the order of the list. The order may change when we add new tutorials. So, we need to think of a better selector.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jayasanka-sack I didn't figure out how we can select those walkthoroughs.
An approach that came to my mind is having a selector in the tutorial modal #L49 and searching for the Heading and corresponding walkthrough. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First of all, I've noticed a few adjustments needed for the tutorial to follow best practices:
- Change the list to an unordered list. This will be beneficial for both testing and accessibility.
- Currently, the walkthrough button is a div. It should be a button. (A ghost button would be the option.)
Here is how your code should look (there won't be any visual changes):
<ul>
{tutorials.map -> tutorial}
<li>
<h3>{title}</h3>
<p>{description}</p>
<Button kind="ghost">Button</Button>
</li>
{/tutorials}
</ul>
Once you've done that, you can select the button with this:
const tutorialTitle = "Basic ..."
await page.locator('li', { hasText: 'my item' }).locator('button').click();
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a small visual change in the alignment of buttons. is this fine?
walkthrough-btn.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine. Btw, can we get the close button fixed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
e2e/specs/onboarding-test.spec.ts
Outdated
}); | ||
|
||
await test.step('Then I should see the first Joyride tooltip', async () => { | ||
await expect(page.locator('div').filter({ hasText: 'Welcome to OpenMRS!' }).nth(1)).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await expect(page.locator('div').filter({ hasText: 'Welcome to OpenMRS!' }).nth(1)).toBeVisible(); | |
await expect(page.getByText('Welcome to OpenMRS!')).toBeVisible(); |
e2e/specs/onboarding-test.spec.ts
Outdated
}); | ||
|
||
await test.step('Then I should see the user icon Joyride tooltip', async () => { | ||
await expect(page.getByText('The user icon')).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
await expect(page.getByText('The user icon')).toBeVisible(); | |
await expect(page.getByText('The user icon. Click here to change your user preferences and settings.')).toBeVisible(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Make sure you check for the exact full text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This applies to other places as well.
Requirements
For changes to apps
If applicable
Summary
This PR adds E2E test for basic user onboarding walkthroughs.
Screenshots
Related Issue
O3-3601
Other