-
-
Notifications
You must be signed in to change notification settings - Fork 128
fix: set base URL to '/' and add comprehensive tests #1393
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 5 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
f9b292e
fix: set base URL to '/' and add comprehensive tests
github-actions[bot] 757f958
fix :Errors
AvivAbachi ad3d436
fix: update ASSET_URL in build workflow for consistency
AvivAbachi 7f3448e
fix: remove vite.config.test.ts to fix Jest/Vitest conflict
github-actions[bot] d03ff57
Merge branch 'claude/issue-329-20260105-1935' of https://github.com/h…
AvivAbachi 43493f8
test: add assertions to verify asset arrays aren't empty
github-actions[bot] 3aed960
fix: update environment variable from ASSET_URL to PREVIEW_URL for co…
AvivAbachi ed10d79
fix: reorder imports in vite.config.ts for clarity
AvivAbachi 657364b
fix: rename environment variable from PREVIEW_URL to VITE_PREVIEW_URL…
AvivAbachi 7537a0d
fix: configure Storybook base URL for preview deployments
github-actions[bot] 997fd33
fix: add basename to router for VITE_PREVIEW_URL support
AvivAbachi 98f1514
fix: rename VITE_PREVIEW_URL to VITE_BASE_PATH for consistency across…
AvivAbachi 57d4f5e
fix: update VITE_BASE_PATH to include domain for consistency in build…
AvivAbachi 0119317
fix: update VITE_BASE_PATH to remove hardcoded domain for flexibility
AvivAbachi a9420ef
fix: update VITE_BASE_PATH to include hardcoded domain for consistency
AvivAbachi e263ff4
fix: update base path configuration to use process.env for consistency
AvivAbachi 8d4b6a7
fix: tests
AvivAbachi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,89 @@ | ||
| import { expect, setupTest, test } from './utils' | ||
|
|
||
| test.describe('Base URL configuration tests', () => { | ||
| test('assets should load from root path on nested routes', async ({ page }) => { | ||
| await setupTest(page) | ||
|
|
||
| // Navigate to a nested route (e.g., /profile/:id) | ||
| // We'll use a direct navigation to simulate the issue scenario | ||
| await page.goto('/profile/8235701') | ||
|
|
||
| // Wait for the page to load | ||
| await page.waitForLoadState('networkidle') | ||
|
|
||
| // Check that JavaScript assets are loaded from the correct path | ||
| const scriptTags = await page.locator('script[src]').all() | ||
| const scriptSources = await Promise.all(scriptTags.map((tag) => tag.getAttribute('src'))) | ||
|
|
||
| // Filter for asset files (typically in /assets/ directory) | ||
| const assetScripts = scriptSources.filter((src) => src && src.includes('/assets/')) | ||
|
|
||
| // Verify that asset paths start with /assets/ (from root) and not /profile/assets/ | ||
| for (const src of assetScripts) { | ||
| if (src) { | ||
| expect(src.startsWith('/assets/')).toBeTruthy() | ||
| expect(src.startsWith('/profile/assets/')).toBeFalsy() | ||
| } | ||
| } | ||
|
|
||
| // Also verify that all script resources loaded successfully (no 404s) | ||
| const failedRequests: string[] = [] | ||
| page.on('requestfailed', (request) => { | ||
| if (request.resourceType() === 'script') { | ||
| failedRequests.push(request.url()) | ||
| } | ||
| }) | ||
|
|
||
| // Reload the page to trigger all resource loads again | ||
| await page.reload() | ||
| await page.waitForLoadState('networkidle') | ||
|
|
||
| // Check that no script requests failed | ||
| expect(failedRequests.length).toBe(0) | ||
| }) | ||
|
|
||
| test('assets should load correctly on dashboard page', async ({ page }) => { | ||
| await setupTest(page) | ||
|
|
||
| // Navigate to dashboard (a top-level route) | ||
| await page.goto('/dashboard') | ||
| await page.waitForLoadState('networkidle') | ||
|
|
||
| // Check that JavaScript assets are loaded from the correct path | ||
| const scriptTags = await page.locator('script[src]').all() | ||
| const scriptSources = await Promise.all(scriptTags.map((tag) => tag.getAttribute('src'))) | ||
|
|
||
| // Filter for asset files | ||
| const assetScripts = scriptSources.filter((src) => src && src.includes('/assets/')) | ||
|
AvivAbachi marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Verify that asset paths start with /assets/ (from root) | ||
| for (const src of assetScripts) { | ||
| if (src) { | ||
| expect(src.startsWith('/assets/')).toBeTruthy() | ||
| } | ||
| } | ||
| }) | ||
|
|
||
| test('CSS assets should load from root path on nested routes', async ({ page }) => { | ||
| await setupTest(page) | ||
|
|
||
| // Navigate to a nested route | ||
| await page.goto('/profile/8235701') | ||
| await page.waitForLoadState('networkidle') | ||
|
|
||
| // Check that CSS assets are loaded from the correct path | ||
| const linkTags = await page.locator('link[rel="stylesheet"]').all() | ||
| const linkHrefs = await Promise.all(linkTags.map((tag) => tag.getAttribute('href'))) | ||
|
|
||
| // Filter for asset files | ||
| const assetLinks = linkHrefs.filter((href) => href && href.includes('/assets/')) | ||
|
AvivAbachi marked this conversation as resolved.
Outdated
|
||
|
|
||
| // Verify that asset paths start with /assets/ (from root) and not /profile/assets/ | ||
| for (const href of assetLinks) { | ||
| if (href) { | ||
| expect(href.startsWith('/assets/')).toBeTruthy() | ||
| expect(href.startsWith('/profile/assets/')).toBeFalsy() | ||
| } | ||
| } | ||
| }) | ||
| }) | ||
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.