Skip to content

Commit

Permalink
Merge pull request #6044 from espoon-voltti/application-confidentiality
Browse files Browse the repository at this point in the history
Palveluohjaaja merkitsee onko hakemus salassapidettävä mikäli sitä ei voida päätellä automaattisesti
  • Loading branch information
Joosakur authored Dec 5, 2024
2 parents 9f6aba9 + 9a97d62 commit 93934a6
Show file tree
Hide file tree
Showing 43 changed files with 786 additions and 300 deletions.
7 changes: 5 additions & 2 deletions frontend/src/e2e-test/dev-api/fixtures.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2912,7 +2912,9 @@ export const applicationFixture = (
status: ApplicationStatus = 'SENT',
preferredStartDate: LocalDate = LocalDate.of(2021, 8, 16),
transferApplication = false,
assistanceNeeded = false
assistanceNeeded = false,
checkedByAdmin = false,
confidential: boolean | null = null
): DevApplicationWithForm => ({
id: applicationFixtureId,
type: type,
Expand All @@ -2931,7 +2933,8 @@ export const applicationFixture = (
connectedDaycare,
assistanceNeeded
),
checkedByAdmin: false,
checkedByAdmin,
confidential,
hideFromGuardian: false,
origin: 'ELECTRONIC',
status,
Expand Down
30 changes: 16 additions & 14 deletions frontend/src/e2e-test/dev-api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,15 @@ import axios, { AxiosResponse, InternalAxiosRequestConfig } from 'axios'
import FormData from 'form-data'
import { BaseError } from 'make-error-cause'

import { SimpleApplicationAction } from 'lib-common/generated/api-types/application'
import HelsinkiDateTime from 'lib-common/helsinki-date-time'

import config from '../config'
import { runJobs, simpleAction } from '../generated/api-clients'
import {
createDefaultPlacementPlan,
runJobs,
simpleAction
} from '../generated/api-clients'
import { DevPerson, MockVtjDataset } from '../generated/api-types'

export class DevApiError extends BaseError {
Expand Down Expand Up @@ -46,32 +51,29 @@ export const devClient = axios.create({
baseURL: config.devApiGwUrl
})

type ApplicationActionSimple =
| 'move-to-waiting-placement'
| 'cancel-application'
| 'set-verified'
| 'set-unverified'
| 'create-default-placement-plan'
| 'confirm-placement-without-decision'
| 'send-decisions-without-proposal'
| 'send-placement-proposal'
| 'confirm-decision-mailed'
type DevApplicationAction =
| SimpleApplicationAction
| 'CREATE_DEFAULT_PLACEMENT_PLAN'

export async function execSimpleApplicationAction(
applicationId: string,
action: ApplicationActionSimple,
action: DevApplicationAction,
mockedTime: HelsinkiDateTime
): Promise<void> {
try {
await simpleAction({ applicationId, action }, { mockedTime })
if (action === 'CREATE_DEFAULT_PLACEMENT_PLAN') {
await createDefaultPlacementPlan({ applicationId }, { mockedTime })
} else {
await simpleAction({ applicationId, action }, { mockedTime })
}
} catch (e) {
throw new DevApiError(e)
}
}

export async function execSimpleApplicationActions(
applicationId: string,
actions: ApplicationActionSimple[],
actions: DevApplicationAction[],
mockedTime: HelsinkiDateTime
): Promise<void> {
for (const action of actions) {
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/e2e-test/generated/api-clients.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ import { PostPairingResponseReq } from 'lib-common/generated/api-types/pairing'
import { ReservationInsert } from './api-types'
import { ServiceNeedOption } from 'lib-common/generated/api-types/serviceneed'
import { SfiMessage } from './api-types'
import { SimpleApplicationAction } from 'lib-common/generated/api-types/application'
import { SpecialDiet } from 'lib-common/generated/api-types/specialdiet'
import { StaffMemberAttendance } from 'lib-common/generated/api-types/attendance'
import { UUID } from 'lib-common/types'
Expand Down Expand Up @@ -2370,7 +2371,7 @@ export async function setTestMode(
export async function simpleAction(
request: {
applicationId: UUID,
action: string
action: SimpleApplicationAction
},
options?: { mockedTime?: HelsinkiDateTime }
): Promise<void> {
Expand Down
1 change: 1 addition & 0 deletions frontend/src/e2e-test/generated/api-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ export interface DevApplicationWithForm {
allowOtherGuardianAccess: boolean
checkedByAdmin: boolean
childId: UUID
confidential: boolean | null
createdDate: HelsinkiDateTime | null
dueDate: LocalDate | null
form: ApplicationForm
Expand Down
21 changes: 11 additions & 10 deletions frontend/src/e2e-test/pages/admin/application-workbench-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { UUID } from 'lib-common/types'

import { waitUntilTrue } from '../../utils'
import { Checkbox, Combobox, Page, Element } from '../../utils/page'
import ApplicationListView from '../employee/applications/application-list-view'
import { PlacementDraftPage } from '../employee/placement-draft-page'

import ApplicationDetailsPage from './application-details-page'
Expand Down Expand Up @@ -115,17 +114,19 @@ export class ApplicationWorkbenchPage {
return new ApplicationDetailsPage(popup)
}

async openDaycarePlacementDialogById(id: string) {
await this.getApplicationById(id)
.findByDataQa('primary-action-create-placement-plan')
.click()
return new PlacementDraftPage(this.page)
getPrimaryActionCheck(id: string) {
return this.getApplicationById(id).findByDataQa('primary-action-check')
}

getPrimaryActionCreatePlacementPlan(id: string) {
return this.getApplicationById(id).findByDataQa(
'primary-action-create-placement-plan'
)
}

async verifyApplication(applicationId: string) {
const list = new ApplicationListView(this.page)
await list.actionsMenu(applicationId).click()
await list.actionsMenuItems.setVerified.click()
async openDaycarePlacementDialogById(id: string) {
await this.getPrimaryActionCreatePlacementPlan(id).click()
return new PlacementDraftPage(this.page)
}

async clickApplicationCheckbox(applicationId: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import {
MultiSelect,
Page,
Element,
ElementCollection
ElementCollection,
Radio
} from '../../../utils/page'

export default class ApplicationListView {
Expand All @@ -20,11 +21,15 @@ export default class ApplicationListView {
#unitFilter: MultiSelect
#applications: ElementCollection
actionsMenuItems: {
verify: Element
setVerified: Element
createPlacement: Element
createDecision: Element
acceptPlacementWihtoutDecision: Element
acceptPlacementWithoutDecision: Element
cancelApplication: Element
}
cancelConfirmation: {
confidentialRadioYes: Radio
confidentialRadioNo: Radio
submitButton: Element
}
specialFilterItems: {
duplicate: Element
Expand All @@ -44,13 +49,17 @@ export default class ApplicationListView {
.find('[data-qa="table-of-applications"]')
.findAll('[data-qa="table-application-row"]')
this.actionsMenuItems = {
verify: this.#actionsMenuItemSelector('verify'),
setVerified: this.#actionsMenuItemSelector('set-verified'),
createPlacement: this.#actionsMenuItemSelector('placement-draft'),
createDecision: this.#actionsMenuItemSelector('decision'),
acceptPlacementWihtoutDecision: this.#actionsMenuItemSelector(
acceptPlacementWithoutDecision: this.#actionsMenuItemSelector(
'placement-without-decision'
)
),
cancelApplication: this.#actionsMenuItemSelector('cancel-application')
}
this.cancelConfirmation = {
confidentialRadioYes: new Radio(page.findByDataQa('confidential-yes')),
confidentialRadioNo: new Radio(page.findByDataQa('confidential-no')),
submitButton: page.findByDataQa('modal-okBtn')
}
this.specialFilterItems = {
duplicate: page.findByDataQa('application-basis-DUPLICATE_APPLICATION')
Expand All @@ -71,7 +80,7 @@ export default class ApplicationListView {
.find('[data-qa="application-actions-menu"]')

#actionsMenuItemSelector = (id: string) =>
this.page.findByDataQa(`action-item-${id}`)
this.page.findByDataQa(`menu-item-${id}`)

async toggleArea(areaName: string) {
await this.#areaFilter.fillAndSelectFirst(areaName)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ export default class ApplicationReadView {
#sendMessageButton: Element
notesList: Element
#title: Element
confidentialRadioYes: Radio
confidentialRadioNo: Radio
setVerifiedButton: Element
private notes: ElementCollection
constructor(private page: Page) {
this.#editButton = page.findByDataQa('edit-application')
Expand All @@ -43,6 +46,13 @@ export default class ApplicationReadView {
this.notesList = page.findByDataQa('application-notes-list')
this.#title = this.page.findByDataQa('application-title').find('h1')
this.notes = this.notesList.findAllByDataQa('note-container')
this.confidentialRadioYes = new Radio(
this.page.findByDataQa('confidential-yes')
)
this.confidentialRadioNo = new Radio(
this.page.findByDataQa('confidential-no')
)
this.setVerifiedButton = this.page.findByDataQa('set-verified-btn')
}

async waitUntilLoaded() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ describe('Citizen applications list', () => {
await execSimpleApplicationActions(
application.id,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-decisions-without-proposal'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_DECISIONS_WITHOUT_PROPOSAL'
],
now
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ describe('Citizen daycare applications', () => {
await createApplications({ body: [application] })
await execSimpleApplicationActions(
application.id,
['move-to-waiting-placement'],
['MOVE_TO_WAITING_PLACEMENT'],
mockedNow
)

Expand Down
18 changes: 9 additions & 9 deletions frontend/src/e2e-test/specs/0_citizen/citizen-decisions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ describe('Citizen application decisions', () => {
await execSimpleApplicationActions(
applicationId,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-decisions-without-proposal'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_DECISIONS_WITHOUT_PROPOSAL'
],
now
)
Expand Down Expand Up @@ -177,9 +177,9 @@ describe('Citizen application decisions', () => {
await execSimpleApplicationActions(
applicationId,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-decisions-without-proposal'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_DECISIONS_WITHOUT_PROPOSAL'
],
now
)
Expand Down Expand Up @@ -239,9 +239,9 @@ describe('Citizen application decisions', () => {
await execSimpleApplicationActions(
application.id,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-decisions-without-proposal'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_DECISIONS_WITHOUT_PROPOSAL'
],
now
)
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/e2e-test/specs/0_citizen/foster-parents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ test('Foster parent can create a daycare application and accept a daycare decisi
await execSimpleApplicationActions(
applicationId,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-decisions-without-proposal',
'confirm-decision-mailed'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_DECISIONS_WITHOUT_PROPOSAL',
'CONFIRM_DECISION_MAILED'
],
mockedNow
)
Expand Down Expand Up @@ -193,10 +193,10 @@ test('Foster parent can create a daycare application and accept a daycare decisi
await execSimpleApplicationActions(
applicationId,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-decisions-without-proposal',
'confirm-decision-mailed'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_DECISIONS_WITHOUT_PROPOSAL',
'CONFIRM_DECISION_MAILED'
],
HelsinkiDateTime.now() // TODO: use mock clock
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,9 @@ describe('Employee application attachments', () => {
await execSimpleApplicationActions(
applicationFixtureId,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-placement-proposal'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_PLACEMENT_PROPOSAL'
],
HelsinkiDateTime.now() // TODO: use mock clock
)
Expand Down Expand Up @@ -152,9 +152,9 @@ describe('Employee application attachments', () => {
await execSimpleApplicationActions(
applicationId,
[
'move-to-waiting-placement',
'create-default-placement-plan',
'send-placement-proposal'
'MOVE_TO_WAITING_PLACEMENT',
'CREATE_DEFAULT_PLACEMENT_PLAN',
'SEND_PLACEMENT_PROPOSAL'
],
HelsinkiDateTime.now() // TODO: use mock clock
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ describe('Application details', () => {

await execSimpleApplicationAction(
restrictedDetailsGuardianApplication.id,
'move-to-waiting-placement',
'MOVE_TO_WAITING_PLACEMENT',
HelsinkiDateTime.now() // TODO: use mock clock
)
const preferredStartDate =
Expand All @@ -173,7 +173,7 @@ describe('Application details', () => {
})
await execSimpleApplicationAction(
restrictedDetailsGuardianApplication.id,
'send-decisions-without-proposal',
'SEND_DECISIONS_WITHOUT_PROPOSAL',
HelsinkiDateTime.now() // TODO: use mock clock
)

Expand Down Expand Up @@ -202,7 +202,7 @@ describe('Application details', () => {

await execSimpleApplicationAction(
singleParentApplication.id,
'move-to-waiting-placement',
'MOVE_TO_WAITING_PLACEMENT',
HelsinkiDateTime.now() // TODO: use mock clock
)
const preferredStartDate =
Expand All @@ -218,7 +218,7 @@ describe('Application details', () => {
})
await execSimpleApplicationAction(
singleParentApplication.id,
'send-decisions-without-proposal',
'SEND_DECISIONS_WITHOUT_PROPOSAL',
HelsinkiDateTime.now() // TODO: use mock clock
)

Expand Down
Loading

0 comments on commit 93934a6

Please sign in to comment.