Skip to content

Commit

Permalink
feat: 🎸 welcomeScreen tests and styling
Browse files Browse the repository at this point in the history
  • Loading branch information
koepferd committed Feb 10, 2021
1 parent 470267f commit 6706c3e
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 24 deletions.
64 changes: 60 additions & 4 deletions cypress/integration/registration.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,48 @@ describe('registration', () => {
describe('addiction', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.suchtberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('u25', () => {
it('should redirect to helpmail when no aid is given', () => {
cy.visit('/registration.u25.html');
cy.url().then((url) => {
expect(url).to.contain(config.urls.toU25Helpmail);
});
});

it('should have all generic registration page elements', () => {
cy.visit('/registration.u25.html?aid=1');
checkForGenericRegistrationElements();
cy.fixture('service.agencies.json').then((agencies) => {
cy.intercept(config.endpoints.agencyServiceBase, agencies);
cy.visit('/registration.u25.html?aid=1');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});
});

it('should have a password reset info text', () => {
cy.visit('/registration.u25.html?aid=1');
cy.get('.registration__passwordNote').should('exist');
cy.fixture('service.agencies.json').then((agencies) => {
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');
});
});

it('should have an agency info when aid is given', () => {
cy.fixture('service.agencies.json').then((agencies) => {
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);
});
Expand All @@ -51,71 +69,83 @@ describe('registration', () => {
describe('pregnancy', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.schwangerschaftsberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('parenting', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.eltern-familie.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('cure', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.kurberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('debt', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.schuldnerberatung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('social', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.allgemeine-soziale-beratung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('seniority', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.leben-im-alter.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});
Expand All @@ -125,157 +155,183 @@ describe('registration', () => {
cy.visit(
'/registration.behinderung-und-psychische-erkrankung.html'
);
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

it('should have no password reset info text', () => {
cy.visit(
'/registration.behinderung-und-psychische-erkrankung.html'
);
cy.get('[data-cy=close-welcome-screen]').click();
cy.get('.registration__passwordNote').should('not.exist');
});
});

describe('planB', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.mein-planb.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('law', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.rechtliche-betreuung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('offender', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.straffaelligkeit.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('aids', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.hiv-aids-beratung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('rehabilitation', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.kinder-reha.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('children', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.kinder-jugendliche.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('kreuzbund', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.kb-sucht-selbsthilfe.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('migration', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.migration.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('emigration', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.rw-auswanderung.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('hospice', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.hospiz-palliativ.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('regional', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.regionale-angebote.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});

describe('men', () => {
it('should have all generic registration page elements', () => {
cy.visit('/registration.jungen-und-maenner.html');
cy.get('[data-cy=close-welcome-screen]').click();
checkForGenericRegistrationElements();
});

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');
});
});
Expand Down
28 changes: 18 additions & 10 deletions src/components/registration/WelcomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { ReactComponent as PenIcon } from '../../resources/img/icons/pen.svg';
import { ReactComponent as EnvelopeIcon } from '../../resources/img/icons/envelope.svg';
import { ReactComponent as SpeechBubbleIcon } from '../../resources/img/icons/speech-bubble.svg';
import { ReactComponent as LockIcon } from '../../resources/img/icons/lock.svg';
import { ResortData } from './Registration';
import { translate } from '../../resources/scripts/i18n/translate';
import { Button, ButtonItem, BUTTON_TYPES } from '../button/Button';
import './welcomeScreen.styles';
import { Text } from '../text/Text';
import { config } from '../../resources/scripts/config';
import './welcomeScreen.styles';

const welcomeScreenData = [
{
Expand Down Expand Up @@ -57,30 +57,38 @@ export const WelcomeScreen = (props: WelcomeScreenProps) => {
<h4>{translate('registration.welcomeScreen.subline')}</h4>

<div className="registrationWelcome__infoWrapper">
{welcomeScreenData.map((infoItem) => (
<div className="registrationWelcome__infoItem">
{welcomeScreenData.map((infoItem, key) => (
<div className="registrationWelcome__infoItem" key={key}>
{infoItem.icon}
<div className="registrationWelcome__infoContent">
<h5>{infoItem.title}</h5>
<p>{infoItem.text}</p>
<Text
text={infoItem.text}
type="infoLargeAlternative"
/>
</div>
</div>
))}
</div>
<div className="registrationWelcome__buttonWrapper">
<div className="registrationWelcome__buttonsWrapper">
<div>
<p>
{translate(
<Text
text={translate(
'registration.welcomeScreen.register.helperText'
)}
</p>
type="infoLargeAlternative"
/>
<Button
buttonHandle={props.handleForwardToRegistration}
item={registrationButton}
testingAttribute="close-welcome-screen"
/>
</div>
<div>
<p>{translate('registration.login.helper')}</p>
<Text
text={translate('registration.login.helper')}
type="infoLargeAlternative"
/>
<a href={config.urls.toLogin}>
<Button isLink={true} item={loginButton} />
</a>
Expand Down
2 changes: 1 addition & 1 deletion src/components/registration/prefillPostcode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ export const redirectToRegistrationWithoutAid = () => {
};

export const redirectToHelpmail = () => {
window.location.href = config.urls.registrationHelpmailRedirect;
window.location.href = config.urls.toU25Helpmail;
};
Loading

0 comments on commit 6706c3e

Please sign in to comment.