import test from 'ava' ;
import { base _host } from "../../lib/config.js" ;
import { login , tid , expect , playstart , playstop } from '../../lib/testing.js' ;
export const panels = {
Accordion : ( ) => { } ,
AspectRatio : ( ) => { } ,
Badge : ( ) => { } ,
ButtonGroup : ( ) => { } ,
Calendar : ( ) => { } ,
Callout : ( ) => { } ,
Cards : ( ) => { } ,
Carousel : ( ) => { } ,
Chat : ( ) => { } ,
Code : ( ) => { } ,
Countdown : ( ) => { } ,
Darkmode : ( ) => { } ,
DataTable : ( ) => { } ,
Flipper : ( ) => { } ,
FairPay : ( ) => { } ,
Form : ( ) => { } ,
Icon : ( ) => { } ,
IconImage : ( ) => { } ,
LiveStream : ( ) => { } ,
LoggedIn : ( ) => { } ,
Login : ( ) => { } ,
Markdown : ( ) => { } ,
Modal : ( ) => { } ,
OGPreview : ( ) => { } ,
Pagination : ( ) => { } ,
PlaceHolder : ( ) => { } ,
Progress : ( ) => { } ,
Sidebar : ( ) => { } ,
SnapImage : ( ) => { } ,
Spinner : ( ) => { } ,
StackLayer : ( ) => { } ,
Switch : ( ) => { } ,
Tabs : ( ) => { } ,
Tiles : ( ) => { } ,
Toast : ( ) => { } ,
Tooltip : ( ) => { } ,
Video : ( ) => { } ,
WTVideo : ( ) => { } ,
}
test . before ( async t => t . context = await playstart ( ` ${ base _host } /client/#/login/ ` ) ) ;
test . after ( async t => {
await playstop ( t . context . browser , t . context . p ) ;
} ) ;
test ( 'can load each component' , async ( t ) => {
const { p } = t . context ;
// we can really only run these tests if this is set
if ( process . env . DANGER _ADMIN === "1" ) {
try {
const user = await login ( t , p ) ;
p . goto ( ` ${ base _host } /admin/#/bando/components/ ` ) ;
await expect ( t , p , tid ( "page-bando-demos" ) ) ;
for ( let [ panel , tester ] of Object . entries ( panels ) ) {
await p . click ( tid ( ` sidebar-link- ${ panel } ` ) ) ;
await expect ( t , p , tid ( ` demo- ${ panel } ` ) ) ;
await p . click ( tid ( ` tab-docs ` ) ) ;
await expect ( t , p , tid ( ` tab-docs ` ) ) ;
await p . click ( tid ( ` tab-code ` ) ) ;
await expect ( t , p , tid ( ` tab-code ` ) ) ;
await p . click ( tid ( ` tab-demo ` ) ) ;
await expect ( t , p , tid ( ` tab-demo ` ) ) ;
await tester ( t , p , user ) ;
}
} catch ( error ) {
console . log ( error ) ;
t . fail ( error . message ) ;
}
} else {
t . pass ( ) ;
}
} ) ;