photoprism/frontend/tests/acceptance/places.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-01-15 17:02:39 +01:00
import { Selector } from "testcafe";
import { ClientFunction } from "testcafe";
2020-05-31 19:32:02 +02:00
import testcafeconfig from "./testcafeconfig.json";
2022-04-15 15:46:25 +02:00
import Menu from "../page-model/menu";
2020-05-31 19:32:02 +02:00
const getLocation = ClientFunction(() => document.location.href);
2022-04-15 15:46:25 +02:00
fixture`Search and open photo from places`.page`${testcafeconfig.url}`.skip(
"Places don't loadin chrome from within the container"
);
const menu = new Menu();
2020-05-31 19:32:02 +02:00
2021-01-15 17:02:39 +01:00
test.meta("testID", "places-001")("Test places", async (t) => {
2022-04-15 15:46:25 +02:00
await menu.openPage("places");
2021-01-15 17:02:39 +01:00
await t
.expect(Selector("#map").exists, { timeout: 15000 })
.ok()
.expect(Selector("div.p-map-control").visible)
.ok();
2022-04-15 15:46:25 +02:00
2021-01-15 17:02:39 +01:00
await t.typeText(Selector('input[aria-label="Search"]'), "Berlin").pressKey("enter");
2022-04-15 15:46:25 +02:00
2021-01-15 17:02:39 +01:00
await t
.expect(Selector("div.p-map-control").visible)
.ok()
.expect(getLocation())
2022-04-15 15:46:25 +02:00
.contains("Berlin");
await menu.openPage("browse");
await t.expect(Selector("div.is-photo").exists).ok();
await menu.openPage("places");
await t
2021-09-20 20:09:41 +02:00
.expect(Selector("#map").exists, { timeout: 15000 })
.ok()
.expect(Selector("div.p-map-control").visible)
.ok();
2020-07-15 12:23:04 +02:00
2022-04-15 15:46:25 +02:00
await t
.typeText(Selector('input[aria-label="Search"]'), "canada", { replace: true })
.pressKey("enter")
.wait(8000);
await t.expect(Selector('div[title="Cape / Bowen Island / 2019"]').visible).ok();
await t.click(Selector('div[title="Cape / Bowen Island / 2019"]'));
await t.expect(Selector("#photo-viewer").visible).ok();
2021-01-15 17:02:39 +01:00
});