photoprism/frontend/tests/acceptance/places.js

54 lines
1.4 KiB
JavaScript
Raw Normal View History

2021-01-15 16:02:39 +00:00
import { Selector } from "testcafe";
import { ClientFunction } from "testcafe";
2020-05-31 17:32:02 +00:00
import testcafeconfig from "./testcafeconfig.json";
2022-04-15 13:46:25 +00:00
import Menu from "../page-model/menu";
2020-05-31 17:32:02 +00:00
const getLocation = ClientFunction(() => document.location.href);
2022-04-15 13:46:25 +00: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 17:32:02 +00:00
2021-01-15 16:02:39 +00:00
test.meta("testID", "places-001")("Test places", async (t) => {
2022-04-15 13:46:25 +00:00
await menu.openPage("places");
2021-01-15 16:02:39 +00:00
await t
.expect(Selector("#map").exists, { timeout: 15000 })
.ok()
.expect(Selector("div.p-map-control").visible)
.ok();
2022-04-15 13:46:25 +00:00
2021-01-15 16:02:39 +00:00
await t.typeText(Selector('input[aria-label="Search"]'), "Berlin").pressKey("enter");
2022-04-15 13:46:25 +00:00
2021-01-15 16:02:39 +00:00
await t
.expect(Selector("div.p-map-control").visible)
.ok()
.expect(getLocation())
2022-04-15 13:46:25 +00: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 18:09:41 +00:00
.expect(Selector("#map").exists, { timeout: 15000 })
.ok()
.expect(Selector("div.p-map-control").visible)
.ok();
2020-07-15 10:23:04 +00:00
2022-04-15 13:46:25 +00: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 16:02:39 +00:00
});