|
| 1 | +import { test } from '../../fixtures/group.fixture'; |
| 2 | +import { BulkSubmissionPage, SingleSequenceSubmissionPage } from '../../pages/submission.page'; |
| 3 | +import { expect } from '@playwright/test'; |
| 4 | +import { |
| 5 | + CCHF_L_SEGMENT_FULL_SEQUENCE, |
| 6 | + CCHF_M_SEGMENT_FULL_SEQUENCE, |
| 7 | + CCHF_S_SEGMENT_FULL_SEQUENCE, |
| 8 | +} from '../../test-helpers/test-data'; |
| 9 | + |
| 10 | +test.describe('Multi-segment multi-reference submission flow', () => { |
| 11 | + test('submit single sequence, edit and release', async ({ page, groupId }) => { |
| 12 | + test.setTimeout(120_000); |
| 13 | + |
| 14 | + void groupId; |
| 15 | + const submissionPage = new SingleSequenceSubmissionPage(page); |
| 16 | + |
| 17 | + await submissionPage.navigateToSubmissionPage('CCHF (Multi-Ref)'); |
| 18 | + await submissionPage.fillSubmissionForm({ |
| 19 | + submissionId: 'MSMR-TEST-001', |
| 20 | + collectionCountry: 'Laos', |
| 21 | + collectionDate: '2023-10-15', |
| 22 | + authorAffiliations: 'Research Lab, University', |
| 23 | + }); |
| 24 | + await submissionPage.fillSequenceData({ mySequence: 'should not align' }); |
| 25 | + await submissionPage.acceptTerms(); |
| 26 | + const reviewPage = await submissionPage.submitSequence(); |
| 27 | + |
| 28 | + await reviewPage.waitForAllProcessed(); |
| 29 | + const editPage = await reviewPage.editFirstSequence(); |
| 30 | + |
| 31 | + await editPage.discardSequenceFile(); |
| 32 | + await editPage.addSequenceFile(`>key\n${CCHF_S_SEGMENT_FULL_SEQUENCE}`); |
| 33 | + await editPage.addSequenceFile(`>key2\n${CCHF_L_SEGMENT_FULL_SEQUENCE}`); |
| 34 | + await editPage.fillField('Authors', 'Integration, Test'); |
| 35 | + await editPage.submitChanges(); |
| 36 | + |
| 37 | + await reviewPage.waitForAllProcessed(); |
| 38 | + const releasedPage = await reviewPage.releaseAndGoToReleasedSequences(); |
| 39 | + |
| 40 | + const accessionVersions = await releasedPage.waitForSequencesInSearch(1); |
| 41 | + const firstAccessionVersion = accessionVersions[0]; |
| 42 | + await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.1`); |
| 43 | + const expectedDisplayName = new RegExp( |
| 44 | + `^Display Name: Laos/${firstAccessionVersion.accession}\\.1`, |
| 45 | + ); |
| 46 | + await expect(page.getByText(expectedDisplayName)).toBeVisible(); |
| 47 | + await expect( |
| 48 | + page.getByTestId('sequence-preview-modal').getByText('Length S'), |
| 49 | + ).toBeVisible(); |
| 50 | + await expect( |
| 51 | + page.getByTestId('sequence-preview-modal').getByText('Length L'), |
| 52 | + ).toBeVisible(); |
| 53 | + }); |
| 54 | + |
| 55 | + test('revoke a sequence', async ({ page, groupId }) => { |
| 56 | + test.setTimeout(120_000); |
| 57 | + |
| 58 | + void groupId; |
| 59 | + const submissionPage = new SingleSequenceSubmissionPage(page); |
| 60 | + |
| 61 | + await submissionPage.navigateToSubmissionPage('CCHF (Multi-Ref)'); |
| 62 | + await submissionPage.fillSubmissionForm({ |
| 63 | + submissionId: 'id', |
| 64 | + collectionCountry: 'Uganda', |
| 65 | + collectionDate: '2023-10-15', |
| 66 | + authorAffiliations: 'Research Lab, University', |
| 67 | + }); |
| 68 | + await submissionPage.fillSequenceData({ mySequence: CCHF_L_SEGMENT_FULL_SEQUENCE }); |
| 69 | + await submissionPage.acceptTerms(); |
| 70 | + const reviewPage = await submissionPage.submitSequence(); |
| 71 | + |
| 72 | + await reviewPage.waitForAllProcessed(); |
| 73 | + const releasedPage = await reviewPage.releaseAndGoToReleasedSequences(); |
| 74 | + |
| 75 | + const accessionVersions = await releasedPage.waitForSequencesInSearch(1); |
| 76 | + const firstAccessionVersion = accessionVersions[0]; |
| 77 | + await releasedPage.openPreviewOfAccessionVersion(firstAccessionVersion.accessionVersion); |
| 78 | + await expect( |
| 79 | + page.getByTestId('sequence-preview-modal').getByText('Length L'), |
| 80 | + ).toBeVisible(); |
| 81 | + await releasedPage.revokeSequence('revocation for integration test'); |
| 82 | + |
| 83 | + await reviewPage.waitForAllProcessed(); |
| 84 | + await reviewPage.releaseAndGoToReleasedSequences(); |
| 85 | + |
| 86 | + await releasedPage.waitForAccessionVersionInSearch(firstAccessionVersion.accession, 2); |
| 87 | + await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.2`); |
| 88 | + await expect(page.getByText(/This is a revocation version/)).toBeVisible(); |
| 89 | + }); |
| 90 | + |
| 91 | + test('submit files and revise released version', async ({ page, groupId }) => { |
| 92 | + test.setTimeout(120_000); |
| 93 | + |
| 94 | + void groupId; |
| 95 | + const submissionPage = new BulkSubmissionPage(page); |
| 96 | + |
| 97 | + await submissionPage.navigateToSubmissionPage('CCHF (Multi-Ref)'); |
| 98 | + await submissionPage.uploadMetadataFile( |
| 99 | + ['id', 'geoLocCountry', 'sampleCollectionDate', 'fastaIds'], |
| 100 | + [ |
| 101 | + ['first', 'Laos', '2023-10-15', 'first_S first_M first_L'], |
| 102 | + ['second', 'Laos', '2023-10-16', 'second_L'], |
| 103 | + ], |
| 104 | + ); |
| 105 | + await submissionPage.uploadSequencesFile({ |
| 106 | + first_S: CCHF_S_SEGMENT_FULL_SEQUENCE, |
| 107 | + first_M: CCHF_M_SEGMENT_FULL_SEQUENCE, |
| 108 | + first_L: CCHF_L_SEGMENT_FULL_SEQUENCE, |
| 109 | + second_L: CCHF_L_SEGMENT_FULL_SEQUENCE, |
| 110 | + }); |
| 111 | + await submissionPage.acceptTerms(); |
| 112 | + const reviewPage = await submissionPage.submitSequence(); |
| 113 | + |
| 114 | + await reviewPage.waitForAllProcessed(); |
| 115 | + const releasedPage = await reviewPage.releaseAndGoToReleasedSequences(); |
| 116 | + |
| 117 | + const accessionVersions = await releasedPage.waitForSequencesInSearch(2); |
| 118 | + const firstAccessionVersion = accessionVersions[0]; |
| 119 | + await releasedPage.openPreviewOfAccessionVersion(firstAccessionVersion.accessionVersion); |
| 120 | + await expect( |
| 121 | + page.getByTestId('sequence-preview-modal').getByText('Length L'), |
| 122 | + ).toBeVisible(); |
| 123 | + const editPage = await releasedPage.reviseSequence(); |
| 124 | + |
| 125 | + const authorAffiliations = 'integration test affiliation'; |
| 126 | + await editPage.fillField('Author affiliations', authorAffiliations); |
| 127 | + await editPage.submitChanges(); |
| 128 | + |
| 129 | + await reviewPage.waitForAllProcessed(); |
| 130 | + await reviewPage.releaseAndGoToReleasedSequences(); |
| 131 | + |
| 132 | + await releasedPage.waitForAccessionVersionInSearch(firstAccessionVersion.accession, 2); |
| 133 | + await releasedPage.expectResultTableCellText(authorAffiliations); |
| 134 | + await releasedPage.openPreviewOfAccessionVersion(`${firstAccessionVersion.accession}.2`); |
| 135 | + const expectedDisplayName = new RegExp( |
| 136 | + `^Display Name: Laos/${firstAccessionVersion.accession}\\.2`, |
| 137 | + ); |
| 138 | + await expect(page.getByText(expectedDisplayName)).toBeVisible(); |
| 139 | + }); |
| 140 | +}); |
0 commit comments