Skip to content

Commit

Permalink
Merge pull request #706 from Opetushallitus/fix/OPHKIOS-91_further-de…
Browse files Browse the repository at this point in the history
…ps-upgrades

OPHKIOS-91: Lisää versiopäivityksiä
  • Loading branch information
pkoivisto authored Sep 19, 2024
2 parents 1fe0973 + 09a56d7 commit ccec250
Show file tree
Hide file tree
Showing 36 changed files with 667 additions and 513 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/common-frontend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ jobs:
wait-on: ${{ inputs.cypress-base-url }}
command: yarn ${{ inputs.app-name }}:test:cypress
timeout-minutes: 10
- name: Upload screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-screenshots
path: ${{ env.FRONTEND_DIR }}/packages/${{ inputs.app-name }}/src/tests/cypress/screenshots
- name: Build
working-directory: ${{ env.FRONTEND_DIR }}
run: yarn ${{ inputs.app-name }}:build
Expand Down
16 changes: 8 additions & 8 deletions backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@
<plugin.prettier.goal>write</plugin.prettier.goal>

<!-- openai v2 https://springdoc.org/#migrating-from-springdoc-v1 -->
<springdoc-openapi.version>2.5.0</springdoc-openapi.version>
<springdoc-openapi.version>2.6.0</springdoc-openapi.version>
<!-- latest version for Java 17 https://github.com/lukas-krecan/ShedLock#versions -->
<shedlock.version>4.47.0</shedlock.version>
<shedlock.version>4.48.0</shedlock.version>
<poi.version>5.3.0</poi.version>
<liquibase.version>4.27.0</liquibase.version>
<liquibase.version>4.29.1</liquibase.version>
</properties>

<dependencies>
Expand All @@ -51,17 +51,17 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- Force 6.3.2 since there is vulnerability in 6.3.1 -->
<!-- Force 6.3.3 since there is vulnerability in 6.3.1 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>6.3.2</version>
<version>6.3.3</version>
</dependency>
<!-- Force 6.3.2 since there is vulnerability in 6.3.1 -->
<!-- Force 6.3.3 since there is vulnerability in 6.3.1 -->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>6.3.2</version>
<version>6.3.3</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down Expand Up @@ -139,7 +139,7 @@
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.17.2</version>
<version>1.18.1</version>
</dependency>
<dependency>
<groupId>net.minidev</groupId>
Expand Down
8 changes: 4 additions & 4 deletions backend/vkt/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<dependency>
<groupId>com.github.jhonnymertz</groupId>
<artifactId>java-wkhtmltopdf-wrapper</artifactId>
<version>1.2.0-RELEASE</version>
<version>1.3.1-RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.session</groupId>
Expand All @@ -41,17 +41,17 @@
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-xml</artifactId>
<version>2.15.3</version>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>com.fasterxml.woodstox</groupId>
<artifactId>woodstox-core</artifactId>
<version>6.5.0</version>
<version>6.7.0</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-resolver-dns-native-macos</artifactId>
<version>4.1.100.Final</version>
<version>4.1.112.Final</version>
<classifier>osx-aarch_64</classifier>
<scope>runtime</scope>
</dependency>
Expand Down
32 changes: 16 additions & 16 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,29 @@
"packages/*"
],
"dependencies": {
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@fontsource/roboto": "^5.0.8",
"@mui/icons-material": "^5.14.16",
"@mui/material": "^5.14.17",
"@mui/system": "^5.14.17",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@fontsource/roboto": "^5.0.14",
"@mui/icons-material": "^5.16.7",
"@mui/material": "^5.16.7",
"@mui/system": "^5.16.7",
"@mui/x-date-pickers": "^5.0.20",
"@reduxjs/toolkit": "^1.9.7",
"@types/js-cookie": "^3.0.5",
"@types/js-cookie": "^3.0.6",
"axios": "^1.7.4",
"dayjs": "^1.11.10",
"dayjs": "^1.11.13",
"finnish-personal-identity-code-validator": "kimmotaskinen/finnish-personal-identity-code-validator#support-new-delimiters",
"history": "^5.3.0",
"i18next": "^23.6.0",
"i18next-browser-languagedetector": "^7.1.0",
"i18next": "^23.14.0",
"i18next-browser-languagedetector": "^7.2.1",
"js-cookie": "^3.0.5",
"normalize.css": "^8.0.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^13.3.1",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-i18next": "^13.5.0",
"react-redux": "^8.1.3",
"react-router-dom": "6.13.0",
"redux-saga": "^1.2.3"
"react-router-dom": "6.26.1",
"redux-saga": "^1.3.0"
},
"devDependencies": {
"@babel/core": "^7.23.2",
Expand Down Expand Up @@ -106,7 +106,7 @@
"stylelint-webpack-plugin": "^4.1.1",
"ts-unused-exports": "^10.0.1",
"typescript": "^5.2.2",
"webpack": "^5.89.0",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^4.15.1"
},
Expand Down
2 changes: 1 addition & 1 deletion frontend/packages/akr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@
"akr:tslint": "yarn g:tsc --pretty --noEmit"
},
"dependencies": {
"shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.10.6"
"shared": "npm:@opetushallitus/kieli-ja-kaantajatutkinnot.shared@1.11.1"
}
}
3 changes: 0 additions & 3 deletions frontend/packages/akr/src/pages/ContactRequestPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { ControlButtons } from 'components/contactRequest/ControlButtons';
import { useAppTranslation, useCommonTranslation } from 'configs/i18n';
import { useAppDispatch, useAppSelector } from 'configs/redux';
import { ContactRequestFormStep } from 'enums/contactRequest';
import { useNavigationProtection } from 'hooks/useNavigationProtection';
import { updateContactRequest } from 'redux/reducers/contactRequest';
import { contactRequestSelector } from 'redux/selectors/contactRequest';
import { publicTranslatorsSelector } from 'redux/selectors/publicTranslator';
Expand Down Expand Up @@ -45,8 +44,6 @@ export const ContactRequestPage = () => {
);
}, [dispatch, from, to, selectedTranslators]);

useNavigationProtection(hasLocalChanges);

const disableNextCb = (disabled: boolean) => setDisableNext(disabled);
const showControlButtons =
activeStep <= ContactRequestFormStep.PreviewAndSend;
Expand Down
24 changes: 20 additions & 4 deletions frontend/packages/akr/src/pages/clerk/ClerkSendEmailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,35 @@ export const ClerkSendEmailPage = () => {
const initialFieldErrors = { subject: '', message: '' };
const [fieldErrors, setFieldErrors] =
useState<typeof initialFieldErrors>(initialFieldErrors);

const emptyBody = StringUtils.isBlankString(email.body);
const emptySubject = StringUtils.isBlankString(email.subject);
const submitDisabled =
isLoading ||
StringUtils.isBlankString(email.subject) ||
StringUtils.isBlankString(email.body) ||
emptySubject ||
emptyBody ||
fieldErrors.message.length > 0 ||
translators.length == 0;

// Navigation
const navigate = useNavigate();

const { showToast } = useToast();

// Enable navigation protection when subject or body are modified.
// Disable navigation protection if API request succeeds or is cancelled.
useNavigationProtection(
(!emptyBody || !emptySubject) &&
!(
status === APIResponseStatus.Success ||
status === APIResponseStatus.Cancelled
),
);

// Show toast on success.
// If an error occurs, a corresponding toast is shown from within the saga.
// Finally, if API request succeeds or is cancelled, reset input fields and
// navigate back to the clerk registry view.
useEffect(() => {
if (status == APIResponseStatus.Success) {
showToast({
Expand Down Expand Up @@ -216,8 +234,6 @@ export const ClerkSendEmailPage = () => {
[t],
);

useNavigationProtection(isLoading);

return (
<Box className="clerk-send-email-page">
<H1>{t('pages.clerkSendEmailPage.title')}</H1>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,11 @@ const examinationDateToAdd = {
version: 0,
date: '2030-10-04',
};
const examinationDateToDelete = 5;

const examinationDateToDelete = {
id: 5,
dateLabel: '18.11.2021',
};

beforeEach(() => {
cy.fixture('examination_dates_10.json').then((dates) => {
Expand Down Expand Up @@ -94,7 +98,8 @@ describe('ExaminationDatesPage', () => {
});

it('should open a confirmation dialog when row delete icon is clicked, and do no changes if user backs out', () => {
onExaminationDatesPage.clickDeleteRowIcon(1);
onExaminationDatesPage.filterByStatus(ExaminationDateStatus.Passed);
onExaminationDatesPage.deleteExaminationDate(examinationDateToDelete.dateLabel);

onDialog.expectText('Haluatko varmasti poistaa tutkintopäivän?');
onDialog.clickButtonByText('Takaisin');
Expand All @@ -103,38 +108,46 @@ describe('ExaminationDatesPage', () => {
});

it('should open a confirmation dialog when row delete icon is clicked, and delete the selected examination date if user confirms', () => {
const newExaminationDates = examinationDates.filter(
(m) => m.id !== examinationDateToDelete,
);

cy.intercept('GET', APIEndpoints.ExaminationDate, [...newExaminationDates]);
onExaminationDatesPage.filterByStatus(ExaminationDateStatus.Passed);
onExaminationDatesPage.clickDeleteRowIcon(1);
onExaminationDatesPage.deleteExaminationDate(
examinationDateToDelete.dateLabel,
);

cy.intercept(
'DELETE',
`${APIEndpoints.ExaminationDate}/${examinationDateToDelete}`,
`${APIEndpoints.ExaminationDate}/${examinationDateToDelete.id}`,
{},
).as('delete');
).as('deleteExamDate');
const newExaminationDates = examinationDates.filter(
(m) => m.id !== examinationDateToDelete.id,
);
cy.intercept('GET', APIEndpoints.ExaminationDate, [
...newExaminationDates,
]).as('examDatesReload');

onDialog.clickButtonByText('Kyllä');
cy.wait('@delete');
cy.wait('@deleteExamDate');
cy.wait('@examDatesReload');

onExaminationDatesPage.expectRowToContain(0, '01.01.2022');
onExaminationDatesPage.expectRowToContain(1, '15.08.2021');
onExaminationDatesPage.expectTotalExaminationDatesCount(9);
onExaminationDatesPage.expectSelectedExaminationDatesCount(5);

onToast.expectText('Tutkintopäivä 18.11.2021 poistettu');
onToast.expectText(
`Tutkintopäivä ${examinationDateToDelete.dateLabel} poistettu`,
);
});

it('should show an error toast if examination date is chosen to be deleted, but an API error occurs', () => {
onExaminationDatesPage.filterByStatus(ExaminationDateStatus.Passed);
onExaminationDatesPage.clickDeleteRowIcon(1);
onExaminationDatesPage.deleteExaminationDate(
examinationDateToDelete.dateLabel,
);

cy.intercept(
'DELETE',
`${APIEndpoints.ExaminationDate}/${examinationDateToDelete}`,
`${APIEndpoints.ExaminationDate}/${examinationDateToDelete.id}`,
createAPIErrorResponse(APIError.ExaminationDateDeleteHasAuthorisations),
).as('deleteWithError');
onDialog.clickButtonByText('Kyllä');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ const meetingDateToAdd = {
version: 0,
date: '2030-10-04',
};
const meetingDateToBeDeleted = 5;

const meetingDateToBeDeleted = { id: 5, dateLabel: '18.11.2021' };
beforeEach(() => {
cy.fixture('meeting_dates_10.json').then((dates) => {
meetingDates = dates;
Expand Down Expand Up @@ -93,7 +92,8 @@ describe('MeetingDatesPage', () => {
});

it('should open a confirmation dialog when row delete icon is clicked, and do no changes if user backs out', () => {
onMeetingDatesPage.clickDeleteRowIcon(1);
onMeetingDatesPage.filterByStatus(MeetingDateStatus.Passed);
onMeetingDatesPage.deleteMeetingDate(meetingDateToBeDeleted.dateLabel);

onDialog.expectText('Haluatko varmasti poistaa kokouspäivän?');
onDialog.clickButtonByText('Takaisin');
Expand All @@ -102,19 +102,18 @@ describe('MeetingDatesPage', () => {
});

it('should open a confirmation dialog when row delete icon is clicked, and delete the selected meeting date if user confirms', () => {
const newMeetingDates = meetingDates.filter(
(m) => m.id !== meetingDateToBeDeleted,
);

cy.intercept('GET', APIEndpoints.MeetingDate, [...newMeetingDates]);
onMeetingDatesPage.filterByStatus(MeetingDateStatus.Passed);
onMeetingDatesPage.clickDeleteRowIcon(1);
onMeetingDatesPage.deleteMeetingDate(meetingDateToBeDeleted.dateLabel);

cy.intercept(
'DELETE',
`${APIEndpoints.MeetingDate}/${meetingDateToBeDeleted}`,
`${APIEndpoints.MeetingDate}/${meetingDateToBeDeleted.id}`,
{},
).as('delete');
const newMeetingDates = meetingDates.filter(
(m) => m.id !== meetingDateToBeDeleted.id,
);
cy.intercept('GET', APIEndpoints.MeetingDate, [...newMeetingDates]);

onDialog.clickButtonByText('Kyllä');

Expand All @@ -123,16 +122,18 @@ describe('MeetingDatesPage', () => {
onMeetingDatesPage.expectTotalMeetingDatesCount(9);
onMeetingDatesPage.expectSelectedMeetingDatesCount(5);

onToast.expectText('Kokouspäivä 18.11.2021 poistettu');
onToast.expectText(
`Kokouspäivä ${meetingDateToBeDeleted.dateLabel} poistettu`,
);
});

it('should show an error toast if meeting date is chosen to be deleted, but an API error occurs', () => {
onMeetingDatesPage.filterByStatus(MeetingDateStatus.Passed);
onMeetingDatesPage.clickDeleteRowIcon(1);
onMeetingDatesPage.deleteMeetingDate(meetingDateToBeDeleted.dateLabel);

cy.intercept(
'DELETE',
`${APIEndpoints.MeetingDate}/${meetingDateToBeDeleted}`,
`${APIEndpoints.MeetingDate}/${meetingDateToBeDeleted.id}`,
createAPIErrorResponse(APIError.MeetingDateDeleteHasAuthorisations),
).as('deleteWithError');
onDialog.clickButtonByText('Kyllä');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ describe('PublicTranslatorFilters', () => {
it('it should show a toast notification when language pair is defined, a translator is selected, and user tries to change from lang', () => {
onPublicTranslatorFilters.filterByLanguagePair(isPhone, 'suomi', 'ruotsi');
onPublicTranslatorsListing.clickTranslatorRow('1940');
onPublicTranslatorFilters.clickFromLang();

const force = true;
onPublicTranslatorFilters.clickFromLang(force);
onToast.expectText('Voit valita vain yhden kieliparin yhteydenottoon');
});

Expand Down
Loading

0 comments on commit ccec250

Please sign in to comment.