File tree Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Expand file tree Collapse file tree 1 file changed +65
-0
lines changed Original file line number Diff line number Diff line change @@ -2182,4 +2182,69 @@ 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 ! (
2206+ page. select( "div.description" )
2207+ . unwrap( )
2208+ . next( )
2209+ . unwrap( )
2210+ . text_contents( ) ,
2211+ "Recent crates failed to build"
2212+ ) ;
2213+
2214+ let next_page_link = page. select ( "div.pagination > a" ) . unwrap ( ) . next ( ) . unwrap ( ) ;
2215+ assert_eq ! ( next_page_link. text_contents( ) . trim( ) , "Next Page" ) ;
2216+
2217+ let next_page_url = next_page_link
2218+ . attributes
2219+ . borrow ( )
2220+ . get ( "href" )
2221+ . unwrap ( )
2222+ . to_owned ( ) ;
2223+ assert_eq ! ( next_page_url, "/releases/recent-failures/2" ) ;
2224+
2225+ let response = web. get ( & next_page_url) . await ?;
2226+ assert ! ( response. status( ) . is_success( ) ) ;
2227+
2228+ let page = kuchikiki:: parse_html ( ) . one ( response. text ( ) . await ?) ;
2229+ assert_eq ! (
2230+ page. select( "div.description" )
2231+ . unwrap( )
2232+ . next( )
2233+ . unwrap( )
2234+ . text_contents( ) ,
2235+ "Recent crates failed to build"
2236+ ) ;
2237+ assert_eq ! (
2238+ page. select( ".recent-releases-container > ul > li .name" )
2239+ . unwrap( )
2240+ . next( )
2241+ . unwrap( )
2242+ . text_contents( )
2243+ . trim( ) ,
2244+ "failed-0.0.0"
2245+ ) ;
2246+
2247+ Ok ( ( ) )
2248+ } ) ;
2249+ }
21852250}
You can’t perform that action at this time.
0 commit comments