resume/tests
colin f0d296f108 Add WCAG 2.1 AAA accessibility testing framework 2025-07-06 16:14:32 -04:00
..
accessibility Add WCAG 2.1 AAA accessibility testing framework 2025-07-06 16:14:32 -04:00
integration Integrate CSP hash update process into test framework 2025-07-06 16:05:03 -04:00
unit Integrate CSP hash update process into test framework 2025-07-06 16:05:03 -04:00
README.md Integrate CSP hash update process into test framework 2025-07-06 16:05:03 -04:00
accessibility.test.js Add download as PDF button and update test configurations 2025-05-10 16:12:46 -04:00
headers.spec.js Add download as PDF button and update test configurations 2025-05-10 16:12:46 -04:00
headers.test.js Add Cal.com calendar meeting links 2025-04-21 22:14:57 -04:00
lighthouse.js Update resume with Oh My Form Docker pulls and comprehensive experience 2025-03-31 09:18:30 -04:00
pre-test-setup.sh Integrate CSP hash update process into test framework 2025-07-06 16:05:03 -04:00
run-all-tests.sh Integrate CSP hash update process into test framework 2025-07-06 16:05:03 -04:00
run-tests.sh Integrate CSP hash update process into test framework 2025-07-06 16:05:03 -04:00
serve.js Add Playwright and Lighthouse testing infrastructure 2025-03-31 04:42:57 -04:00
server.js temporarily disable HSTS to resolve certificate provisioning issues 2025-04-15 16:33:47 -04:00
theme-toggle.spec.js Add Playwright and Lighthouse testing infrastructure 2025-03-31 04:42:57 -04:00

README.md

Resume Site Tests

This directory contains tests for the resume site.

Directory Structure

  • unit/: Unit tests for JavaScript files and other components
  • integration/: Integration tests that test components working together
  • e2e/: End-to-end tests that simulate user interactions
  • *.test.js, *.spec.js: Playwright test files
  • lighthouse.js: Lighthouse performance and accessibility tests
  • serve.js: Simple Node.js server for testing
  • server.js: Alternative server implementation
  • pre-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:

  1. Run the pre-test setup script to update CSP hashes
  2. Check if the server is running
  3. Run all shell script tests
  4. Run Playwright tests if available
  5. Run Lighthouse tests

Content Security Policy (CSP) Testing

The CSP hash update process is an important part of the testing framework. It ensures that:

  1. All JavaScript and CSS files have integrity hashes
  2. All inline styles have proper CSP hashes
  3. 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 tests
  • integration/: For integration tests
  • e2e/: 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