photoprism/frontend/tests/acceptance/originals.js

69 lines
2.7 KiB
JavaScript
Raw Normal View History

2021-01-15 17:02:39 +01:00
import { Selector } from "testcafe";
import testcafeconfig from "./testcafeconfig";
2020-06-03 08:42:56 +02:00
import Page from "./page-model";
2021-01-15 17:02:39 +01:00
fixture`Test files`.page`${testcafeconfig.url}`;
2020-06-03 08:42:56 +02:00
const page = new Page();
2021-01-15 17:02:39 +01:00
test.meta("testID", "originals-001")("Add original files to album", async (t) => {
await page.openNav();
await t.click(Selector(".nav-albums"));
2021-01-26 16:36:39 +01:00
await page.search("KanadaVacation");
2021-01-15 17:02:39 +01:00
await t.expect(Selector("h3").innerText).eql("Couldn't find anything");
await page.openNav();
2021-01-15 17:02:39 +01:00
await t
.click(Selector("div.nav-library + div"))
.click(Selector(".nav-originals"))
.click(Selector("button").withText("Vacation"));
const FirstItemInVacation = await Selector("div.result").nth(0).innerText;
const KanadaUid = await Selector("div.result").nth(0).getAttribute("data-uid");
const SecondItemInVacation = await Selector("div.result").nth(1).innerText;
await t
.expect(FirstItemInVacation)
.contains("Kanada")
.expect(SecondItemInVacation)
.contains("Korsika")
.click(Selector("button").withText("Kanada"));
2020-06-03 08:42:56 +02:00
2021-01-15 17:02:39 +01:00
const FirstItemInKanada = await Selector("div.result").nth(0).innerText;
const SecondItemInKanada = await Selector("div.result").nth(1).innerText;
await t
.expect(FirstItemInKanada)
.contains("BotanicalGarden")
.expect(SecondItemInKanada)
.contains("originals-001_2.jpg")
.click(Selector("button").withText("BotanicalGarden"))
.click(Selector('a[href="/library/files/Vacation"]'));
await page.selectPhotoFromUID(KanadaUid);
const clipboardCount = await Selector("span.count-clipboard", { timeout: 5000 });
await t.expect(clipboardCount.textContent).eql("1");
2021-01-27 10:14:18 +01:00
await page.addSelectedToAlbum("KanadaVacation", "album");
await page.openNav();
2021-01-15 17:02:39 +01:00
await t
.click(Selector(".nav-albums"));
2021-01-26 16:36:39 +01:00
await page.search("KanadaVacation");
2021-01-15 17:02:39 +01:00
const AlbumUid = await Selector("a.is-album").nth(0).getAttribute("data-uid");
await t.click(Selector("a.is-album").nth(0));
const PhotoCountAfterAdd = await Selector("div.is-photo", { timeout: 5000 }).count;
await t.expect(PhotoCountAfterAdd).eql(2);
await page.openNav();
await t.click(Selector(".nav-albums"));
2021-01-15 17:02:39 +01:00
await page.selectFromUID(AlbumUid);
await page.deleteSelected();
2020-06-03 13:06:06 +02:00
});
2021-01-15 17:02:39 +01:00
test.meta("testID", "originals-002")("Download original files", async (t) => {
await page.openNav();
await t.click(Selector("div.nav-library + div")).click(Selector(".nav-originals"));
const FirstFile = await Selector("div.is-file").nth(0).getAttribute("data-uid");
await page.selectPhotoFromUID(FirstFile);
const clipboardCount = await Selector("span.count-clipboard", { timeout: 5000 });
await t
.expect(clipboardCount.textContent)
.eql("1")
.click(Selector("button.action-menu"))
.expect(Selector("button.action-download").visible)
.ok();
});