Commit graph

4 commits

Author SHA1 Message Date
dongmucat
e501be9cf8 feat(promotion): improve promotion review dashboard
Signed-off-by: dongmucat <1127093059@qq.com>
2026-06-24 09:28:43 +08:00
huishi3
1c9baed571 test(e2e): run real-request playwright flows with one worker 2026-04-09 11:33:28 +05:30
dongmucat
50a6c4b7fe test(e2e,ci): migrate web e2e to real API and add PR e2e workflow (#198)
* chore(workflow): align local hooks and e2e guidance

* test(e2e): expand reusable api mock helpers

* test(skill): stabilize share button e2e assertions

* chore(test): add e2e make target and tune playwright workers

* test(web): expand e2e coverage and smoke suite

* test(e2e): migrate to real API flows and add request-based data builder

* ci(e2e): add PR workflow for real-service frontend e2e

* ci(e2e): install playwright chromium in PR workflow

* test(e2e): relax timeout and force single worker in CI

* test(e2e): stabilize not-found assertions and harden CI session bootstrap

* chore(agents): align tester role with web/e2e workflow
2026-04-01 14:41:23 +08:00
wowo
1b7bd06685 feat(web): add skill share button with e2e tests (#181)
* test(web): add Playwright e2e testing framework

Add Playwright for end-to-end testing with initial test suites for search flow and network error handling. Also enhance unit tests for network error scenarios.

- Add @playwright/test dependency and npm scripts
- Configure Playwright with chromium browser and HTML reporter
- Add e2e tests for search flow and network error handling
- Update .gitignore to exclude Playwright generated files
- Add network error test cases to api-error unit tests

* feat(web): add skill share button to detail page

Add share button to skill detail page that copies skill info to clipboard. Share text includes skill name, short description (max 30 chars), and detail page URL.

Closes #168

* test(web): add e2e tests for skill share button

Add Playwright e2e tests to verify share button functionality including clipboard copy, text formatting, and state transitions.

* fix(web): fix share button e2e tests and document Playwright workflow

Fix 3 issues in share-button e2e tests:
- Use authenticated mock (skill detail page requires login)
- Add publishedVersion to skill factory (ShareButton render condition)
- Mock versions/files sub-resource APIs to prevent server errors
- Adjust description assertion for 30-char truncation logic

Add Playwright E2E section to CLAUDE.md documenting commands,
screenshot behavior, and test-results directory conventions.

E2E test results: 10/10 passed (Chromium, Playwright 1.58.2)
- network-error.spec.ts:  3/3 passed
- search-flow.spec.ts:    3/3 passed
- share-button.spec.ts:   4/4 passed

* refactor(web): improve share button layout and text format

- Remove description truncation, display full text
- Change share text format from 2 lines to 3 lines (name, description, URL)
- Replace Button component with custom styled native button
- Move ShareButton from card to below download button
- Update tests to match new 3-line format

* fix(web): handle clipboard copy failure in fallback path

- Check document.execCommand('copy') return value
- Throw error when copy fails in fallback path
- Ensure error is properly caught and displayed to user

Fixes issue where "复制 Token 失败,请重试" was shown but the
underlying failure was not properly detected in the fallback code path.

* refactor(web): modernize clipboard with useCopyToClipboard hook

- Add useCopyToClipboard React hook for cleaner state management
- Migrate all copy buttons to use the new hook
- Remove repetitive useState + setTimeout patterns across 7 files
- Simplify clipboard.ts by removing excessive diagnostic logging
- Keep copyToClipboard utility for special cases (file-preview-dialog)

Benefits:
- More idiomatic React code with custom hook
- Consistent 2-second auto-reset behavior
- Reduced code duplication
- Better separation of concerns

* test(web): fix api-error tests and exclude e2e from vitest

- Set i18n language to 'zh' in api-error.test.ts beforeEach
- Add vitest config to exclude e2e directory from unit tests
- All 506 tests now pass

---------

Co-authored-by: xiose <huyanlin@nuaa.edu.cn>
2026-03-30 14:04:52 +08:00