photoprism/frontend/tests/acceptance/components.js

62 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-01-15 17:02:39 +01:00
import { Selector } from "testcafe";
import testcafeconfig from "./testcafeconfig";
2022-04-15 15:46:25 +02:00
import Toolbar from "../page-model/toolbar";
2021-01-15 17:02:39 +01:00
fixture`Test components`.page`${testcafeconfig.url}`;
2022-04-15 15:46:25 +02:00
const toolbar = new Toolbar();
2020-06-04 18:25:29 +02:00
2022-04-15 15:46:25 +02:00
test.meta("testID", "components-001").meta({ type: "smoke" })("Test filter options", async (t) => {
2021-09-17 13:25:30 +02:00
await t.expect(Selector("body").withText("object Object").exists).notOk();
2020-06-05 15:22:16 +02:00
});
2020-06-04 18:25:29 +02:00
2022-04-15 15:46:25 +02:00
test.meta("testID", "components-002").meta({ type: "smoke" })("Fullscreen mode", async (t) => {
2021-09-17 13:25:30 +02:00
await t.click(Selector("div.v-image__image").nth(0));
2022-04-15 15:46:25 +02:00
2021-09-17 13:25:30 +02:00
if (await Selector("#photo-viewer").visible) {
await t
.expect(Selector("#photo-viewer").visible)
.ok()
.expect(Selector("img.pswp__img").visible)
.ok();
} else {
await t.expect(Selector("div.video-viewer").visible).ok();
}
2020-06-04 18:25:29 +02:00
});
2022-04-15 15:46:25 +02:00
test.meta("testID", "components-003").meta({ type: "smoke" })("Mosaic view", async (t) => {
await toolbar.setFilter("view", "Mosaic");
2021-01-15 17:02:39 +01:00
await t
.expect(Selector("div.v-image__image").visible)
.ok()
.expect(Selector("div.p-photo-mosaic").visible)
.ok()
.expect(Selector("div.is-photo div.caption").exists)
.notOk()
2021-02-15 15:57:28 +01:00
.expect(Selector("#photo-viewer").visible)
2021-01-15 17:02:39 +01:00
.notOk();
2020-06-04 18:25:29 +02:00
});
2021-01-15 17:02:39 +01:00
test.meta("testID", "components-004")("List view", async (t) => {
2022-04-15 15:46:25 +02:00
await toolbar.setFilter("view", "List");
2021-01-15 17:02:39 +01:00
await t
.expect(Selector("table.v-datatable").visible)
.ok()
.expect(Selector("div.list-view").visible)
.ok();
2020-06-04 18:25:29 +02:00
});
2022-04-15 15:46:25 +02:00
test.meta("testID", "components-005").meta({ type: "smoke" })("Card view", async (t) => {
await toolbar.setFilter("view", "Cards");
2021-01-15 17:02:39 +01:00
await t
.expect(Selector("div.v-image__image").visible)
.ok()
.expect(Selector("div.is-photo div.caption").visible)
.ok()
2021-02-15 15:57:28 +01:00
.expect(Selector("#photo-viewer").visible)
2021-01-15 17:02:39 +01:00
.notOk();
});