Skip to content

Commit

Permalink
Feature/register other org sprint 31.5 EXUI_MO_3.0.63 (#1144)
Browse files Browse the repository at this point in the history
* PBA validation

* Display Error summary page

* form Error

* EUI-8801 Register other org - Contact details functionality

* EUI-8801 Register other org - Contact details functionality

* Add validation

* EUI-8801 Register other org - Contact details functionality

* fix lint

* EUI-8811 Register other org - Individual regulator yes no functionality

* EUI-8801 Register other org - Contact details functionality

* EUI-8811 Register other org - Individual regulator yes no functionality

* Update contact-details.component.spec.ts

* Fix test

* EUI-8811 Register other org - Individual regulator yes no functionality

* Add validation

* Add non-postcode validation and persistence

* EUI-8797 Register other org - CYA display amendments

* Fix merge conflicts

* Update registered-address.component.spec.ts

* PBA number persist functionality

* fix unit tests

* Make changes based on PR comments

* EUI-8797 Register other org - CYA display amendments

* Update contact-details.component.spec.ts

* Add service down check

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* EUI-8797 Register other org - CYA display amendments

* register other org workflow pages a11y tests added (#1103)

* register other org workflow pages a11y tests added

* a11y test name update

* Add test fixes

* Temporary fix for back link

* postcode validator

* EUI-8821 Register Other Org - Service not listed

* Update organisation types value

* fix typos

* EUI-8821 Register Other Org - Service not listed

* Update document-exchange-reference.component.ts

* Update yarn-audit-known-issues

* Update yarn-audit-known-issues

* Merge from base branch

* EUI-8821 Register Other Org - Service not listed

* EUI-8797 Register other org - CYA display amendments

* EUI-8838 Register Other Other - Back link not working

* Create renovate.json

* Create renovate.json

* Create renovate.json

* EUI-8838 Register Other Other - Back link not working

* Update organisation-services-access.component.spec.ts

* EUI-8838 Register Other Other - Back link not working

* EUI-8838 Register Other Other - Back link not working

* Update organisation-services-access.component.ts

* EUI-8838 Register Other Other - Back link not working

* fix the 7 digit PBA

* Call Lov API for org type

* initialise PBA

* pba fix

* EUI-8838 Register Other Other - Back link not working

* Update organisation-services-access.component.ts

* Update regulator-details.component.spec.ts

* Update organisation-services-access.component.spec.ts

* pba

* Add value to preview yaml

* register org automation test page object steps updates

* EUI-8838 Register Other Other - Back link not working

* Fix the unit tests

* EUI-8838 Register Other Other - Back link not working

* Feature/e UI 8771 postcode lookup validation (#1112)

* Commit address component changes before merge

* Finalise changes

* Change version

* Make changes to ensure back to address works correctly

* e2e test for register other create scenario

* ROO basic flow fixes

* Post Registration Data (#1122)

* Post Registration Data

* Add Validation for checkbox

* Adding error handling

* lint fix

* Update company-house-details.component.spec.ts

* code review comments

* refactoring

* fix ordering

* Clear session

* fix Organisation Type

* yarn audit

* add cancel Link

---------

Co-authored-by: John Benjamin <john.benjamin@hmcts.net>
Co-authored-by: connorpgpmcelroy <74015088+connorpgpmcelroy@users.noreply.github.com>

* EUI-8841 Register Other Org Accessibility issues

* EUI-8841 Register Other Org Accessibility issues

* EUI-8835 Register Other Org - Organisation page changes (#1124)

* EUI-8835 Register Other Org - Organisation page changes

* EUI-8835 Register Other Org - Organisation page changes

* EUI-8835 Register Other Org - Organisation page changes

* EUI-8835 Register Other Org - Organisation page changes

* EUI-8835 Register Other Org - Organisation page changes

* EUI-8835 Register Other Org - Organisation page changes

* Update yarn-audit-known-issues

* e2e test for register other create scenario (#1128)

* e2e test for register other create scenario

* ROO basic flow fixes

* Add required changes and test changes (#1131)

* Add required changes and test changes

* Add the previousUrl existence check

* Make previousUrl change

* system user auth for prd api

* ROO e2e test fix for current change impact on test

* new register org BDD scenarios

* emabled playwring as codecept driver

* CVE suppress

* hooks fix

* more ROO tests

* ROO test updates

* yarn audit changes

* playwright chromium install

* functional test screenshot fix, invite user fix

* test fixes

* Feature/e UI 8869 (#1135)

* Integrate Create Organisation

* Organisation Type

* remove dead code

* Feature toggle Organisation Details

* excluded in-dev and failing tests

* Update app.routes.ts (#1136)

* Update app.routes.ts

Blocks and redirects either of two routes to the other

* Update app.routes.ts

* Change common-lib for tag

* Change tag

* test fix

* test inclusion exclsuion in AAT preview for feature toggles features

* EUI-8841 Register Other Org - Accessibility issues

* fix Address optional fields (#1142)

* EUI-8841 Register Other Org - Accessibility issues

* EUI-8841 Register Other Org - Accessibility issues

* pa11y test updates for ROO

* EUI-8841 Register Other Org - Accessibility issues

* EUI-8841 Register Other Org - Accessibility issues

* Update yarn-audit-known-issues

* ROO functional tests (#1139)

* emabled playwring as codecept driver

* CVE suppress

* hooks fix

* more ROO tests

* ROO test updates

* yarn audit changes

* playwright chromium install

* functional test screenshot fix, invite user fix

* test fixes

* excluded in-dev and failing tests

* test fix

* test inclusion exclsuion in AAT preview for feature toggles features

* Unassigned cases functional tests added

* smoke test fix

* smoke test command fix

* yarn functional test command fix

* CVE updates

* functional test comand update

* assigned cases tests added

---------

Co-authored-by: Uday Denduluri <uday.denduluri1@hmcts.net>

* test update

* EUI-8921 Register Other Org - Back link issue

* EUI-8921 Register Other Org - Back link issue

* Update yarn-audit-known-issues

* EUI-8929 ROO Individual regulator corrections

* EUI-8929 ROO Individual regulator corrections

* Update regulator-details.component.ts

* Update yarn-audit-known-issues

* a11y test fix

* CVE to known issues

* EUI-8928 ROO CYA page corrections

* EUI-8928 ROO CYA page corrections

* Update check-your-answers.component.ts

* Fix issue

* fix test

* EUI-8927 ROO Pba details page fixes

* Merge branch 'feature/Register-Other-Org-Sprint-31.5' into bug/EUI-8929-ROO-Individual-regulator-corrections

* Update yarn-audit-known-issues

* Move logic to app-utils

* EUI-8927 ROO Pba details page fixes

* Feature/e UI 8831 review roo (#1149)

* Commit all design changes

- Form group changes
- Tobedefined changes
- Error message changes
-Fieldset changes

* Update index.ts

---------

Co-authored-by: David Rajkumar Jayakumar <107850923+DavidJayakumar@users.noreply.github.com>

* EUI-8939 ROO PBA changes on CYA page

* EUI-8939 ROO PBA changes on CYA page

* Update yarn-audit-known-issues

* EUI-8939 ROO PBA changes on CYA page

* EUI-8927 ROO Pba details page fixes

* EUI-8926 ROO Organisation regulators fixes

* Update yarn-audit-known-issues

* EUI-8927 ROO Pba details page fixes

* EUI-8926 ROO Organisation regulators fixes

* EUI-8926 ROO Organisation regulators fixes

* Fix test failure

* Make error message changes (#1161)

* fix issue in CYA

* EUI-8927 ROO Pba details page fixes

* Update yarn-audit-known-issues

* invite ueer validation test added

* Make address postcode fix (#1167)

* Make address postcode fix

* Update registered-address.component.ts

* Make changes to error message display on 400 (#1163)

* Make changes to error message display on 400

* Make PR comment changes

* Add inline error removal and scrolling to error

* Update .nvmrc

* node version rollback

* ROO test updates to use user targetting (#1178)

* e2e creayte org usertargetting chnages

* node version update

* fix src import

* test updated to use user targgeted user for ROO

---------

Co-authored-by: John Benjamin <john.benjamin@hmcts.net>
Co-authored-by: DavidJayakumar <David.Jayakumar@hmcts.net>
Co-authored-by: David Rajkumar Jayakumar <107850923+DavidJayakumar@users.noreply.github.com>
Co-authored-by: connorpgpmcelroy <connor.mcelroy@hmcts.net>
Co-authored-by: John Benjamin <90200268+johnbenjamin-hmcts@users.noreply.github.com>
Co-authored-by: sreekanthpuligadda <52752138+sreekanthpuligadda@users.noreply.github.com>
Co-authored-by: connorpgpmcelroy <74015088+connorpgpmcelroy@users.noreply.github.com>
Co-authored-by: sreekanthpuligadda <sreekanth.puligadda@hmcts.net>
  • Loading branch information
9 people authored Nov 14, 2023
1 parent 29fa79f commit c994f99
Show file tree
Hide file tree
Showing 60 changed files with 1,871 additions and 458 deletions.
7 changes: 6 additions & 1 deletion api/registerOrganisation/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,14 @@ export async function handleRegisterOrgRoute(req: Request, res: Response, next:
try {
const registerRequest = mapRequestObject(registerPayload);
const response = await axiosInstance.post(url, registerRequest, options);

res.send(response.data);
} catch (error) {
next(error);
if (error.status === 400 && error.data?.errorDescription) {
res.status(400).send(error.data);
} else {
next(error);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
"@hmcts/frontend": "0.0.50-alpha",
"@hmcts/nodejs-healthcheck": "1.7.0",
"@hmcts/properties-volume": "0.0.13",
"@hmcts/rpx-xui-common-lib": "1.9.0-route-expected-feature-2",
"@hmcts/rpx-xui-common-lib": "1.9.0-error-message-change",
"@hmcts/rpx-xui-node-lib": "2.27.1",
"@ng-idle/core": "^10.0.0",
"@ng-idle/keepalive": "^10.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ describe('HmctsGlobalHeaderComponent', () => {
component.headerTitle = { ...component.headerTitle, hideBranding: false };
fixture.detectChanges();
const headerTitle = fixture.debugElement.nativeElement.querySelector('.govuk-header__logotype-text');
expect(headerTitle).toBeDefined();
expect(headerTitle).not.toBeNull();
expect(headerTitle.textContent).toContain('MyHMCTS');
expect(component.headerTitle.hideBranding).toBeFalsy();
Expand Down
3 changes: 1 addition & 2 deletions src/app/containers/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<xuilib-cookie-banner
<xuilib-cookie-banner
[identifier]="cookieName"
[appName]="'MyHMCTS'"
*ngIf="isCookieBannerVisible"
Expand All @@ -8,7 +8,6 @@

<a [routerLink]="" fragment="{{mainContentId}}" class="govuk-skip-link" (click)="onFocusMainContent()">Skip to main content</a>
<app-loader></app-loader>
<title>{{pageTitle$ | async}}</title>

<app-header
[navItems]="navItems$ | async"
Expand Down
20 changes: 13 additions & 7 deletions src/app/containers/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { Component, Inject, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { CookieService, FeatureToggleService, FeatureUser, GoogleAnalyticsService, ManageSessionServices } from '@hmcts/rpx-xui-common-lib';
import { select, Store } from '@ngrx/store';
import { Store, select } from '@ngrx/store';
import { Observable, Subscription } from 'rxjs';
import { LoggerService } from '../../../shared/services/logger.service';

import { AppConstants } from '../../../app/app.constants';
import { EnvironmentConfig, ENVIRONMENT_CONFIG } from '../../../models/environmentConfig.model';
import { ENVIRONMENT_CONFIG, EnvironmentConfig } from '../../../models/environmentConfig.model';
import { HeadersService } from '../../../shared/services/headers.service';
import { LoggerService } from '../../../shared/services/logger.service';
import { UserService } from '../../../user-profile/services/user.service';
import * as fromUserProfile from '../../../user-profile/store';
import { AppTitlesModel } from '../../models/app-titles.model';
Expand Down Expand Up @@ -40,6 +40,7 @@ export class AppComponent implements OnInit, OnDestroy {
public cookieName;
public isCookieBannerVisible: boolean = false;
private cookieBannerEnabledSubscription: Subscription;
private pageTitleSubscription: Subscription;

private cookieBannerEnabled: boolean = false;
constructor(
Expand All @@ -52,6 +53,7 @@ export class AppComponent implements OnInit, OnDestroy {
private readonly idleService: ManageSessionServices,
private readonly loggerService: LoggerService,
private readonly cookieService: CookieService,
private titleService: Title
) {}

public ngOnInit(): void {
Expand All @@ -73,6 +75,11 @@ export class AppComponent implements OnInit, OnDestroy {
this.store.dispatch(new fromRoot.SetPageTitle(rootState.state.url));
}
});

this.pageTitleSubscription = this.pageTitle$.subscribe((title) => {
this.titleService.setTitle(title? title : 'Manage organisation');
});

if (this.headersService.isAuthenticated()) {
this.userService.getUserDetails().subscribe((user) => {
const featureUser: FeatureUser = {
Expand All @@ -97,9 +104,8 @@ export class AppComponent implements OnInit, OnDestroy {
}

public ngOnDestroy(): void {
if (this.cookieBannerEnabledSubscription) {
this.cookieBannerEnabledSubscription.unsubscribe();
}
this.cookieBannerEnabledSubscription?.unsubscribe();
this.pageTitleSubscription?.unsubscribe();
}

public handleCookieBannerFeatureToggle(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/app/containers/redirect/redirect.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,6 @@ describe('AppRedirectComponent', () => {
});

it('should have redirect property ', () => {
expect(app.redirected).toBeDefined();
expect(app.redirected).toBe(false);
});
});
226 changes: 179 additions & 47 deletions src/app/utils/app-utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LovRefDataModel } from '../../shared/models/lovRefData.model';
import { propsExist } from '../../../api/lib/objectUtilities';
import { AppConstants } from '../app.constants';
import { AppFeatureFlag } from '../store/reducers/app.reducer';
Expand Down Expand Up @@ -89,64 +90,131 @@ describe('AppUtils', () => {
expect(array).toEqual(state.userNav);
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('invite-users');
expect(array).toEqual('Invite user - Manage organisation');
});
describe('Page title', () => {
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/register');
expect(array).toEqual('Register - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('organisation-name');
expect(array).toEqual('Organisation name - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/organisation-type');
expect(array).toEqual('Organisation type - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('organisation-address');
expect(array).toEqual('Organisation address - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/company-house-details');
expect(array).toEqual('Company house details - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('organisation-pba');
expect(array).toEqual('PBA - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/document-exchange-reference');
expect(array).toEqual('Document exchange reference - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('have-dx');
expect(array).toEqual('DX - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/regulatory-organisation-type');
expect(array).toEqual('Organisation regulators - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('organisation-dx');
expect(array).toEqual('DX reference - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/organisation-services-access');
expect(array).toEqual('Services to access - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('haveSra');
expect(array).toEqual('SRA - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/payment-by-account');
expect(array).toEqual('Payment by account - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('sraNumber');
expect(array).toEqual('SRA number - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/individual-registered-with-regulator');
expect(array).toEqual('Individual regulators - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('name');
expect(array).toEqual('Name - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org-new/check-your-answers');
expect(array).toEqual('Check your answers - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('email-address');
expect(array).toEqual('Email - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/organisation-name');
expect(array).toEqual('Organisation name - Register organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('check');
expect(array).toEqual('Check answers - Register organisation');
});
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/organisation-address');
expect(array).toEqual('Organisation address - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/organisation-pba');
expect(array).toEqual('PBA - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/organisation-have-dx');
expect(array).toEqual('DX - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/organisation-dx');
expect(array).toEqual('DX reference - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/haveSra');
expect(array).toEqual('SRA - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/sraNumber');
expect(array).toEqual('SRA number - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/name');
expect(array).toEqual('Name - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/email-address');
expect(array).toEqual('Email - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register/check');
expect(array).toEqual('Check answers - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('register-org/register');
expect(array).toEqual('Register - Register organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('invite-users');
expect(array).toEqual('Invite user - Manage organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('organisation');
expect(array).toEqual('Organisation details - Manage organisation');
});

it('should set correct page titles', () => {
const array = AppUtils.setPageTitle('register-org/register');
expect(array).toEqual('Register - Register organisation');
it('should set correct page title', () => {
const array = AppUtils.setPageTitle('users');
expect(array).toEqual('Users - Manage organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('unassigned-cases');
expect(array).toEqual('Unassigned cases - Manage organisation');
});

it('should set correct page title', () => {
const array = AppUtils.setPageTitle('assigned-cases');
expect(array).toEqual('Assigned cases - Manage organisation');
});
});

it('should switch title', () => {
Expand Down Expand Up @@ -360,4 +428,68 @@ describe('AppUtils', () => {
const result = AppUtils.findLastIndex(htmlComponentArray2, predicate);
expect(result).toEqual(-1);
});

describe('setOtherAsLastOption', () => {
let itmes: LovRefDataModel[];
let other: LovRefDataModel;

beforeEach(() => {
itmes = [
{
active_flag: 'Y',
category_key: 'Org',
child_nodes: null,
hint_text_cy: '',
hint_text_en: '',
key: 'DEFENCE',
lov_order: null,
parent_category: '',
parent_key: '',
value_cy: '',
value_en: 'Defence'
},
{
active_flag: 'Y',
category_key: 'Org',
child_nodes: null,
hint_text_cy: '',
hint_text_en: '',
key: 'CHARITY',
lov_order: null,
parent_category: '',
parent_key: '',
value_cy: '',
value_en: 'Charity'
}
];

other = {
active_flag: '',
category_key: '',
hint_text_cy: '',
hint_text_en: '',
key: 'OTHER',
lov_order: null,
parent_category: '',
parent_key: '',
value_cy: '',
value_en: 'Other',
child_nodes: null
};
});

it('should set Other as last option if not available in the input list', () => {
const itemsWithOther = AppUtils.setOtherAsLastOption(itmes);
itmes.push(other);
expect(itemsWithOther).toEqual(itmes);
expect(itemsWithOther[itemsWithOther.length - 1]).toEqual(other);
});

it('should move other to the last position if it is available in the input list', () => {
itmes.splice(1, 0, other);
const itemsWithOther = AppUtils.setOtherAsLastOption(itmes);
expect(itemsWithOther).toBe(itmes);
expect(itemsWithOther[itemsWithOther.length - 1]).toEqual(other);
});
});
});
Loading

0 comments on commit c994f99

Please sign in to comment.