package Ġuk . gov . just ice . digital . h mp ps . pec s . j pc . integration . pages Ċ Ċ import Ġcom . g argo yle software . html unit . Page Ċ import Ġcom . g argo yle software . html unit . Web Response Ċ import Ġorg . assertj . core . api . Assertions . assertThat Ċ import Ġorg . fluent lenium . core . Fluent Page Ċ import Ġorg . openqa . selenium . By Ċ import Ġuk . gov . just ice . digital . h mp ps . pec s . j pc . integration . Custom Html Unit Driver Ċ Ċ /** Ċ Ġ* ĠSuper Ġclass Ġfor Ġall Ġapplication Ġpages Ġunder Ġtest . Ċ Ġ*/ Ċ abstract Ġclass ĠApplication Page Ġ: ĠFluent Page () Ġ{ ĊĊĠ Ġ/** ĊĠĠ Ġ* ĠHelper Ġmethod Ġto Ġassist Ġwith Ġattachment Ġdownloads . ĊĠĠ Ġ*/ ĊĠ Ġfun Ġclick On Link Text ( anchor Text : ĠString ): ĠWeb Response Ġ{ ĊĠĠĠ Ġcustom Driver (). page ( url ). get Anchor By Text ( anchor Text ). click < Page >() ĊĊĠĠĠ Ġreturn Ġcustom Driver (). first Attachment Response () ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġcustom Driver () Ġ= Ġsuper . get Driver () Ġas ĠCustom Html Unit Driver ĊĊĠ Ġfun Ġassert Banner Is Present ( title : ĠString , Ġbody : ĠString ) Ġ{ ĊĠĠĠ Ġassert Text Is Present ( title ) ĊĠĠĠ Ġassert Text Is Present ( body ) ĊĠ Ġ} ĊĊĠ Ġprivate Ġfun Ġassert Text Is Present ( text : ĠString ) Ġ{ ĊĠĠĠ Ġfind ( By . xpath ("// p [ normalize - space ( text ()) ='$ text '] ")). first OrNull (). let Ġ{ ĠassertThat ( it ). isNotNull Ġ} ĊĠ Ġ} ĊĊĠ Ġinternal Ġinline Ġfun Ġ< re ified ĠT Ġ: ĠApplication Page > Ġassert Text IsNot Present ( text : ĠString ): ĠT Ġ{ ĊĠĠĠ ĠassertThat ( super . page Source ()). does Not Contain Ign oring Case ( text ) ĊĊĠĠĠ Ġreturn Ġthis Ġas ĠT ĊĠ Ġ} ĊĊĠ Ġinline Ġfun Ġ< re ified ĠT Ġ: ĠApplication Page > Ġis Row Present ( value : ĠAny , Ġvar arg Ġvalues : ĠAny ): ĠT Ġ{ ĊĠĠĠ Ġval Ġquery Ġ= Ġvalues . join ToString (" Ġ") Ġ{ Ġ" and Ġcontains ( ., Ġ'$ it ')" Ġ} ĊĊĠĠĠ Ġval Ġrow Ġ= Ġthis . find ( By . xpath ("// tr [ contains (. ,' $ value ') Ġ$ query ] ")). first OrNull () ĊĊĠĠĠ ĠassertThat ( row ). isNotNull ĊĊĠĠĠ Ġreturn Ġthis Ġas ĠT ĊĠ Ġ} ĊĊĠ Ġinline Ġfun Ġ< re ified ĠT Ġ: ĠApplication Page > Ġis Row Present AtIndex ( table Id : ĠString , Ġvalue : ĠAny , Ġvar arg Ġvalues : ĠAny , Ġindex : ĠInt ): ĠT Ġ{ ĊĠĠĠ Ġval Ġquery Ġ= Ġvalues . join ToString (" Ġ") Ġ{ Ġ" and Ġcontains ( ., Ġ'$ it ')" Ġ} ĊĊĠĠĠ Ġval Ġrow Ġ= Ġthis . find ( By . xpath ("// table [@ id Ġ= Ġ'$ table Id '] // tr [$ index ][ contains (. ,' $ value ') Ġ$ query ] ")). first OrNull () ĊĊĠĠĠ ĠassertThat ( row ). isNotNull ĊĊĠĠĠ Ġreturn Ġthis Ġas ĠT ĊĠ Ġ} Ċ } Ċ