mirror of
https://github.com/iflytek/skillhub.git
synced 2026-08-28 11:25:00 +00:00
* 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>
32 lines
614 B
TypeScript
32 lines
614 B
TypeScript
import { defineConfig } from 'vite'
|
|
import react from '@vitejs/plugin-react'
|
|
import path from 'path'
|
|
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
resolve: {
|
|
alias: {
|
|
'@': path.resolve(__dirname, './src'),
|
|
},
|
|
},
|
|
test: {
|
|
exclude: ['**/node_modules/**', '**/e2e/**'],
|
|
},
|
|
server: {
|
|
port: 3000,
|
|
watch: {
|
|
usePolling: true,
|
|
interval: 150,
|
|
},
|
|
proxy: {
|
|
'/api': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
},
|
|
'/oauth2': {
|
|
target: 'http://localhost:8080',
|
|
changeOrigin: true,
|
|
},
|
|
},
|
|
},
|
|
})
|