Skip to content
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

Webui links should be relative #2999

Merged
merged 1 commit into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions locust/webui/src/components/Reports/Reports.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Reports', () => {
const link = getByText('Download requests CSV');

expect(link).toBeTruthy();
expect(link.getAttribute('href')).toBe('/stats/requests/csv');
expect(link.getAttribute('href')).toBe('./stats/requests/csv');
});

test('renders a link to download failures CSV', () => {
Expand All @@ -19,7 +19,7 @@ describe('Reports', () => {
const link = getByText('Download failures CSV');

expect(link).toBeTruthy();
expect(link.getAttribute('href')).toBe('/stats/failures/csv');
expect(link.getAttribute('href')).toBe('./stats/failures/csv');
});

test('renders a link to download exceptions CSV', () => {
Expand All @@ -28,7 +28,7 @@ describe('Reports', () => {
const link = getByText('Download exceptions CSV');

expect(link).toBeTruthy();
expect(link.getAttribute('href')).toBe('/exceptions/csv');
expect(link.getAttribute('href')).toBe('./exceptions/csv');
});

test('renders a link to download stats history CSV when enabled', () => {
Expand All @@ -41,7 +41,7 @@ describe('Reports', () => {
const link = getByText('Download full request statistics history CSV');

expect(link).toBeTruthy();
expect(link.getAttribute('href')).toBe('/stats/requests_full_history/csv');
expect(link.getAttribute('href')).toBe('./stats/requests_full_history/csv');
});

test('does not render a link to download stats history CSV when disabled', () => {
Expand All @@ -60,7 +60,7 @@ describe('Reports', () => {
const link = getByText('Download Report');

expect(link).toBeTruthy();
expect(link.getAttribute('href')).toBe('/stats/report?theme=dark');
expect(link.getAttribute('href')).toBe('./stats/report?theme=dark');
});

test('renders a link to download the report in light mode when theme is light', () => {
Expand All @@ -71,7 +71,7 @@ describe('Reports', () => {
const link = getByText('Download Report');

expect(link).toBeTruthy();
expect(link.getAttribute('href')).toBe('/stats/report?theme=light');
expect(link.getAttribute('href')).toBe('./stats/report?theme=light');
});

test('renders links to download extended CSV files', () => {
Expand Down
10 changes: 5 additions & 5 deletions locust/webui/src/components/Reports/Reports.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ function Reports({
return (
<List sx={{ display: 'flex', flexDirection: 'column' }}>
<ListItem>
<Link href='/stats/requests/csv'>Download requests CSV</Link>
<Link href='./stats/requests/csv'>Download requests CSV</Link>
</ListItem>
{statsHistoryEnabled && (
<ListItem>
<Link href='/stats/requests_full_history/csv'>
<Link href='./stats/requests_full_history/csv'>
Download full request statistics history CSV
</Link>
</ListItem>
)}
<ListItem>
<Link href='/stats/failures/csv'>Download failures CSV</Link>
<Link href='./stats/failures/csv'>Download failures CSV</Link>
</ListItem>
<ListItem>
<Link href='/exceptions/csv'>Download exceptions CSV</Link>
<Link href='./exceptions/csv'>Download exceptions CSV</Link>
</ListItem>
<ListItem>
<Link
href={`/stats/report?theme=${isDarkMode ? THEME_MODE.DARK : THEME_MODE.LIGHT}`}
href={`./stats/report?theme=${isDarkMode ? THEME_MODE.DARK : THEME_MODE.LIGHT}`}
target='_blank'
>
Download Report
Expand Down