diff --git a/frontend/packages/vkt/src/components/publicEnrollment/PublicEnrollmentPaymentSum.tsx b/frontend/packages/vkt/src/components/publicEnrollment/PublicEnrollmentPaymentSum.tsx
index e10c2ee41..8d4f03708 100644
--- a/frontend/packages/vkt/src/components/publicEnrollment/PublicEnrollmentPaymentSum.tsx
+++ b/frontend/packages/vkt/src/components/publicEnrollment/PublicEnrollmentPaymentSum.tsx
@@ -28,7 +28,12 @@ export const PublicEnrollmentPaymentSum = ({
return (
-
{content}
+
+ {content}
+
);
};
diff --git a/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts b/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts
index 5daaa1f2b..7d4f4c207 100644
--- a/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts
+++ b/frontend/packages/vkt/src/tests/cypress/integration/public_enrollment.spec.ts
@@ -1,6 +1,7 @@
import { HTTPStatusCode } from 'shared/enums';
import { APIEndpoints } from 'enums/api';
+import { PublicReservationResponse } from 'interfaces/publicEnrollment';
import { onPublicEnrollmentPage } from 'tests/cypress/support/page-objects/publicEnrollmentPage';
import { onPublicHomePage } from 'tests/cypress/support/page-objects/publicHomePage';
import { onToast } from 'tests/cypress/support/page-objects/toast';
diff --git a/frontend/packages/vkt/src/tests/cypress/integration/public_free_enrollment.spec.ts b/frontend/packages/vkt/src/tests/cypress/integration/public_free_enrollment.spec.ts
new file mode 100644
index 000000000..15059459f
--- /dev/null
+++ b/frontend/packages/vkt/src/tests/cypress/integration/public_free_enrollment.spec.ts
@@ -0,0 +1,40 @@
+import { onPublicEnrollmentPage } from 'tests/cypress/support/page-objects/publicEnrollmentPage';
+import { examEventIdWithKoskiEducationDetailsFound } from 'tests/msw/fixtures/publicEnrollmentInitialisation';
+
+describe('Public enrollment without payment', () => {
+ it('is possible when suitable education credentials are returned from KOSKI', () => {
+ cy.openPublicEnrollmentPage(examEventIdWithKoskiEducationDetailsFound);
+ onPublicEnrollmentPage.expectTextContents(
+ 'Tietojemme mukaan olet suorittanut tai suorittamassa seuraavan tutkinnon:',
+ );
+ onPublicEnrollmentPage.expectTextContents('Ylioppilastutkinto');
+
+ onPublicEnrollmentPage.fillOutContactDetails('email', 'test@test.invalid');
+ onPublicEnrollmentPage.fillOutContactDetails(
+ 'emailConfirmation',
+ 'test@test.invalid',
+ );
+ onPublicEnrollmentPage.fillOutContactDetails('phoneNumber', '040112233');
+ onPublicEnrollmentPage.clickNext();
+ onPublicEnrollmentPage.checkEnrollmentPreviouslyEnrolledCheckbox(
+ 'previously-enrolled-no',
+ );
+ onPublicEnrollmentPage.enrollmentFullExamCheckbox();
+ onPublicEnrollmentPage.fillOutCertificateShippingDetails('street', 'Katu');
+ onPublicEnrollmentPage.fillOutCertificateShippingDetails(
+ 'postalCode',
+ '99800',
+ );
+ onPublicEnrollmentPage.fillOutCertificateShippingDetails(
+ 'town',
+ 'Kaupunki',
+ );
+ onPublicEnrollmentPage.fillOutCertificateShippingDetails(
+ 'country',
+ 'Suomi',
+ );
+ onPublicEnrollmentPage.clickNext();
+
+ onPublicEnrollmentPage.expectPaymentSum('Maksuton');
+ });
+});
diff --git a/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicEnrollmentPage.ts b/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicEnrollmentPage.ts
index 937c64549..c8442ba9a 100644
--- a/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicEnrollmentPage.ts
+++ b/frontend/packages/vkt/src/tests/cypress/support/page-objects/publicEnrollmentPage.ts
@@ -30,6 +30,9 @@ class PublicEnrollmentPage {
cy.get(`#has-previous-enrollment-error`),
enrollmentFullExamCheckbox: () =>
cy.findByTestId('enrollment-checkbox-full-exam').find('input'),
+ formTextContents: () =>
+ cy.get('div.public-enrollment__grid__form-container'),
+ paymentSumHeading: () => cy.findByTestId('public-enrollment__payment-sum'),
};
expectEnrollmentDetails(details: string) {
@@ -110,6 +113,12 @@ class PublicEnrollmentPage {
enrollmentFullExamCheckbox() {
this.elements.enrollmentFullExamCheckbox().should('be.exist').check();
}
+ expectTextContents(contents: string) {
+ this.elements.formTextContents().should('contain.text', contents);
+ }
+ expectPaymentSum(sum: string) {
+ this.elements.paymentSumHeading().should('contain.text', sum);
+ }
}
export const onPublicEnrollmentPage = new PublicEnrollmentPage();
diff --git a/frontend/packages/vkt/src/tests/msw/fixtures/publicEnrollmentInitialisation.ts b/frontend/packages/vkt/src/tests/msw/fixtures/publicEnrollmentInitialisation.ts
index a59478b89..cd7358f45 100644
--- a/frontend/packages/vkt/src/tests/msw/fixtures/publicEnrollmentInitialisation.ts
+++ b/frontend/packages/vkt/src/tests/msw/fixtures/publicEnrollmentInitialisation.ts
@@ -20,3 +20,17 @@ export const publicEnrollmentInitialisation = {
isRenewable: true,
},
};
+
+export const examEventIdWithKoskiEducationDetailsFound = 234;
+
+export const publicEnrollmentInitialisationWithFreeEnrollments = {
+ ...publicEnrollmentInitialisation,
+ examEvent: {
+ ...publicEnrollmentInitialisation.examEvent,
+ id: examEventIdWithKoskiEducationDetailsFound,
+ },
+ freeEnrollmentDetails: {
+ freeOralSkillLeft: 3,
+ freeTextualSkillLeft: 3,
+ },
+};
diff --git a/frontend/packages/vkt/src/tests/msw/handlers.ts b/frontend/packages/vkt/src/tests/msw/handlers.ts
index 42a04930b..843553703 100644
--- a/frontend/packages/vkt/src/tests/msw/handlers.ts
+++ b/frontend/packages/vkt/src/tests/msw/handlers.ts
@@ -10,7 +10,11 @@ import { clerkExamEvent } from 'tests/msw/fixtures/clerkExamEvent';
import { clerkExamEvents9 } from 'tests/msw/fixtures/clerkExamEvents9';
import { clerkPaymentRefunded } from 'tests/msw/fixtures/clerkPaymentRefunded';
import { person } from 'tests/msw/fixtures/person';
-import { publicEnrollmentInitialisation } from 'tests/msw/fixtures/publicEnrollmentInitialisation';
+import {
+ examEventIdWithKoskiEducationDetailsFound,
+ publicEnrollmentInitialisation,
+ publicEnrollmentInitialisationWithFreeEnrollments,
+} from 'tests/msw/fixtures/publicEnrollmentInitialisation';
import { publicExamEvents11 } from 'tests/msw/fixtures/publicExamEvents11';
export const handlers = [
@@ -30,8 +34,18 @@ export const handlers = [
return new Response(cookies.noAuth ? 'null' : JSON.stringify(person));
}),
- http.get(APIEndpoints.PublicEducation, () => {
- return new Response(JSON.stringify([]));
+ http.get(APIEndpoints.PublicEducation, ({ request }) => {
+ if (
+ request.referrer.endsWith(
+ `/vkt/ilmoittaudu/${examEventIdWithKoskiEducationDetailsFound}/tiedot`,
+ )
+ ) {
+ return new Response(
+ JSON.stringify([{ educationType: 'ylioppilas', isActive: true }]),
+ );
+ } else {
+ return new Response(JSON.stringify([]));
+ }
}),
http.get(APIEndpoints.PublicExamEvent, () => {
return new Response(JSON.stringify(publicExamEvents11));
@@ -108,7 +122,23 @@ export const handlers = [
status: 200,
});
}),
+ http.get(
+ `${APIEndpoints.PublicExamEvent}/${examEventIdWithKoskiEducationDetailsFound}/enrollment`,
+ () => {
+ return new Response(
+ JSON.stringify(publicEnrollmentInitialisationWithFreeEnrollments),
+ {
+ status: 200,
+ },
+ );
+ },
+ ),
http.put(`${APIEndpoints.ClerkPayment}/1/refunded`, () => {
return new Response(JSON.stringify(clerkPaymentRefunded), { status: 200 });
}),
+ http.get(APIEndpoints.FeatureFlags, () => {
+ return new Response(JSON.stringify({ freeEnrollmentAllowed: true }), {
+ status: 200,
+ });
+ }),
];