-
Notifications
You must be signed in to change notification settings - Fork 73
Add Playwright E2E testing framework to Karmada Dashboard #243
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
Conversation
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.
Summary of Changes
Hello @SunsetB612, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
This pull request introduces the Playwright E2E testing framework to the Karmada Dashboard. Its primary goal is to establish an automated testing foundation for UI stability, enable regression testing, and provide a framework for testing critical user workflows, starting with the login page. This will allow for more reliable and automated verification of the dashboard's user interface.
Highlights
- Playwright Integration: The Playwright E2E testing framework has been added to the Karmada Dashboard project.
- Initial E2E Test: A foundational E2E test for the login page has been implemented, verifying that the login page loads and the "Sign in" text is visible.
- NPM Scripts for Testing: New pnpm test:e2e and pnpm test:e2e:headed scripts have been added to package.json for easily running E2E tests in headless or headed modes.
- Testability Enhancements: data-testid attributes were added to the login input and button components in src/pages/login/index.tsx to facilitate robust E2E test automation.
- Configuration and Dependencies: Necessary Playwright configuration (playwright.config.ts) and dependencies have been added, along with updates to .gitignore and tsconfig.json to accommodate the new testing setup.
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
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.
Code Review
This pull request introduces Playwright for end-to-end testing of the Karmada Dashboard, which is a great step towards ensuring UI stability. The setup includes the necessary configuration, dependencies, and a foundational test for the login page. The changes are well-structured. My feedback focuses on improving the reliability of the tests by avoiding hardcoded waits, which is a common pitfall in E2E testing and can lead to flaky tests.
| // Navigate to the home page | ||
| await page.goto('/'); | ||
|
|
||
| await page.waitForTimeout(2 * 1000); |
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.
Using waitForTimeout is generally discouraged in Playwright tests as it can lead to flakiness and slow down test execution. It introduces an arbitrary wait time. Playwright's auto-waiting mechanism is more reliable. The subsequent assertion await expect(page.getByText('Sign in')).toBeVisible() already waits for the element to appear, making this explicit wait redundant. It can be safely removed.
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.
it's ok for our test-case
|
/assign |
.github/workflows/ci.yml
Outdated
| with: | ||
| name: playwright-report-${{ matrix.k8s }} | ||
| path: karmada-dashboard/ui/apps/dashboard/playwright-report/ | ||
| retention-days: 30 |
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.
plz add extra new line to fix format problem~
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 problem have been solved.
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.
Hi @SunsetB612, for comments that have been confirmed and resolved, they can be closed to facilitate viewing.
| // Navigate to the home page | ||
| await page.goto('/'); | ||
|
|
||
| await page.waitForTimeout(2 * 1000); |
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.
it's ok for our test-case
| "i18n:scan": "i18n-tool scan" | ||
| "i18n:scan": "i18n-tool scan", | ||
| "test:e2e": "playwright test", | ||
| "test:e2e:headed": "playwright test --headed" |
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.
👍 good job
|
@SunsetB612 there is only one format problem. And the e2e test jobs work out for the latest three version of kubernetes, cool~ |
eb8520c to
1ebb96b
Compare
|
@SunsetB612 one more thing |
Ok, I've updated the commit message to remove the duplicate sign-off~ |
the commit seems no changes, did you push the branch ? |
b004895 to
b8d04cb
Compare
Co-authored-by: warjiang <[email protected]> Signed-off-by: SunsetB612 <[email protected]>
b8d04cb to
20eca20
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: warjiang The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
@SunsetB612 thanks for your hardwork ❤️ |


Summary
Add Playwright E2E testing framework to Karmada Dashboard
What's Added
Basic Playwright configuration for E2E testing
Login page test as foundation for future test coverage
NPM scripts for running E2E tests
Why This Change
Establishes automated testing foundation for UI stability
Enables regression testing during development
Provides framework for testing critical user workflows
Test Coverage
Login page loads and renders correctly
Full authentication flow (ready for expansion)
Usage