Skip to content
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
35 changes: 35 additions & 0 deletions integration-tests/tests/pages/search.page.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Page, expect } from '@playwright/test';
import { getFromLinkTargetAndAssertContent } from '../utils/link-helpers';
import { EditPage } from './edit.page';
import { ReviewPage } from './review.page';

function makeAccessionVersion({
accession,
Expand Down Expand Up @@ -120,6 +121,20 @@ export class SearchPage {
return new EditPage(this.page);
}

async revokeSequence(revocationReason: string = 'Test revocation') {
const revokeButton = this.page.getByRole('button', { name: 'Revoke this sequence' });
await expect(revokeButton).toBeVisible();
await revokeButton.click();

await expect(
this.page.getByText('Are you sure you want to create a revocation for this sequence?'),
).toBeVisible();
await this.page.getByPlaceholder('Enter reason for revocation').fill(revocationReason);
await this.page.getByRole('button', { name: 'Confirm' }).click();

return new ReviewPage(this.page);
}

async clickOnSequenceAndGetAccession(rowIndex = 0): Promise<string> {
const rows = this.getSequenceRows();
const row = rows.nth(rowIndex);
Expand Down Expand Up @@ -251,6 +266,26 @@ export class SearchPage {
return accessions;
}

async waitForAccessionVersionInSearch(expectedAccession: string, expectedVersion: number) {
await expect
.poll(
async () => {
await this.page.reload();
const accessionVersions = await this.getAccessionVersions();
return accessionVersions.some(
({ accession, version }) =>
accession === expectedAccession && version === expectedVersion,
);
},
{
message: `Did not find accession version ${expectedAccession}.${expectedVersion} in search results`,
timeout: 60000,
intervals: [2000, 5000],
},
)
.toBeTruthy();
}

async expectResultTableCellText(text: string) {
await expect(this.page.getByRole('cell', { name: text })).toBeVisible();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,41 @@ test.describe('Multi-pathogen submission flow', () => {
await releasedPage.expectResultTableCellText('EV-A71');
});

test('revoke a sequence', async ({ page, groupId }) => {
test.fail();
test.setTimeout(120_000);

void groupId;
const submissionPage = new SingleSequenceSubmissionPage(page);

await submissionPage.navigateToSubmissionPage('Enterovirus');
await submissionPage.fillSubmissionForm({
submissionId: 'id',
collectionCountry: 'Uganda',
collectionDate: '2023-10-15',
authorAffiliations: 'Research Lab, University',
});
await submissionPage.fillSequenceData({ mySequence: a71Sequence });
await submissionPage.acceptTerms();
const reviewPage = await submissionPage.submitSequence();

await reviewPage.waitForAllProcessed();
const releasedPage = await reviewPage.releaseAndGoToReleasedSequences();

const accessionVersions = await releasedPage.waitForSequencesInSearch(1);
await releasedPage.expectResultTableCellText('EV-A71');
const firstAccessionVersion = accessionVersions[0];
await releasedPage.openPreviewOfAccessionVersion(firstAccessionVersion.accessionVersion);
await releasedPage.revokeSequence('revocation for integration test');

await reviewPage.waitForAllProcessed();
await reviewPage.releaseAndGoToReleasedSequences();

await releasedPage.waitForAccessionVersionInSearch(firstAccessionVersion.accession, 2);
await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.2`);
await expect(page.getByText(/This is a revocation version/)).toBeVisible();
});

test('submit files and revise released version', async ({ page, groupId }) => {
test.setTimeout(120_000);

Expand Down Expand Up @@ -64,7 +99,7 @@ test.describe('Multi-pathogen submission flow', () => {
await releasedPage.expectResultTableCellText('EV-D68');

const firstAccessionVersion = accessionVersions[0];
await releasedPage.openPreviewOfAccessionVersion(firstAccessionVersion.accession);
await releasedPage.openPreviewOfAccessionVersion(firstAccessionVersion.accessionVersion);
const editPage = await releasedPage.reviseSequence();

const authorAffiliations = 'integration test affiliation';
Expand All @@ -74,24 +109,13 @@ test.describe('Multi-pathogen submission flow', () => {
await reviewPage.waitForAllProcessed();
await reviewPage.releaseAndGoToReleasedSequences();

await expect
.poll(
async () => {
await page.reload();
const accessionVersions = await releasedPage.getAccessionVersions();
return accessionVersions.some(
({ accession, version }) =>
accession === firstAccessionVersion.accession && version === 2,
);
},
{
message: `Did not find revised accession version ${firstAccessionVersion.accession}.2`,
timeout: 60000,
intervals: [2000, 5000],
},
)
.toBeTruthy();
await releasedPage.waitForAccessionVersionInSearch(firstAccessionVersion.accession, 2);
await releasedPage.expectResultTableCellText(authorAffiliations);
await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.2`);
const expectedDisplayName = new RegExp(
`^Display Name: Uganda/${firstAccessionVersion.accession}\\.2`,
);
await expect(page.getByText(expectedDisplayName)).toBeVisible();
});
});

Expand Down
Loading