Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ describe('FinesAccNoteAddFormComponent', () => {
'activity_note.record_id',
mockFinesAccountStore.account_id,
);
expect(interception.request.body).to.have.nested.property('activity_note.record_type', 'DEFENDANT_ACCOUNTS');
expect(interception.request.body).to.have.nested.property('activity_note.record_type', 'defendant_accounts');
});
},
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ export class ConsolidationActions {
/**
* Selects a business unit when the selector is present.
* If a single business unit is auto-selected, verifies the informational message instead.
* @param businessUnit - Optional business unit name to select from the autocomplete. If not provided, the first option will be selected.
*/
public selectBusinessUnitIfRequired(): void {
public selectBusinessUnitIfRequired(businessUnit?: string): void {
// Wait for the select business unit form and its business unit branch to finish rendering
// before deciding whether we are in the single-BU or autocomplete path.
cy.get(SelectBusinessUnitLocators.heading, { timeout: 10_000 }).should('contain.text', 'Consolidate accounts');
Expand All @@ -168,7 +169,20 @@ export class ConsolidationActions {
});
return;
}

if (businessUnit) {
log('select', `Selecting business unit "${businessUnit}" from autocomplete`);
cy.get(SelectBusinessUnitLocators.businessUnitInput, { timeout: 10_000 }).should('be.visible').click();
cy.get(SelectBusinessUnitLocators.businessUnitAutoComplete, { timeout: 10_000 })
.should('be.visible')
.contains('li', businessUnit)
.should('be.visible')
.then(($item) => {
const businessUnitName = $item.text().trim();
this.setSelectedBusinessUnitAlias(businessUnitName);
cy.wrap($item).click();
});
return;
}
log('select', 'Selecting first available business unit from autocomplete');
cy.get(SelectBusinessUnitLocators.businessUnitInput, { timeout: 10_000 }).should('be.visible').click();
cy.get(SelectBusinessUnitLocators.businessUnitAutoComplete, { timeout: 10_000 })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ export class SearchFilterByBUFinesActions {
const name = rawName.trim();

cy.contains('td.govuk-table__cell label.govuk-checkboxes__label', name)
.scrollIntoView()
.should('be.visible')
.invoke('attr', 'for')
.then((id) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ Feature: Fines Account Consolidation
| account.payment_card_request | false |
| account.defendant.dob | 2002-05-15 |
When I open Consolidate accounts
When I continue to the consolidation account search as an "Individual" defendant
When I continue to the consolidation account search as an "Individual" defendant selecting business unit "Camberwell Green"
Then I am on the consolidation Search tab for Individuals
And I enter the following consolidation search details:
| last name | ResultLink{uniq} |
Expand Down Expand Up @@ -133,7 +133,7 @@ Feature: Fines Account Consolidation
| account.payment_card_request | false |
| account.defendant.dob | 2002-05-15 |
When I open Consolidate accounts
And I continue to the consolidation account search as an "Individual" defendant
And I continue to the consolidation account search as an "Individual" defendant selecting business unit "Camberwell Green"
Then I am on the consolidation Search tab for Individuals
And I enter the following consolidation search details:
| last name | ConsolidationZero |
Expand Down Expand Up @@ -208,7 +208,7 @@ Feature: Fines Account Consolidation
| account.prosecutor_case_reference | CONS-RESULT-COMP-{uniq} |
| account.account_type | Fine |
When I open Consolidate accounts
When I continue to the consolidation account search as an "Company" defendant
When I continue to the consolidation account search as an "Company" defendant selecting business unit "Camberwell Green"
Then I am on the consolidation Search tab for Companies
And I enter the following consolidation search details:
| company name | Consolidation Result Co {uniq} |
Expand Down Expand Up @@ -247,7 +247,7 @@ Feature: Fines Account Consolidation
| account.collection_order_made_today | false |
| account.payment_card_request | false |
When I open Consolidate accounts
And I continue to the consolidation account search as an "Company" defendant
And I continue to the consolidation account search as an "Company" defendant selecting business unit "Camberwell Green"
Then I am on the consolidation Search tab for Companies
And I enter the following consolidation search details:
| company name | Consolidation Zero Balance Co {uniq} |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Feature: Accessibility Tests for Fines Consolidation
| account.defendant.dob | 2002-05-15 |
When I open Consolidate accounts
Then I check the page for accessibility
And I continue to the consolidation account search as an "Individual" defendant
And I continue to the consolidation account search as an "Individual" defendant selecting business unit "Camberwell Green"
Then I am on the consolidation Search tab for Individuals
And I check the page for accessibility
And I enter the following consolidation search details:
Expand Down Expand Up @@ -63,7 +63,7 @@ Feature: Accessibility Tests for Fines Consolidation
| account.payment_card_request | false |
When I open Consolidate accounts
Then I check the page for accessibility
And I continue to the consolidation account search as an "Company" defendant
And I continue to the consolidation account search as an "Company" defendant selecting business unit "Camberwell Green"
Then I am on the consolidation Search tab for Companies
And I check the page for accessibility
And I enter the following consolidation search details:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Feature: Navigate and edit sections from task list

And I complete manual account creation with the following fields and defaults for account header "TEST Rejected-PO-640-company-{uniq}":
| Section | Field | Value |
| Court details | Sending area or Local Justice Area (LJA) | Avon |
| Court details | Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Court details | Prosecutor Case Reference (PCR) | abcd1234a |
| Court details | Enforcement court | ATCM Test (828) |
| Company details | Company name | TEST COMPANY LTD {uniq} |
Expand Down Expand Up @@ -107,7 +107,7 @@ Feature: Navigate and edit sections from task list

When I complete manual account creation with the following fields and defaults for account header "Mr Rejected-PO-640-AdultOrYouthOnly TEST{uniq}":
| Section | Field | Value |
| Court details | Sending area or Local Justice Area (LJA) | Avon |
| Court details | Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Court details | Prosecutor Case Reference (PCR) | abcd1234a |
| Court details | Enforcement court | ATCM Test (828) |
| Personal details | Title | Mr |
Expand Down Expand Up @@ -208,7 +208,7 @@ Feature: Navigate and edit sections from task list

When I complete manual account creation with the following fields and defaults for account header "Miss Rejected-PO-640-pgToPay TEST{uniq}":
| Section | Field | Value |
| Court details | Sending area or Local Justice Area (LJA) | Avon |
| Court details | Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Court details | Prosecutor Case Reference (PCR) | abcd1234a |
| Court details | Enforcement court | Court 777 Camberwell CH09 (777) |
| Personal details | Title | Miss |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ Feature: Manual account creation - Create Draft Account
When I start a fine manual account for business unit "West London" with defendant type "Company" and originator type "New"
And I view the "Court details" task
And I complete manual court details:
| Sending area or Local Justice Area (LJA) | Avon |
| Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Prosecutor Case Reference (PCR) | abcd1234a |
| Enforcement court | Aram Court (100) |
Then the manual court details fields are:
| Sending area or Local Justice Area (LJA) | Avon |
| Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Prosecutor Case Reference (PCR) | ABCD1234A |
| Enforcement court | Aram Court (100) |
And returning to account details the "Court details" task the status is "Provided"
Expand Down Expand Up @@ -505,7 +505,7 @@ Feature: Manual account creation - Create Draft Account
And I see the following text on the page "Search using the code or name of the sending police force that sent the caution"

When I complete manual court details:
| Sending police force | Avon |
| Sending police force | Avon & Somerset |
| Prosecutor Case Reference (PCR) | 1234 |
| Enforcement court | West London VPFPO |
And I return to account details
Expand Down Expand Up @@ -545,7 +545,7 @@ Feature: Manual account creation - Create Draft Account
When I create a "<Originator type>" manual "Fine" account for business unit "West London" with defendant type "Company"
And I complete manual account creation with the following fields and defaults:
| Section | Field | Value | Imposition |
| Court | Sending area or Local Justice Area (LJA) | Avon | |
| Court | Sending area or Local Justice Area (LJA) | Avon & Somerset | |
| Court | Prosecutor Case Reference | 1234 | |
| Court | Enforcement court | West London VPFPO | |
| Offence | Offence code | HY35014 | 1 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Feature: Manual account creation - Court Details
@JIRA-KEY:POT-3184
Scenario: (AC.8, AC.9) Entered data persists in the session [@PO-272, @PO-344, @PO-345, @PO-389, @PO-527, @PO-529]
When I complete manual court details:
| Sending area or Local Justice Area (LJA) | Avon |
| Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Prosecutor Case Reference (PCR) | 1234 |
| Enforcement court | West London VPFPO (101) |
And I return to account details
Expand All @@ -34,7 +34,7 @@ Feature: Manual account creation - Court Details
@JIRA-KEY:POT-3185
Scenario: (AC.10) Unsaved court details are cleared when user confirms cancel [@PO-272, @PO-344, @PO-345, @PO-389, @PO-527, @PO-529]
When I complete manual court details:
| Sending area or Local Justice Area (LJA) | Avon |
| Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Prosecutor Case Reference (PCR) | 1234 |
| Enforcement court | West London VPFPO |
And I cancel manual court details choosing "Ok" and return to account details
Expand All @@ -48,7 +48,7 @@ Feature: Manual account creation - Court Details
@JIRA-KEY:POT-3186
Scenario: (AC.11) Confirming cancel restores last saved court details [@PO-272, @PO-344, @PO-345, @PO-389, @PO-527, @PO-529]
When I complete manual court details:
| Sending area or Local Justice Area (LJA) | Avon |
| Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Prosecutor Case Reference (PCR) | 1234 |
| Enforcement court | West London VPFPO |
And I return to account details
Expand Down Expand Up @@ -87,7 +87,7 @@ Feature: Manual account creation - Court Details
@JIRA-KEY:POT-3190
Scenario: (AC.6) Grey navigation links routes correctly [@PO-272, @PO-389]
When I complete manual court details:
| Sending area or Local Justice Area (LJA) | Avon |
| Sending area or Local Justice Area (LJA) | Avon & Somerset |
| Prosecutor Case Reference (PCR) | 1234 |
| Enforcement court | West London VPFPO |
And I continue to personal details from court details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,10 @@ export class SearchFilterByBUFlow {
.trim();

log('debug', `Normalised filter summary text: "${normalised}"`);

expect(normalised).to.equal(expectedSummary);
normalised.split(',').forEach((part) => {
log('debug', `Summary part: "${part.trim()}"`);
expect(expectedSummary).to.include(part.trim());
});
});
}

Expand Down
5 changes: 3 additions & 2 deletions cypress/e2e/functional/opal/flows/consolidation.flow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,11 @@ export class ConsolidationFlow {
/**
* Completes select-business-unit inputs and continues to account search.
* @param defendantType - "Individual" or "Company"
* @param businessUnit - Optional business unit name to select from the autocomplete. If not provided, the first option will be selected.
*/
public continueToConsolidationAccountSearch(defendantType: ConsolidationDefendantType): void {
public continueToConsolidationAccountSearch(defendantType: ConsolidationDefendantType, businessUnit?: string): void {
log('flow', 'Continuing from select business unit to consolidation account search', { defendantType });
this.consolidation.selectBusinessUnitIfRequired();
this.consolidation.selectBusinessUnitIfRequired(businessUnit);
this.consolidation.selectDefendantType(defendantType);
this.consolidation.continueFromSelectBusinessUnit();
this.consolidation.waitForAccountSearchScreen(defendantType);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ When(
},
);

When(
'I continue to the consolidation account search as an {string} defendant selecting business unit {string}',
(defendantType: ConsolidationDefendantType, businessUnit: string) => {
log('step', 'Continuing to consolidation account search with business unit', { defendantType, businessUnit });
consolidationFlow().continueToConsolidationAccountSearch(defendantType, businessUnit);
},
);

When('I click Search on consolidation account search', () => {
log('step', 'Clicking Search on consolidation account search');
consolidationFlow().clickConsolidationSearch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ describe('FinesAccPayloadService', () => {

expect(result).toEqual({
activity_note: {
record_type: 'DEFENDANT_ACCOUNTS',
record_type: 'defendant_accounts',
record_id: 77,
note_type: 'AA',
note_text: 'Test note content',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class FinesAccPayloadService {
public buildAddNotePayload(form: IFinesAccAddNoteForm): IOpalFinesAddNotePayload {
return {
activity_note: {
record_type: 'DEFENDANT_ACCOUNTS',
record_type: 'defendant_accounts',
record_id: this.finesAccStore.account_id()!,
note_text: form.formData.facc_add_notes!,
note_type: 'AA',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IOpalFinesAddNotePayload } from '../interfaces/opal-fines-add-note.inte
*/
export const OPAL_FINES_ADD_NOTE_PAYLOAD_MOCK: IOpalFinesAddNotePayload = {
activity_note: {
record_type: 'defendant_account',
record_type: 'defendant_accounts',
record_id: 12345,
note_type: 'General',
note_text: 'This is a test note for the defendant account.',
Expand Down
Loading
Loading