Skip to content

Commit

Permalink
Revert "feat(e2e): create e2e test for bulk download (#2445)" (#2463)
Browse files Browse the repository at this point in the history
This reverts commit b98ff33.
  • Loading branch information
theosanderson committed Aug 20, 2024
1 parent a9fa920 commit be208eb
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ export const DownloadButton: FC<DownloadButtonProps> = ({
className={`btn loculusColor ${disabled ? 'btn-disabled' : ''} text-white`}
href={downloadUrl}
onClick={handleClick}
data-testid='start-download'
>
Download
</a>
Expand Down
50 changes: 0 additions & 50 deletions website/tests/pages/search/index.spec.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
import { type Page, type Download } from '@playwright/test';
import { DateTime } from 'luxon';

import { routes } from '../../../src/routes/routes.ts';
import { getAccessionVersionString } from '../../../src/utils/extractAccessionVersion.ts';
import { baseUrl, dummyOrganism, expect, test } from '../../e2e.fixture';
import { getTestSequences } from '../../util/testSequenceProvider.ts';

interface PerformDownloadOptions {
selectRawNucleotide?: boolean;
}

test.describe('The search page', () => {
test('should find no data in the future', async ({ searchPage }) => {
const tomorrow = DateTime.now().plus({ days: 1 }).toISODate();
Expand Down Expand Up @@ -102,49 +97,4 @@ test.describe('The search page', () => {

await expect(searchPage.getAccessionField()).toHaveValue('');
});

async function performDownload(page: Page, options: PerformDownloadOptions = {}): Promise<string> {
const { selectRawNucleotide = false } = options;

const downloadButton = page.getByRole('button', { name: 'Download' });
await downloadButton.click();

if (selectRawNucleotide === true) {
const rawNucleotideRadio = page.getByLabel('Raw nucleotide sequences');
await rawNucleotideRadio.check();
}

const agreeCheckbox = page.getByLabel(/I agree/);
await agreeCheckbox.check();

const downloadButton2 = page.getByTestId('start-download');

const downloadPromise: Promise<Download> = page.waitForEvent('download');

await downloadButton2.click();

const download: Download = await downloadPromise;

const suggestedFileName: string = download.suggestedFilename();
const filePath: string = '/tmp/' + String(Math.random()).slice(0, 5) + suggestedFileName;
await download.saveAs(filePath);

return filePath;
}

test('should download file when agreeing to terms', async ({ searchPage, page }) => {
await searchPage.goto();

const filePath = await performDownload(page);

expect(filePath).toBeTruthy();
});

test('should download raw nucleotide sequences when selected', async ({ searchPage, page }) => {
await searchPage.goto();

const filePath = await performDownload(page, { selectRawNucleotide: true });

expect(filePath).toBeTruthy();
});
});

0 comments on commit be208eb

Please sign in to comment.