File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -2182,4 +2182,42 @@ mod tests {
21822182 Ok ( ( ) )
21832183 } )
21842184 }
2185+
2186+ #[ test]
2187+ fn recent_failures_correct_pagination_links ( ) {
2188+ async_wrapper ( |env| async move {
2189+ for i in 0 ..RELEASES_IN_RELEASES + 1 {
2190+ env. fake_release ( )
2191+ . await
2192+ . name ( "failed" )
2193+ . version ( & format ! ( "0.0.{}" , i) )
2194+ . build_result_failed ( )
2195+ . create ( )
2196+ . await ?;
2197+ }
2198+
2199+ let web = env. web_app ( ) . await ;
2200+
2201+ let response = web. get ( "/releases/recent-failures" ) . await ?;
2202+ assert ! ( response. status( ) . is_success( ) ) ;
2203+
2204+ let page = kuchikiki:: parse_html ( ) . one ( response. text ( ) . await ?) ;
2205+ assert_eq ! ( page. select( "div.description" ) . unwrap( ) . next( ) . unwrap( ) . text_contents( ) , "Recent crates failed to build" ) ;
2206+
2207+ let next_page_link = page. select ( "div.pagination > a" ) . unwrap ( ) . next ( ) . unwrap ( ) ;
2208+ assert_eq ! ( next_page_link. text_contents( ) . trim( ) , "Next Page" ) ;
2209+
2210+ let next_page_url = next_page_link. attributes . borrow ( ) . get ( "href" ) . unwrap ( ) . to_owned ( ) ;
2211+ assert_eq ! ( next_page_url, "/releases/recent-failures/2" ) ;
2212+
2213+ let response = web. get ( & next_page_url) . await ?;
2214+ assert ! ( response. status( ) . is_success( ) ) ;
2215+
2216+ let page = kuchikiki:: parse_html ( ) . one ( response. text ( ) . await ?) ;
2217+ assert_eq ! ( page. select( "div.description" ) . unwrap( ) . next( ) . unwrap( ) . text_contents( ) , "Recent crates failed to build" ) ;
2218+ assert_eq ! ( page. select( ".recent-releases-container > ul > li .name" ) . unwrap( ) . next( ) . unwrap( ) . text_contents( ) . trim( ) , "failed-0.0.0" ) ;
2219+
2220+ Ok ( ( ) )
2221+ } ) ;
2222+ }
21852223}
You can’t perform that action at this time.
0 commit comments