@@ -8,6 +8,7 @@ export class ExceptionOverviewPage extends BasePage {
88 readonly exceptionIDLink : Locator ;
99 readonly sortByDateExceptionCreated : Locator ;
1010 readonly applyButton : Locator ;
11+ readonly sortByexceptionstatus
1112
1213 constructor ( page : Page ) {
1314 super ( page )
@@ -19,6 +20,7 @@ export class ExceptionOverviewPage extends BasePage {
1920 //this.exceptionIDLink = page.locator('[data-testid="exceptions-table"] tbody tr:nth-child(2) td:nth-child(1) a');
2021 this . sortByDateExceptionCreated = page . locator ( '[data-testid="sort-not-raised-exceptions"]' ) ;
2122 this . applyButton = page . locator ( '[data-testid="apply-button"]' ) ;
23+ this . sortByexceptionstatus = page . locator ( '[data-testid="sort-raised-exceptions"]' ) ;
2224 }
2325 async getTableHeaders ( ) : Promise < string [ ] > {
2426 return this . page . $$eval ( '[data-testid="exceptions-table"] th' , headers =>
@@ -46,15 +48,29 @@ export class ExceptionOverviewPage extends BasePage {
4648 async clickOnexceptionID ( ) {
4749 await this . clickElement ( this . exceptionIDLink )
4850 }
49- async sortByDateExceptionCreatedDescending ( optionText : string ) {
51+ async sortOptionSelect ( optionText : string ) {
5052 // Adjust selector to match your sortable column header
51- await this . sortByDateExceptionCreated . selectOption ( { label : optionText } ) ;
53+ if ( optionText . toLowerCase ( ) . includes ( 'date exception created' ) ) {
54+ // Use the locator for "Date exception created"
55+ await this . sortByDateExceptionCreated . selectOption ( { label : optionText } ) ;
56+ } else {
57+ // Use the locator for another column (replace with your actual locator)
58+ await this . sortByexceptionstatus . selectOption ( { label : optionText } ) ;
59+ }
5260 await this . applyButton . click ( ) ;
5361 }
5462 async getDateExceptionCreatedColumn ( ) : Promise < Date [ ] > {
5563 // Adjust selector to match the correct column index for "Date exception created"
5664 const dateCells = await this . page . locator ( '[data-testid="exceptions-table"] tbody tr td:nth-child(3)' ) . allTextContents ( ) ;
5765 return dateCells . map ( text => new Date ( text . trim ( ) ) ) ;
5866 }
67+ async getStatusUpdateDates ( ) : Promise < Date [ ] > {
68+ const texts = await this . page . locator ( '[data-testid="exceptions-table"] tbody tr td:nth-child(5)' ) . allTextContents ( ) ;
69+ // Extract date from "Raised on 16 June 2025"
70+ return texts . map ( text => {
71+ const match = text . match ( / o n ( .+ ) $ / ) ; // match "on <date>"
72+ return match ? new Date ( match [ 1 ] ) : new Date ( 0 ) ; // fallback to epoch if no match
73+ } ) ;
74+ }
5975
6076}
0 commit comments