This is the template project that's checked out and configured when you run the bando-up command from ljsthw-bandolier. This is where the code really lives.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
bandolier-template/tests/ui/demos.js

85 lines
2.0 KiB

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) {
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();
}
});