fastify / fastify-swagger-ui

Serve Swagger-UI for Fastify
MIT License
137 stars 40 forks source link

fix: hash loads json spec #160

Closed blue86321 closed 3 months ago

blue86321 commented 3 months ago

Summary

Fix json specs route issues when url contains # #158

Test Plan

Command

npm install
npx playwright install
npm run test:e2e

Result

> @fastify/swagger-ui@5.0.0-pre.fv5.1 test:e2e
> npx playwright test

Running 8 tests using 4 workers
  8 passed (12.2s

Result wihout new test

> @fastify/swagger-ui@5.0.0-pre.fv5.1 test:e2e
> npx playwright test

Running 8 tests using 4 workers
  1) [chromium] › custom.test.js:82:3 › Check redirection and url handling of static assets › Check root UI with hash loads json spec 

    Test timeout of 30000ms exceeded.

    Error: page.waitForResponse: Test timeout of 30000ms exceeded.
    =========================== logs ===========================
    waiting for response /json/
    ============================================================

      81 |
      82 |   test('Check root UI with hash loads json spec', async ({ page }) => {
    > 83 |     const jsonResponsePromise = page.waitForResponse(/json/)
         |                                      ^
      84 |     await page.goto(`${URL_DOCUMENTATION}#default/get_example`)
      85 |
      86 |     // Check if the page has requested the json spec, and if so has it succeeded

        at .../fastify-swagger-ui/e2e/custom.test.js:83:38

  1 failed
    [chromium] › custom.test.js:82:3 › Check redirection and url handling of static assets › Check root UI with hash loads json spec 
  7 passed (33.8s)

Checklist