File tree Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Expand file tree Collapse file tree 2 files changed +54
-1
lines changed Original file line number Diff line number Diff line change @@ -96,7 +96,6 @@ impl From<PoolError> for IronError {
96
96
97
97
#[ cfg( test) ]
98
98
mod tests {
99
- use super :: * ;
100
99
use crate :: test:: wrapper;
101
100
use kuchiki:: traits:: TendrilSink ;
102
101
Original file line number Diff line number Diff line change @@ -1213,4 +1213,58 @@ mod tests {
1213
1213
Ok ( ( ) )
1214
1214
} ) ;
1215
1215
}
1216
+
1217
+ #[ test]
1218
+ fn check_releases_page_content ( ) {
1219
+ // NOTE: this is a little fragile and may have to be updated if the HTML layout changes
1220
+ let sel = ".pure-menu-horizontal>.pure-menu-list>.pure-menu-item>.pure-menu-link>.title" ;
1221
+ wrapper ( |env| {
1222
+ let tester = |url| {
1223
+ let page = kuchiki:: parse_html ( )
1224
+ . one ( env. frontend ( ) . get ( url) . send ( ) . unwrap ( ) . text ( ) . unwrap ( ) ) ;
1225
+ assert_eq ! ( page. select( "#crate-title" ) . unwrap( ) . count( ) , 1 ) ;
1226
+ let not_matching = page
1227
+ . select ( sel)
1228
+ . unwrap ( )
1229
+ . map ( |node| node. text_contents ( ) )
1230
+ . zip (
1231
+ [
1232
+ "Recent" ,
1233
+ "Stars" ,
1234
+ "Recent Failures" ,
1235
+ "Failures By Stars" ,
1236
+ "Activity" ,
1237
+ "Queue" ,
1238
+ ]
1239
+ . iter ( ) ,
1240
+ )
1241
+ . filter ( |( a, b) | a. as_str ( ) != * * b)
1242
+ . collect :: < Vec < _ > > ( ) ;
1243
+ if not_matching. len ( ) > 0 {
1244
+ let not_found = not_matching. iter ( ) . map ( |( _, b) | b) . collect :: < Vec < _ > > ( ) ;
1245
+ let found = not_matching. iter ( ) . map ( |( a, _) | a) . collect :: < Vec < _ > > ( ) ;
1246
+ assert ! (
1247
+ not_matching. is_empty( ) ,
1248
+ "Titles did not match for URL `{}`: not found: {:?}, found: {:?}" ,
1249
+ url,
1250
+ not_found,
1251
+ found,
1252
+ ) ;
1253
+ }
1254
+ } ;
1255
+
1256
+ for url in & [
1257
+ "/releases" ,
1258
+ "/releases/stars" ,
1259
+ "/releases/recent-failures" ,
1260
+ "/releases/failures" ,
1261
+ "/releases/activity" ,
1262
+ "/releases/queue" ,
1263
+ ] {
1264
+ tester ( url) ;
1265
+ }
1266
+
1267
+ Ok ( ( ) )
1268
+ } ) ;
1269
+ }
1216
1270
}
You can’t perform that action at this time.
0 commit comments