Skip to content

Commit

Permalink
Merge branch 'develop' into configurable-roles
Browse files Browse the repository at this point in the history
  • Loading branch information
Zangetsu101 committed Nov 28, 2024
2 parents 2ce04d2 + baa79df commit 14d289b
Show file tree
Hide file tree
Showing 27 changed files with 688 additions and 49 deletions.
7 changes: 3 additions & 4 deletions .github/workflows/deploy-and-e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
echo "test_matrix=$test_dirs"
test:
needs: [deploy, discover-tests]
needs: [deploy, discover-tests, get-core-commit, get-country-config-commit]
runs-on: ubuntu-22.04
environment: ${{ github.event.inputs.environment || 'development' }}
strategy:
Expand Down Expand Up @@ -134,12 +134,11 @@ jobs:
run: npx playwright test ./e2e/testcases/${{ matrix.test_dir }}
env:
DOMAIN: '${{ vars.DOMAIN }}'
continue-on-error: true

- uses: actions/upload-artifact@v4
if: steps.check-specs.outputs.has_spec_files == 'true'
if: always() && steps.check-specs.outputs.has_spec_files == 'true'
with:
name: playwright-report-${{ matrix.test_dir }}
name: playwright-report-${{github.event.inputs.core-image-tag || needs.get-core-commit.outputs.latest_commit_sha}}-${{github.event.inputs.countryconfig-image-tag || needs.get-country-config-commit.outputs.short_sha}}-${{matrix.test_dir}}
path: playwright-report/
retention-days: 30

Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ INSERT CSV ROWS IN ENGLISH ONLY

- TBC

## 1.6.1 Release candidate

### Bug fixes

- Fix a typo in the birth certificate svg code that was causing the birth certificate to fail to render in the `print certified copy` flow. [7886](https://github.com/opencrvs/opencrvs-core/issues/7886)

## 1.6.0 Release candidate

### Breaking changes
Expand Down
11 changes: 8 additions & 3 deletions e2e/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,16 +80,21 @@ export const goToSection = async (

/*
Generates a random past date
at least 'minAge' years ago
at least 'minAge' years + 'offset' days ago
and up to an additional 'range' days earlier
*/
export const getRandomDate = (minAge: number, range: number) => {
export const getRandomDate = (
minAge: number,
range: number,
offset: number = 0
) => {
const randomDate = new Date()
randomDate.setDate(
new Date().getDate() -
Math.random() * range -
minAge * 365 -
(minAge + 3) / 4
(minAge + 3) / 4 -
offset
)
const [yyyy, mm, dd] = randomDate.toISOString().split('T')[0].split('-')
return { dd, mm, yyyy }
Expand Down
6 changes: 3 additions & 3 deletions e2e/testcases/birth/1-birth-event-declaration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ test.describe('1. Birth event declaration', () => {
* - find the declared birth event record on this page list with saved data
*/
await expect(page.locator('#content-name')).toHaveText('In progress')
await expect(page.getByText('0 seconds ago')).toBeVisible()
await expect(page.getByText(/seconds ago/)).toBeVisible()
})
})
})
Expand Down Expand Up @@ -491,7 +491,7 @@ test.describe('1. Birth event declaration', () => {
await expect(
page.locator('#content-name', { hasText: 'In progress' })
).toBeVisible()
await expect(page.getByText('0 seconds ago')).toBeHidden()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
})

Expand Down Expand Up @@ -560,7 +560,7 @@ test.describe('1. Birth event declaration', () => {
await expect(
page.locator('#content-name', { hasText: 'In progress' })
).toBeVisible()
await expect(page.getByText('0 seconds ago')).toBeHidden()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
})

Expand Down
8 changes: 4 additions & 4 deletions e2e/testcases/birth/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export async function createDeclaration(token: string, details: BirthDetails) {
birthDate:
details.child.birthDate ||
format(
subDays(new Date(), Math.ceil(50 * Math.random())),
subDays(new Date(), 11 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
identifier: []
Expand Down Expand Up @@ -162,7 +162,7 @@ export async function createDeclaration(token: string, details: BirthDetails) {
familyName: details.mother.familyName
}
],
ageOfIndividualInYears: details.mother.age || random(20, 100),
ageOfIndividualInYears: details.mother.age || random(50, 100),
nationality: ['FAR'],
identifier: [
{
Expand Down Expand Up @@ -227,7 +227,7 @@ export async function createDeclaration(token: string, details: BirthDetails) {
birthDate:
details.father.birthDate ||
format(
subYears(new Date(), 16 + Math.ceil(10 * Math.random())),
subYears(new Date(), 36 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
nationality: ['FAR'],
Expand Down Expand Up @@ -277,7 +277,7 @@ export async function createDeclaration(token: string, details: BirthDetails) {
}
],
birthDate: format(
subYears(new Date(), 16 + Math.ceil(10 * Math.random())),
subYears(new Date(), 36 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
nationality: ['FAR'],
Expand Down
6 changes: 3 additions & 3 deletions e2e/testcases/correction-birth/correct-birth-record-1.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe('1. Correct record - 1', () => {
familyName: faker.name.firstName('female'),
gender: 'Female',
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random())),
subDays(new Date(), Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
birthLocation: 'Tembwe Rural Health Centre',
Expand Down Expand Up @@ -966,7 +966,7 @@ test.describe('1. Correct record - 1', () => {

test('1.2.6.4.2 Validate correction requested modal', async () => {
const correctionRequestedRow = page.locator(
'#listTable-task-history #row_4'
'#listTable-task-history div[id^="row_"]:has-text("Correction requested")'
)
await correctionRequestedRow.getByText('Correction requested').click()

Expand Down Expand Up @@ -1084,7 +1084,7 @@ test.describe('1. Correct record - 1', () => {

test('1.2.6.4.3 Validate correction approved modal', async () => {
const correctionApprovedRow = page.locator(
'#listTable-task-history #row_6'
'#listTable-task-history div[id^="row_"]:has-text("Correction approved")'
)
await correctionApprovedRow.getByText('Correction approved').click()

Expand Down
4 changes: 2 additions & 2 deletions e2e/testcases/correction-birth/correct-birth-record-2.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
fetchDeclaration
} from '../birth/helpers'
import { BirthDeclaration, BirthInputDetails } from '../birth/types'
import { format, parseISO, subDays } from 'date-fns'
import { format, parseISO, subYears } from 'date-fns'
import { CREDENTIALS } from '../../constants'

test.describe.serial('Correct record - 2', () => {
Expand All @@ -34,7 +34,7 @@ test.describe.serial('Correct record - 2', () => {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)),
subYears(new Date(), 25 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
email: faker.internet.email(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ test.describe.serial(' Correct record - 3', () => {
const updatedMotherDetails = {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
age: random(20, 100),
age: random(20, 45),
email: faker.internet.email(),
nationality: 'Nauru',
id: faker.random.numeric(10),
Expand Down
4 changes: 2 additions & 2 deletions e2e/testcases/correction-birth/correct-birth-record-4.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
fetchDeclaration
} from '../birth/helpers'
import { BirthDeclaration, BirthInputDetails } from '../birth/types'
import { format, subDays } from 'date-fns'
import { format, subYears } from 'date-fns'
import { CREDENTIALS } from '../../constants'

test.describe.serial(' Correct record - 4', () => {
Expand All @@ -34,7 +34,7 @@ test.describe.serial(' Correct record - 4', () => {
firstNames: faker.name.firstName('male'),
familyName: faker.name.firstName('male'),
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)),
subYears(new Date(), 25 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
email: faker.internet.email(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.describe.serial(' Correct record - 5', () => {
familyName: faker.name.firstName('female'),
gender: 'Female',
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random())),
subDays(new Date(), Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
placeOfBirth: 'Other',
Expand Down
4 changes: 2 additions & 2 deletions e2e/testcases/correction-birth/correct-birth-record-6.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
fetchDeclaration
} from '../birth/helpers'
import { BirthDeclaration, BirthInputDetails } from '../birth/types'
import { format, subDays } from 'date-fns'
import { format, subYears } from 'date-fns'
import { CREDENTIALS } from '../../constants'

test.describe.serial(' Correct record - 6', () => {
Expand All @@ -31,7 +31,7 @@ test.describe.serial(' Correct record - 6', () => {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)),
subYears(new Date(), 25 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
email: faker.internet.email(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ test.describe.serial(' Correct record - 7', () => {
const updatedMotherDetails = {
firstNames: faker.name.firstName('male'),
familyName: faker.name.firstName('male'),
age: random(20, 100),
age: random(20, 45),
email: faker.internet.email(),
nationality: 'Nauru',
id: faker.random.numeric(10),
Expand Down
4 changes: 2 additions & 2 deletions e2e/testcases/correction-birth/correct-birth-record-8.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
fetchDeclaration
} from '../birth/helpers'
import { BirthDeclaration, BirthInputDetails } from '../birth/types'
import { format, subDays } from 'date-fns'
import { format, subYears } from 'date-fns'
import { CREDENTIALS } from '../../constants'

test.describe.serial(' Correct record - 8', () => {
Expand All @@ -31,7 +31,7 @@ test.describe.serial(' Correct record - 8', () => {
firstNames: faker.name.firstName('male'),
familyName: faker.name.firstName('male'),
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)),
subYears(new Date(), 25 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
email: faker.internet.email(),
Expand Down
4 changes: 2 additions & 2 deletions e2e/testcases/correction-birth/correct-birth-record-9.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {
fetchDeclaration
} from '../birth/helpers'
import { BirthDeclaration, BirthInputDetails } from '../birth/types'
import { format, subDays } from 'date-fns'
import { format, subYears } from 'date-fns'
import { CREDENTIALS } from '../../constants'

test.describe.serial(' Correct record - 9', () => {
Expand All @@ -31,7 +31,7 @@ test.describe.serial(' Correct record - 9', () => {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
birthDate: format(
subDays(new Date(), Math.ceil(50 * Math.random() + 365 * 25)),
subYears(new Date(), 25 + Math.ceil(10 * Math.random())),
'yyyy-MM-dd'
),
email: faker.internet.email(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test.describe('10. Correct record - 10', () => {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
gender: 'Female',
age: random(20, 100),
age: random(20, 45),
nationality: 'Canada',
id: faker.random.numeric(10),
idType: 'Passport',
Expand Down Expand Up @@ -1087,7 +1087,7 @@ test.describe('10. Correct record - 10', () => {
})
test('10.2.6.5 Validate correction requested modal', async () => {
const correctionRequestedRow = page.locator(
'#listTable-task-history #row_4'
'#listTable-task-history div[id^="row_"]:has-text("Correction requested")'
)
await correctionRequestedRow.getByText('Correction requested').click()

Expand Down Expand Up @@ -1267,7 +1267,7 @@ test.describe('10. Correct record - 10', () => {
})
test('10.2.6.6 Validate correction approved modal', async () => {
const correctionApprovedRow = page.locator(
'#listTable-task-history #row_6'
'#listTable-task-history div[id^="row_"]:has-text("Correction approved")'
)
await correctionApprovedRow.getByText('Correction approved').click()

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { expect, test, type Page } from '@playwright/test'
import {
assignRecord,
// assignRecord,
createPIN,
expectOutboxToBeEmpty,
formatDateTo_ddMMMMyyyy,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.describe.serial(' Correct record - 14', () => {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
gender: 'Female',
age: random(20, 100),
age: random(20, 45),
nationality: 'Canada',
id: faker.random.numeric(10),
idType: 'Passport',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ test.describe.serial(' Correct record - 18', () => {
firstNames: faker.name.firstName('female'),
familyName: faker.name.firstName('female'),
gender: 'Female',
age: random(20, 100),
age: random(20, 45),
nationality: 'Canada',
id: faker.random.numeric(10),
idType: 'Passport',
Expand Down
6 changes: 3 additions & 3 deletions e2e/testcases/death/1-death-event-declaration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ test.describe('1. Death event declaration', () => {
* - find the declared death event record on this page list with saved data
*/
await expect(page.locator('#content-name')).toHaveText('In progress')
await expect(page.getByText('0 seconds ago')).toBeVisible()
await expect(page.getByText(/seconds ago/)).toBeVisible()
})
})
})
Expand Down Expand Up @@ -471,7 +471,7 @@ test.describe('1. Death event declaration', () => {
await expect(
page.locator('#content-name', { hasText: 'In progress' })
).toBeVisible()
await expect(page.getByText('0 seconds ago')).toBeHidden()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
})

Expand Down Expand Up @@ -540,7 +540,7 @@ test.describe('1. Death event declaration', () => {
await expect(
page.locator('#content-name', { hasText: 'In progress' })
).toBeVisible()
await expect(page.getByText('0 seconds ago')).toBeHidden()
await expect(page.getByText(/seconds ago/)).toBeHidden()
})
})

Expand Down
6 changes: 3 additions & 3 deletions e2e/testcases/death/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const declaration = {
familyName: faker.name.lastName('male') + generateRandomSuffix()
},
gender: 'male',
age: random(20, 100),
age: random(50, 100),
nationality: 'FAR',
identifier: {
type: 'NATIONAL_ID',
Expand All @@ -59,7 +59,7 @@ const declaration = {
},
event: {
manner: 'Natural causes',
date: getRandomDate(0, 20),
date: getRandomDate(0, 20, 20),
cause: {
established: true,
source: 'Physician'
Expand All @@ -73,7 +73,7 @@ const declaration = {
firstNames: faker.name.firstName('female'),
familyName: faker.name.lastName('female')
},
birthDate: getRandomDate(50, 200),
birthDate: getRandomDate(50, 200, 200),
nationality: 'Farajaland',
identifier: {
id: faker.random.numeric(10),
Expand Down
Loading

0 comments on commit 14d289b

Please sign in to comment.