playwright.config.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. // Playwright config skeleton for the OAuth2 WASM demo E2E (todo 31).
  2. // The specs themselves land in todos 37/38; this file only pins the stack
  3. // contract: browser base URL plus the self-signed-cert bypass the AS needs.
  4. const { defineConfig } = require('@playwright/test');
  5. const { STORAGE_STATE_PATH } = require('./helpers');
  6. module.exports = defineConfig({
  7. // Specs live directly in e2e/ (todos 37/38: happy.spec.ts, negative.spec.ts).
  8. testDir: '.',
  9. // Serial: the single e2e user owns one TOTP secret and the AS rejects a
  10. // replayed code for 180s, so two concurrent logins burn each other's code
  11. // and trip the 5-failure lockout. One worker keeps logins sequential.
  12. workers: 1,
  13. // A login retry waits for the next 30s TOTP step before resubmitting, so a
  14. // test that hits a replayed code needs headroom past one step boundary.
  15. timeout: 120_000,
  16. use: {
  17. baseURL: 'http://127.0.0.1:3000',
  18. // The AS public listener is TLS-only with a throwaway self-signed dev
  19. // certificate, so the browser must bypass certificate errors.
  20. ignoreHTTPSErrors: true,
  21. },
  22. // One authenticated context per run: the setup project logs in a single
  23. // time and the negative project reuses that state, so the AS sees three
  24. // credential logins per run (setup, happy, logout-test) instead of one per
  25. // session-needing test. Contexts loaded from the file never write back,
  26. // so no test can invalidate the shared state for the others.
  27. projects: [
  28. { name: 'setup', testMatch: /auth\.setup\.ts/ },
  29. { name: 'happy', testMatch: /happy\.spec\.ts/, dependencies: ['setup'] },
  30. {
  31. name: 'negative',
  32. testMatch: /negative\.spec\.ts/,
  33. dependencies: ['setup'],
  34. use: { storageState: STORAGE_STATE_PATH },
  35. },
  36. ],
  37. });