@@ -18,6 +18,8 @@ export class RoutingChooseTemplatesPage extends TemplateMgmtBasePageDynamic {
1818
1919 public readonly saveAndCloseButton : Locator ;
2020
21+ public readonly conditionalLetterTemplates : Locator ;
22+
2123 constructor ( page : Page ) {
2224 super ( page ) ;
2325 this . errorSummary = page . locator ( '.nhsuk-error-summary' ) ;
@@ -29,29 +31,29 @@ export class RoutingChooseTemplatesPage extends TemplateMgmtBasePageDynamic {
2931 this . channelBlocks = page . locator ( '[data-testid^="message-plan-block-"]' ) ;
3032 this . moveToProductionButton = page . getByTestId ( 'move-to-production-cta' ) ;
3133 this . saveAndCloseButton = page . getByTestId ( 'save-and-close-cta' ) ;
34+ this . conditionalLetterTemplates = page . getByTestId (
35+ 'message-plan-conditional-templates'
36+ ) ;
3237 }
3338
34- public messagePlanChannel ( channel : string ) {
39+ public messagePlanItem ( identifier : string ) {
3540 return {
36- block : this . page . getByTestId ( `message-plan-block-${ channel } ` ) ,
37- number : this . page
38- . getByTestId ( `message-plan-block-${ channel } ` )
39- . locator ( '[class*=message-plan-block-number]' ) ,
41+ templateItem : this . page . getByTestId ( `channel-template-${ identifier } ` ) ,
4042 heading : this . page
41- . getByTestId ( `message-plan-block- ${ channel } ` )
43+ . getByTestId ( `channel-template- ${ identifier } ` )
4244 . getByRole ( 'heading' , { level : 3 } ) ,
43- templateName : this . page . getByTestId ( `template-name- ${ channel } ` ) ,
44- fallbackConditions : this . page . getByTestId (
45- `message-plan-fallback-conditions- ${ channel } `
46- ) ,
45+ templateName : this . page
46+ . getByTestId ( `template-name- ${ identifier } ` )
47+ . first ( ) ,
48+ templateNames : this . page . getByTestId ( `template-name- ${ identifier } ` ) ,
4749 changeTemplateLink : this . page . getByTestId (
48- `change-template-link-${ channel } `
50+ `change-template-link-${ identifier } `
4951 ) ,
5052 chooseTemplateLink : this . page . getByTestId (
51- `choose-template-link-${ channel } `
53+ `choose-template-link-${ identifier } `
5254 ) ,
5355 removeTemplateLink : this . page . getByTestId (
54- `remove-template-link-${ channel } `
56+ `remove-template-link-${ identifier } `
5557 ) ,
5658 async clickChooseTemplateLink ( ) {
5759 await this . chooseTemplateLink . click ( ) ;
@@ -65,6 +67,19 @@ export class RoutingChooseTemplatesPage extends TemplateMgmtBasePageDynamic {
6567 } ;
6668 }
6769
70+ public messagePlanChannel ( channel : string ) {
71+ return {
72+ ...this . messagePlanItem ( channel ) ,
73+ block : this . page . getByTestId ( `message-plan-block-${ channel } ` ) ,
74+ number : this . page
75+ . getByTestId ( `message-plan-block-${ channel } ` )
76+ . locator ( '[class*=message-plan-block-number]' ) ,
77+ fallbackConditions : this . page . getByTestId (
78+ `message-plan-fallback-conditions-${ channel } `
79+ ) ,
80+ } ;
81+ }
82+
6883 public readonly nhsApp = this . messagePlanChannel ( 'NHSAPP' ) ;
6984
7085 public readonly sms = this . messagePlanChannel ( 'SMS' ) ;
@@ -73,6 +88,23 @@ export class RoutingChooseTemplatesPage extends TemplateMgmtBasePageDynamic {
7388
7489 public readonly letter = this . messagePlanChannel ( 'LETTER' ) ;
7590
91+ public alternativeLetterFormats ( ) {
92+ const conditionalTemplates = this . page . getByTestId (
93+ 'message-plan-conditional-templates'
94+ ) ;
95+ return {
96+ conditionalTemplates,
97+ fallbackConditions : conditionalTemplates . getByTestId (
98+ 'message-plan-fallback-conditions-LETTER'
99+ ) ,
100+ listItems : conditionalTemplates . locator (
101+ '[class*=message-plan-conditional-templates__list-item]'
102+ ) ,
103+ largePrint : this . messagePlanItem ( 'x1' ) ,
104+ otherLanguages : this . messagePlanItem ( 'foreign-language' ) ,
105+ } ;
106+ }
107+
76108 async clickMoveToProduction ( ) {
77109 await this . moveToProductionButton . click ( ) ;
78110 }
0 commit comments