-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Correctly substitute documentation links for router-based navig…
…ation Some `href` attributes of the documentation links point to the static FastAPI route, e.g. `http://localhost:3000/static/projects/name/version/`. Since we want to use tanstack router for navigation, the links need to be substituted with the UI navigation schema, in this case `http://localhost:3000/name/version`. This way, links from the documentation can be copied and shared.
- Loading branch information
Showing
5 changed files
with
93 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { expect } from '@playwright/test' | ||
import test from './base' | ||
|
||
test('Test link substitution', async ({ page }) => { | ||
const docIframe = page.getByTestId('docIframe') | ||
const expectedDocumentationContent = 'Hello, this is a mocked documentation component.' | ||
const basePath = 'http://localhost:3000' | ||
|
||
// Expect the documentation iframe to display the mocked documentation page | ||
await page.goto('/example-project-01/latest') | ||
await expect(docIframe.contentFrame().locator('html')).toContainText(expectedDocumentationContent) | ||
|
||
// Ensure that all links have been substituted correctly | ||
const links = docIframe.contentFrame().getByRole('link') | ||
await expect(links).toHaveCount(3) | ||
const expectedSubstitutedLinks = [ | ||
`${basePath}/example-project-01/latest/#`, | ||
`${basePath}/example-project-01/latest/index.html`, | ||
'https://www.sphinx-doc.org/', | ||
] | ||
for (const [index, expectedLink] of expectedSubstitutedLinks.entries()) { | ||
expect(await links.nth(index).getAttribute('href')).toBe(expectedLink) | ||
} | ||
}) |