Skip to content

feat: convert "navigation tests spec" to Playwright - #54944

Merged
naomi-lgbt merged 2 commits into
freeCodeCamp:mainfrom
Sembauke:feat/convert-navigation-tests-to-playwright
May 25, 2024
Merged

naomi-lgbt merged 2 commits into
freeCodeCamp:mainfrom
Sembauke:feat/convert-navigation-tests-to-playwright

Conversation

@Sembauke

@Sembauke Sembauke commented May 23, 2024 •

Copy link
Copy Markdown
Member

Checklist:

Closes #XXXXX

@github-actions github-actions Bot added the scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. label May 23, 2024
@huyenltnguyen

Copy link
Copy Markdown
Member

As with anything Playwright-related, I'm not entirely sure why something works or doesn't work.

I tested the changes locally, and the "Should take you to the next superblock (with editor solution)" test was flaky. When the test failed, the UI mode showed me an empty editor, so the issue would either be:

  • The editor not receiving focus; or
  • The copy-pasting doesn't work

I compared the code with projects.spec.ts, and nothing stood out to me. However, when I looked that the UI of the project pages (RWD vs Legacy JS), I noticed the difference in the size of the editable area:

Personal Portfolio Palindrome Checker
Screenshot 2024-05-23 at 22 11 21 Screenshot 2024-05-23 at 22 12 58

On the Palindrome Checker page, the editable area is much larger (5 lines) compared to that of Personal Portfolio (1 line). So my theory is, when we simulate the focus editor action with .click(), Playwright's pointer can miss the Personal Portfolio's editor as the click area is too small, and thus the editor doesn't receive focus. (This is really just a guess, the pointer in both screenshots are placed in the exact position, so I expect they behave the same way).

To fix the issue, I updated focusEditor() to call .focus() instead of .click(), which simplifies the function a bit as well (the purpose of the function is to move focus to the editor, and we don't really care if that's from .click(), .focus(), or .tab()).

@Sembauke
Sembauke marked this pull request as ready for review May 24, 2024 06:47
@Sembauke
Sembauke requested a review from a team May 24, 2024 06:47
@huyenltnguyen huyenltnguyen added the status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending. label May 24, 2024
@Sembauke Sembauke mentioned this pull request May 24, 2024
61 tasks done
@naomi-lgbt
naomi-lgbt merged commit 020a8c5 into freeCodeCamp:main May 25, 2024
@Sembauke
Sembauke deleted the feat/convert-navigation-tests-to-playwright branch May 30, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: tools/scripts Scripts for supporting dev work, generating config and build artifacts, etc. status: waiting review To be applied to PR's that are ready for QA, especially when additional review is pending.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants