-
Notifications
You must be signed in to change notification settings - Fork 2
test: Rule 8 transformations #1542
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
9501337
feat: Update rule 8 transformation
Joseph2910 7823f4b
test: Add playwright tests for rule 8
Joseph2910 1e21eea
Merge branch 'main' of https://github.com/NHSDigital/dtos-cohort-mana…
Joseph2910 39e3314
Merge branch 'main' of https://github.com/NHSDigital/dtos-cohort-mana…
Joseph2910 876ec05
fix: Test file names
Joseph2910 24272ab
chore: Simplify transform rule
Joseph2910 b91db2f
chore: Add in rule8 tests to runner
Joseph2910 a31872d
fix: Updated some tests
Joseph2910 ca3a482
chore: delete unused tests
Joseph2910 9449fcc
chore: Small fixes
Joseph2910 80bb1a1
chore: push debug
Joseph2910 4d97e0f
fix: Remove logging
Joseph2910 21bebf1
fix lookup methods
MWClayson-NHS 802309b
chore: Add Terraform and Docker
Joseph2910 ce75508
fix: update Unit test signature
Joseph2910 7229445
fix: Test
Joseph2910 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
250 changes: 250 additions & 0 deletions
250
...laywright-tests/src/tests/e2e/epic4d-validation-tests/epic4d-9935-rule8-testsuite.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,250 @@ | ||
| import { test, expect, APIRequestContext, TestInfo } from "@playwright/test"; | ||
| import { TestHooks } from "../../hooks/test-hooks"; | ||
| import { cleanupDatabaseFromAPI, getApiTestData, processFileViaStorage, validateSqlDatabaseFromAPI } from "../../steps/steps"; | ||
| import { createParquetFromJson } from "../../../parquet/parquet-multiplier"; | ||
| import { getRecordsFromCohortDistributionService } from "../../../api/dataService/cohortDistributionService"; | ||
| import { getValidationExceptions } from "../../../api/dataService/exceptionService"; | ||
|
|
||
| annotation: [{ | ||
| type: 'Requirement', | ||
| description: 'Tests - https://nhsd-jira.digital.nhs.uk/browse/DTOSS-9935' | ||
| }] | ||
|
|
||
| test.describe('@regression @e2e @epic4-validation-test Rule 8 Tests', () => { | ||
|
|
||
| TestHooks.setupAllTestHooks(); | ||
|
|
||
| test('@DTOSS-A451-01 - AC1 - Verify participant is in CohortDistribution and that a transformation rule 8 exists in Exception table', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [checkInDatabase, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should raise a rule 8 transformation exception', async ()=> { | ||
| const exceptionResponse = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(Array.isArray(exceptionResponse.data) && exceptionResponse.data.length === 1).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A452-01 - AC1 - Verify participant is in CohortDistribution table with no exceptions', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [checkInDatabase, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should not raise a transformation exception', async ()=> { | ||
| const response = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(response.data === null || (Array.isArray(response.data) && response.data.length === 0)).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A453-01 - AC1 - Verify participant is in CohortDistribution and that a transformation rule 8 exists in Exception table', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [checkInDatabase, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should raise a rule 8 transformation exception', async ()=> { | ||
| const exceptionResponse = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(Array.isArray(exceptionResponse.data) && exceptionResponse.data.length === 1).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A454-01 - AC1 - Verify participant is in CohortDistribution and that a transformation rule 8 exists in Exception table', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should raise a rule 8 transformation exception', async ()=> { | ||
| const exceptionResponse = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(Array.isArray(exceptionResponse.data) && exceptionResponse.data.length === 1).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
|
|
||
| test('@DTOSS-A455-01 - AC1 - Verify participant is in CohortDistribution table with no exceptions', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [checkInDatabase, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should not raise a transformation exception', async ()=> { | ||
| const response = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(response.data === null || (Array.isArray(response.data) && response.data.length === 0)).toBe(true); | ||
| }) | ||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A456-01 - AC1 - Verify participant is in CohortDistribution and that a transformation rule 8 exists in Exception table', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should raise a rule 8 transformation exception', async ()=> { | ||
| const exceptionResponse = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(Array.isArray(exceptionResponse.data) && exceptionResponse.data.length === 1).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A457-01 - AC1 - Verify participant is in CohortDistribution table with no exceptions', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [checkInDatabase, inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should not raise a transformation exception', async ()=> { | ||
| const response = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(response.data === null || (Array.isArray(response.data) && response.data.length === 0)).toBe(true); | ||
| }) | ||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A458-01 - AC1 - Verify participant is in CohortDistribution and that a transformation rule 8 exists in Exception table', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should raise a rule 8 transformation exception', async ()=> { | ||
| const exceptionResponse = await getValidationExceptions(request, {exceptionCategory: 8}); | ||
| expect(Array.isArray(exceptionResponse.data) && exceptionResponse.data.length === 1).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| test('@DTOSS-A459-01 - AC1 - Verify participant is in CohortDistribution and that a general exception exists in Exception table', async ({ request }: { request: APIRequestContext }, testInfo: TestInfo) => { | ||
| const [inputParticipantRecord, nhsNumbers, testFilesPath] = await getApiTestData(testInfo.title); | ||
|
|
||
| await cleanupDatabaseFromAPI(request, nhsNumbers); | ||
|
|
||
| const parquetFile = await createParquetFromJson(nhsNumbers, inputParticipantRecord, testFilesPath); | ||
|
|
||
| await test.step(`When I ADD participant is processed via storage`, async () => { | ||
| await processFileViaStorage(parquetFile); | ||
| }); | ||
|
|
||
| await test.step('Then participant should be in cohort distribution', async ()=> { | ||
| const cohortResponse = await getRecordsFromCohortDistributionService(request); | ||
| if (!cohortResponse || !Array.isArray(cohortResponse.data)) { | ||
| throw new Error('No data returned from cohort distribution service'); | ||
| } | ||
| }) | ||
|
|
||
| await test.step('Then participant should raise a general exception', async ()=> { | ||
| const exceptionResponse = await getValidationExceptions(request); | ||
| expect(Array.isArray(exceptionResponse.data) && exceptionResponse.data.length >= 1).toBe(true); | ||
| }) | ||
|
|
||
|
|
||
| }) | ||
|
|
||
| }) |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.