Skip to content

Commit

Permalink
Merge pull request #152 from CaritasDeutschland/feature-registration-…
Browse files Browse the repository at this point in the history
…accordion

Feature registration accordion
  • Loading branch information
Robin Spielmann authored Apr 9, 2021
2 parents 6acf092 + 129a7d5 commit dbc7121
Show file tree
Hide file tree
Showing 94 changed files with 3,069 additions and 2,281 deletions.
91 changes: 67 additions & 24 deletions cypress/integration/registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ const checkForGenericRegistrationElements = () => {
cy.get('#username').should('exist');
cy.get('#passwordInput').should('exist');
cy.get('#passwordConfirmation').should('exist');
cy.get('.registration__requiredInfoText').should('exist');
cy.get('#dataProtectionCheckbox').should('exist');
cy.get('.button__primary').should('exist');
cy.get('.registration__toLogin').should('exist');
Expand All @@ -25,7 +24,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.suchtberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -51,7 +52,9 @@ describe('registration', () => {
cy.intercept(config.endpoints.agencyServiceBase, agencies);
cy.visit('/registration.u25.html?aid=1');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'exist'
);
});
});

Expand All @@ -60,8 +63,10 @@ describe('registration', () => {
cy.intercept(config.endpoints.agencyServiceBase, agencies);
cy.visit('/registration.u25.html?aid=1');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.selectedAgencyInfo').should('exist');
cy.get('.formWrapper__infoText').contains(agencies[0].name);
cy.get('[data-cy=show-preselected-agency]').should('exist');
cy.get('[data-cy=show-preselected-agency]').contains(
agencies[0].name
);
});
});
});
Expand All @@ -76,7 +81,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.schwangerschaftsberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -90,7 +97,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.eltern-familie.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -104,7 +113,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.kurberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -118,7 +129,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.schuldnerberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -132,7 +145,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.allgemeine-soziale-beratung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -146,7 +161,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.leben-im-alter.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -164,7 +181,9 @@ describe('registration', () => {
'/registration.behinderung-und-psychische-erkrankung.html'
);
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -178,7 +197,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.mein-planb.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -192,7 +213,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.rechtliche-betreuung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -206,7 +229,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.straffaelligkeit.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -220,7 +245,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.hiv-aids-beratung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -234,7 +261,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.kinder-reha.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -248,7 +277,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.kinder-jugendliche.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -262,7 +293,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.kb-sucht-selbsthilfe.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -276,7 +309,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.migration.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -290,7 +325,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.rw-auswanderung.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -304,7 +341,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.hospiz-palliativ.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -318,7 +357,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.regionale-angebote.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});

Expand All @@ -332,7 +373,9 @@ describe('registration', () => {
it('should have no password reset info text', () => {
cy.visit('/registration.jungen-und-maenner.html');
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
cy.get('[data-cy=no-password-reset-possible-note]').should(
'not.exist'
);
});
});
});
15 changes: 15 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"react-app-polyfill": "^2.0.0",
"react-datepicker": "3.3.0",
"react-dev-utils": "^11.0.0",
"react-device-detect": "^1.15.0",
"react-dom": "^17.0.1",
"react-refresh": "^0.8.3",
"react-router-dom": "5.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/api/apiGetMonitoring.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { config } from '../resources/scripts/config';
import { fetchData, FETCH_METHODS, FETCH_ERRORS } from './fetchData';

export const apiGetMonitoring = async (sessionId: string) => {
const url = `${config.endpoints.getMonitoring}/${sessionId}/monitoring`;
const url = `${config.endpoints.sessionBase}/${sessionId}/monitoring`;

return fetchData({
url: url,
Expand Down
26 changes: 3 additions & 23 deletions src/api/apiPostRegistration.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
import {
removeWarningLabels,
warningLabelForTranslatableAndParentId
} from '../components/registration/warningLabels';
import { generateCsrfToken } from '../resources/scripts/helpers/generateCsrfToken';
import { autoLogin } from '../components/registration/autoLogin';
import {
Expand All @@ -14,7 +10,8 @@ let isRequestInProgress = false;
export const apiPostRegistration = (
url: string,
data: {},
handleSuccessfulRegistration: Function
handleSuccessfulRegistration: Function,
handleRegistrationConflictError: Function
) => {
removeAllCookies();
if (isRequestInProgress) {
Expand All @@ -32,7 +29,7 @@ export const apiPostRegistration = (
handleLoginSuccess: handleSuccessfulRegistration
});
} else if (xhr.readyState > 3 && xhr.status === 409) {
handleConfirmationError(xhr.response);
handleRegistrationConflictError(xhr);
isRequestInProgress = false;
} else if (
xhr.readyState > 3 &&
Expand All @@ -51,20 +48,3 @@ export const apiPostRegistration = (
xhr.send(JSON.stringify(data));
return xhr;
};

export const handleConfirmationError = (data: string) => {
removeWarningLabels();
window.scrollTo(0, 0);
if (data.includes('"usernameAvailable":0')) {
warningLabelForTranslatableAndParentId(
'warningLabels.username.unavailable',
'username'
);
}
if (data.includes('"emailAvailable":0')) {
warningLabelForTranslatableAndParentId(
'warningLabels.email.unavailable',
'email'
);
}
};
13 changes: 13 additions & 0 deletions src/api/apiPutEmail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { config } from '../resources/scripts/config';
import { fetchData, FETCH_METHODS, FETCH_ERRORS } from './fetchData';

export const apiPutEmail = async (email: string): Promise<any> => {
const url = config.endpoints.email;

return fetchData({
bodyData: email.trim(),
url: url,
method: FETCH_METHODS.PUT,
responseHandling: [FETCH_ERRORS.CONFLICT_WITH_RESPONSE]
});
};
16 changes: 16 additions & 0 deletions src/api/apiPutSessionData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { config } from '../resources/scripts/config';
import { fetchData, FETCH_METHODS } from './fetchData';

export const apiPutSessionData = async (
sessionId: number,
voluntaryData: any
): Promise<any> => {
const url = config.endpoints.sessionBase + '/' + sessionId + '/data';
const sessionData = JSON.stringify(voluntaryData);

return fetchData({
bodyData: sessionData,
url: url,
method: FETCH_METHODS.PUT
});
};
2 changes: 1 addition & 1 deletion src/api/apiSessionAssign.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const apiSessionAssign = async (
consultantId: string
) => {
const url =
config.endpoints.sessionAssign +
config.endpoints.sessionBase +
'/' +
sessionId +
'/consultant/' +
Expand Down
Loading

0 comments on commit dbc7121

Please sign in to comment.