ci/woodpecker/push/woodpecker Pipeline failed
Details
|
||
---|---|---|
.. | ||
accessibility | ||
integration | ||
unit | ||
README.md | ||
accessibility.test.js | ||
headers.spec.js | ||
headers.test.js | ||
lighthouse.js | ||
pre-test-setup.sh | ||
run-all-tests.sh | ||
run-tests.sh | ||
serve.js | ||
server.js | ||
theme-toggle.spec.js |
README.md
Resume Site Tests
This directory contains tests for the resume site.
Directory Structure
unit/
: Unit tests for JavaScript files and other componentsintegration/
: Integration tests that test components working togethere2e/
: End-to-end tests that simulate user interactions*.test.js
,*.spec.js
: Playwright test fileslighthouse.js
: Lighthouse performance and accessibility testsserve.js
: Simple Node.js server for testingserver.js
: Alternative server implementationpre-test-setup.sh
: Script to set up the test environment, including updating CSP hashes
Running Tests
To run all tests:
./run-all-tests.sh
Or using npm:
npm test
This will:
- Run the pre-test setup script to update CSP hashes
- Check if the server is running
- Run all shell script tests
- Run Playwright tests if available
- Run Lighthouse tests
Content Security Policy (CSP) Testing
The CSP hash update process is an important part of the testing framework. It ensures that:
- All JavaScript and CSS files have integrity hashes
- All inline styles have proper CSP hashes
- The Caddyfile and HTML files have the correct CSP headers/meta tags
The pre-test-setup.sh
script runs the update-csp-hashes.sh
script to update all CSP hashes before running the tests. This ensures that any changes to the website are properly reflected in the CSP hashes.
The csp-hash-test.sh
integration test checks if the CSP hash update process is working properly by verifying that:
- CSP headers are present in the response
- CSP headers contain the required directives
- JavaScript and CSS files have integrity attributes
- HTML files have CSP meta tags
Running Specific Tests
JavaScript Tests
npm run test:js
Lighthouse Tests
npm run test:lighthouse
Starting the Test Server
npm run serve
Adding New Tests
Shell Script Tests
Add new test scripts to the appropriate directory:
unit/
: For unit testsintegration/
: For integration testse2e/
: For end-to-end tests
Shell script tests should:
- Be executable bash scripts
- Return exit code 0 for success, non-zero for failure
- For integration and e2e tests, accept a base URL as the first argument
Playwright Tests
Add new Playwright tests with the .test.js
or .spec.js
extension in the tests directory.
Test Requirements
As per the project guidelines, all tests must:
- Pass for both mobile and desktop viewports
- Maintain Lighthouse scores: 100/100 for accessibility and SEO
- Include meaningful assertions, not placeholders