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";
|
2021-01-18 20:43:23 +01:00
|
|
|
import Page from "./page-model";
|
2020-05-31 19:32:02 +02:00
|
|
|
|
|
|
|
const getLocation = ClientFunction(() => document.location.href);
|
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
fixture`Test places page`.page`${testcafeconfig.url}`;
|
2021-01-18 20:43:23 +01:00
|
|
|
const page = new Page();
|
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) => {
|
2021-01-18 20:43:23 +01:00
|
|
|
await page.openNav();
|
2021-01-15 17:02:39 +01:00
|
|
|
await t
|
|
|
|
.click(Selector(".nav-places"))
|
|
|
|
.expect(Selector("#map").exists, { timeout: 15000 })
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("div.p-map-control").visible)
|
|
|
|
.ok();
|
|
|
|
await t.typeText(Selector('input[aria-label="Search"]'), "Berlin").pressKey("enter");
|
|
|
|
await t
|
|
|
|
.expect(Selector("div.p-map-control").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(getLocation())
|
2021-09-20 20:09:41 +02:00
|
|
|
.contains("Berlin")
|
|
|
|
.click(Selector(".nav-browse"))
|
|
|
|
.expect(Selector("div.is-photo").exists)
|
|
|
|
.ok()
|
|
|
|
.click(Selector(".nav-places"))
|
|
|
|
.expect(Selector("#map").exists, { timeout: 15000 })
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("div.p-map-control").visible)
|
|
|
|
.ok();
|
2020-07-21 13:57:16 +02:00
|
|
|
});
|
2020-07-15 12:23:04 +02:00
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "places-002")("Open photo from places", async (t) => {
|
|
|
|
//TODO replace wait
|
|
|
|
if (t.browser.name === "Firefox") {
|
|
|
|
console.log("Test skipped in firefox");
|
|
|
|
} else {
|
2021-01-18 20:43:23 +01:00
|
|
|
await page.openNav();
|
2021-01-15 17:02:39 +01:00
|
|
|
await t
|
|
|
|
.click(Selector(".nav-places"))
|
|
|
|
.expect(Selector("#is-photo-viewer").visible)
|
|
|
|
.notOk()
|
|
|
|
.expect(Selector("#map").exists, { timeout: 15000 })
|
|
|
|
.ok()
|
|
|
|
.typeText(Selector('input[aria-label="Search"]'), "Berlin")
|
|
|
|
.pressKey("enter")
|
|
|
|
.wait(30000)
|
|
|
|
.click(Selector("div.marker").nth(0), { timeout: 9000 })
|
2021-02-15 15:57:28 +01:00
|
|
|
.expect(Selector("#photo-viewer").visible)
|
2021-01-15 17:02:39 +01:00
|
|
|
.ok();
|
|
|
|
}
|
|
|
|
});
|