@@ -127,41 +127,61 @@ Then(
127127) ;
128128
129129// Advisories
130+ Then (
131+ "User navigates to the Related Advisories tab on the Vulnerability Overview page" ,
132+ async ( { page } ) => {
133+ await page . getByRole ( "tab" , { name : "Advisories" } ) . click ( ) ;
134+ }
135+ ) ;
130136
131- Then ( "User selects the Tabs {string}" , async ( { page } , tabName ) => {
132- await page . getByText ( tabName ) . click ( ) ;
137+ Then ( "Pagination of Advisories list works" , async ( { page } ) => {
138+ const toolbarTable = new ToolbarTable ( page , ADVISORY_TABLE_NAME ) ;
139+ const advisoryTableTopPagination = `xpath=//div[@id="advisory-table-pagination-top"]` ;
140+ await toolbarTable . verifyPagination ( advisoryTableTopPagination ) ;
133141} ) ;
134142
135143Then (
136- "The Advisory table is sorted by {string} " ,
137- async ( { page } , columnName ) => {
144+ "A list of all active Advisories tied to the Vulnerability should display " ,
145+ async ( { page } ) => {
138146 const toolbarTable = new ToolbarTable ( page , ADVISORY_TABLE_NAME ) ;
139- await toolbarTable . verifyTableIsSortedBy ( columnName ) ;
147+ await toolbarTable . verifyPaginationHasTotalResultsGreatherThan ( 0 ) ;
140148 }
141149) ;
142150
143151Then (
144- "The Advisory table total results is {int}" ,
145- async ( { page } , totalResults ) => {
146- const toolbarTable = new ToolbarTable ( page , ADVISORY_TABLE_NAME ) ;
147- await toolbarTable . verifyPaginationHasTotalResults ( totalResults ) ;
152+ "The {string} information should be visible for each advisory" ,
153+ async ( { page } , columnHeaders ) => {
154+ const headers = columnHeaders . split ( `,` ) . map ( ( column ) => column . trim ( ) ) ;
155+
156+ for ( const header of headers ) {
157+ console . log ( `Checking visibility of column header: ${ header } ` ) ;
158+ const headerElement = page . getByRole ( "columnheader" , { name : header } ) ;
159+ if ( await headerElement . count ( ) ) {
160+ await expect ( headerElement ) . toBeVisible ( ) ;
161+ } else {
162+ await expect ( page . getByRole ( "button" , { name : header } ) ) . toBeVisible ( ) ;
163+ }
164+ }
148165 }
149166) ;
150167
151168Then (
152- "The Advisory table total results is greather than {int }" ,
153- async ( { page } , totalResults ) => {
169+ "The advisories should be sorted by {string }" ,
170+ async ( { page } , columnName ) => {
154171 const toolbarTable = new ToolbarTable ( page , ADVISORY_TABLE_NAME ) ;
155- await toolbarTable . verifyPaginationHasTotalResultsGreatherThan (
156- totalResults
157- ) ;
172+ await toolbarTable . verifyTableIsSortedBy ( columnName ) ;
158173 }
159174) ;
160175
176+ Then ( "User searches for {string}" , async ( { page } , advisoryID ) => {
177+ const searchPage = new ToolbarTable ( page , ADVISORY_TABLE_NAME ) ;
178+ await searchPage . filterByText ( advisoryID ) ;
179+ } ) ;
180+
161181Then (
162- "The {string} column of the Advisory table contains {string}" ,
163- async ( { page } , columnName , expectedValue ) => {
164- const toolbarTable = new ToolbarTable ( page , ADVISORY_TABLE_NAME ) ;
165- await toolbarTable . verifyColumnContainsText ( columnName , expectedValue ) ;
182+ "User visits Advisory details Page of {string}" ,
183+ async ( { page } , advisoryID ) => {
184+ const link = page . getByRole ( "link" , { name : advisoryID } ) ;
185+ await link . click ( ) ;
166186 }
167187) ;
0 commit comments