-
Notifications
You must be signed in to change notification settings - Fork 480
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
Cypress Test for language selection and link redirection #9488
Conversation
WalkthroughThis pull request enhances the Cypress testing suite by adding comprehensive language selection and link redirection tests for the login page. The changes focus on implementing new test cases in the Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
✅ Deploy Preview for care-ohc ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Actionable comments posted: 0
🧹 Nitpick comments (3)
cypress/pageobject/Login/LoginPage.ts (2)
13-14
: Remove trailing whitespace.
According to the static analysis hints, there's extra whitespace on line 14. Please run your formatter or linter to fix it.🧰 Tools
🪛 eslint
[error] 14-14: Delete
·
(prettier/prettier)
112-128
: Robust iteration for verifying button text per language.
The logic thoroughly checks each language's option and corresponding login text, enhancing test coverage. Consider also verifying that any necessary page transition or re-render is fully completed, such as waiting on a relevant API call, if the language switch triggers back-end requests.🧰 Tools
🪛 eslint
[error] 112-112: Delete
··
(prettier/prettier)
cypress/e2e/homepage_spec/redirect.cy.ts (1)
50-57
: Verification of 'Contribute on GitHub' redirect.
Simple and effective. Consider adding an assertion to confirm navigation to the correct domain if the subpath or domain changes in the future.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
cypress/e2e/homepage_spec/redirect.cy.ts
(2 hunks)cypress/pageobject/Login/LoginPage.ts
(2 hunks)
🧰 Additional context used
🪛 eslint
cypress/pageobject/Login/LoginPage.ts
[error] 14-14: Delete ·
(prettier/prettier)
[error] 102-102: Delete ··
(prettier/prettier)
[error] 109-109: Delete ··
(prettier/prettier)
[error] 112-112: Delete ··
(prettier/prettier)
[error] 129-129: Delete ·
(prettier/prettier)
[error] 135-135: Delete ·
(prettier/prettier)
🔇 Additional comments (13)
cypress/pageobject/Login/LoginPage.ts (5)
3-10
: Interface definition looks good.
This interface provides a clear structure for mapping language codes to localization text.
102-108
: GitHub and License link methods are consistent.
Functions for redirecting to external pages look straightforward. Ensure proper handling of external link changes or potential cross-origin issues if the URLs ever change.
🧰 Tools
🪛 eslint
[error] 102-102: Delete ··
(prettier/prettier)
109-111
: selectLanguage method is straightforward.
It uses the selector to pick a language code, adhering to Cypress best practices.
🧰 Tools
🪛 eslint
[error] 109-109: Delete ··
(prettier/prettier)
129-134
: Private method for sidebar verification is neat.
Encapsulating sidebar checks promotes reusability.
🧰 Tools
🪛 eslint
[error] 129-129: Delete ·
(prettier/prettier)
135-150
: Well-structured language switch for sidebars.
Mirrors the approach used for the login button, ensuring uniform coverage across UI elements.
🧰 Tools
🪛 eslint
[error] 135-135: Delete ·
(prettier/prettier)
cypress/e2e/homepage_spec/redirect.cy.ts (8)
2-6
: Locale imports broaden test coverage.
Excellent coverage for multi-language tests. Ensure the JSON files exist in the specified paths to avoid missing file errors.
8-8
: Consolidating locales in a single object.
This is an efficient approach to manage multiple languages programmatically.
11-13
: languageMappings usage.
Generating language mappings dynamically is a succinct approach for verifying the login button text across languages.
15-20
: Sidebar text mappings.
Similarly, grouping sidebar texts is a good way to organize localized content for tests.
24-24
: Awaiting page load with 'cy.awaitUrl("/", true)'.
This ensures a stable state before continuing tests, reducing flaky tests.
59-65
: Checks for third-party license link.
This test complements your link coverage.
67-73
: Switching languages for login button.
Repeating the approach from your page object fosters DRY. Verifying text across multiple languages is a key step in i18n testing.
74-84
: Sidebar items language verification.
This scenario thoroughly confirms that the sidebars adapt correctly to the chosen language.
Proposed Changes
@ohcnetwork/care-fe-code-reviewers
Merge Checklist
Summary by CodeRabbit
New Features
Bug Fixes