Skip to content

Commit

Permalink
Merge pull request #2999 from andrewbaldwin44/bugfix/download-links
Browse files Browse the repository at this point in the history
Webui links should be relative
  • Loading branch information
cyberw authored Nov 28, 2024
2 parents fceb6d3 + 1c7d780 commit de9af6a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
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

0 comments on commit de9af6a

Please sign in to comment.