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(quantic): SFINT-5832 Sort E2E tests migrate from Cypress to Playwright #4777

Open
wants to merge 9 commits into
base: master
Choose a base branch
from

Conversation

lvu285
Copy link
Contributor

@lvu285 lvu285 commented Dec 6, 2024

https://coveord.atlassian.net/browse/SFINT-5832

IN THIS PR:

  • Added Playwright E2E tests for the quantic-sort component

UNIT TESTS:

  • No need, as UTs already there

E2E PLAYWRIGHT TESTS:

  • Playwright for Sort component

@lvu285 lvu285 requested a review from a team as a code owner December 6, 2024 21:51
Copy link

github-actions bot commented Dec 6, 2024

Pull Request Report

PR Title

❌ Title should follow the conventional commit spec:
<type>(optional scope): <description>

Example: feat(headless): add result-list controller

Live demo links

Bundle Size

File Old (kb) New (kb) Change (%)
case-assist 243.9 243.9 0
commerce 355.1 355.1 0
search 415 415 0
insight 406.3 406.3 0
recommendation 256.2 256.2 0
ssr 408.9 408.9 0
ssr-commerce 372.9 372.9 0

SSR Progress

Use case SSR (#) CSR (#) Progress (%)
search 39 44 89
recommendation 0 4 0
case-assist 0 6 0
insight 0 27 0
commerce 0 15 0
Detailed logs search : buildInteractiveResult
search : buildInteractiveInstantResult
search : buildInteractiveRecentResult
search : buildInteractiveCitation
search : buildGeneratedAnswer
recommendation : missing SSR support
case-assist : missing SSR support
insight : missing SSR support
commerce : missing SSR support

@lvu285 lvu285 changed the title SFINT-5832: Sorts e2e migrate from Cypress to Playwright SFINT-5832: Sort E2E tests migrate from Cypress to Playwright Dec 6, 2024
@mmitiche
Copy link
Contributor

@erocheleau I will integrate the content from this PR: #4782 in this PR as well, to have more unit tests to test the component rather going E2E only.

@lvu285 lvu285 requested a review from mmitiche December 27, 2024 22:16
Copy link
Contributor

@SimonMilord SimonMilord left a comment

Choose a reason for hiding this comment

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

Re-read the comments that were addressed, ltgm! thank you

Copy link
Collaborator

@erocheleau erocheleau left a comment

Choose a reason for hiding this comment

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

Not done yet :)

Will review the playwright tests later

await this.sortDropDown.click();
}

async focusSortDropDownEnter(): Promise<void> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does the "focusSortDropDownEnter" mean here?
The function clicks on the preview button and then presses Tab?

Comment on lines 41 to 45
await this.page.keyboard.press('Enter');
await this.sortButton('Oldest').isVisible();
await this.page.waitForTimeout(500);
await this.page.keyboard.press('ArrowDown');
await this.page.keyboard.press('Enter');
Copy link
Collaborator

Choose a reason for hiding this comment

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

The name of this function doesn't describe what is being done with the steps within this function, what are you trying to accomplish with that?

Copy link
Collaborator

@erocheleau erocheleau left a comment

Choose a reason for hiding this comment

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

Some suggestions

Comment on lines 42 to 47
async selectSortOptionUsingArrow(): Promise<void> {
await this.sortButton('Oldest').isVisible();
await this.page.waitForTimeout(500);
await this.page.keyboard.press('ArrowDown');
await this.page.keyboard.press('Enter');
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

This one is weird for me, why you rely on 'Oldest' specifically, and also why do you have to wait for 500ms?

Copy link
Collaborator

Choose a reason for hiding this comment

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

After seeing the test, it shouldn't be in the pageObject just in your test, put this:

await this.page.keyboard.press('ArrowDown');
await this.page.keyboard.press('Enter');

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the wait for 500ms is to make the test for Insight use case more stable, otherwise the next keyboard action sometimes will fail.

Comment on lines +16 to +21
let test;
if (useCase.value === useCaseEnum.search) {
test = fixtures[useCase.value] as typeof testSearch;
} else {
test = fixtures[useCase.value] as typeof testInsight;
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do you need the as typeof ?

Suggested change
let test;
if (useCase.value === useCaseEnum.search) {
test = fixtures[useCase.value] as typeof testSearch;
} else {
test = fixtures[useCase.value] as typeof testInsight;
}
const test = fixtures[useCase.value];

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I won't fix it now, as it's bit complicated. Mehdi will review and fix them later

await sort.openSortDropdownUsingEnter();
await sort.selectSortOptionUsingArrow();
selectedSortLabel = await sort.sortDropDown.textContent();
expect(selectedSortLabel).toEqual(defaultSortLabels[1]);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Again here, I would go fetch what the loaded sorts are available on the page instead of relying on the default sorts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

same as above, we want to be sure the sort displays in correct order

@lvu285 lvu285 requested a review from erocheleau January 29, 2025 15:43
@lvu285 lvu285 changed the title SFINT-5832: Sort E2E tests migrate from Cypress to Playwright test(quantic): SFINT-5832 Sort E2E tests migrate from Cypress to Playwright Feb 4, 2025
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