Tests: Refactor acceptance tests
This commit is contained in:
parent
0654acdb78
commit
df9d8c7bd2
10 changed files with 1311 additions and 0 deletions
162
frontend/tests/acceptance-new/albums.js
Normal file
162
frontend/tests/acceptance-new/albums.js
Normal file
|
@ -0,0 +1,162 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
|
||||
fixture`Test albums`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
|
||||
test.meta("testID", "authentication-000")(
|
||||
"Time to start instance (will be marked as unstable)",
|
||||
async (t) => {
|
||||
await t.wait(5000);
|
||||
}
|
||||
);
|
||||
|
||||
test.meta("testID", "albums-001")("Create/delete album on /albums", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await toolbar.triggerToolbarAction("add", "");
|
||||
const countAlbumsAfterCreate = await album.getAlbumCount("all");
|
||||
const NewAlbum = await album.getNthAlbumUid("all", 0);
|
||||
await t.expect(countAlbumsAfterCreate).eql(countAlbums + 1);
|
||||
await album.selectAlbumFromUID(NewAlbum);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbumsAfterCreate - 1);
|
||||
});
|
||||
|
||||
test.meta("testID", "albums-002")("Update album", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Holiday");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Holiday")
|
||||
.click(newpage.cardTitle.nth(0))
|
||||
.typeText(Selector(".input-title input"), "Animals", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-description textarea"), "All my animals")
|
||||
.typeText(Selector(".input-category input"), "Pets")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await album.openNthAlbum(0);
|
||||
const PhotoCount = await photo.getPhotoCount("all");
|
||||
await t.expect(toolbar.toolbarTitle.innerText).contains("Animals");
|
||||
await t.expect(toolbar.toolbarDescription.innerText).contains("All my animals");
|
||||
await menu.openPage("browse");
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhotoUid = await photo.getNthPhotoUid("image", 1);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photoviewer.openPhotoViewer("uid", FirstPhotoUid);
|
||||
await photoviewer.triggerPhotoViewerAction("select");
|
||||
await photoviewer.triggerPhotoViewerAction("close");
|
||||
await contextmenu.triggerContextMenuAction("album", "Animals", "album");
|
||||
await menu.openPage("albums");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await toolbar.search("category:Family");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Family");
|
||||
}
|
||||
await t.expect(newpage.cardTitle.nth(0).innerText).contains("Christmas");
|
||||
await menu.openPage("albums");
|
||||
await toolbar.triggerToolbarAction("reload", "");
|
||||
if (t.browser.platform === "mobile") {
|
||||
} else {
|
||||
await toolbar.setFilter("category", "All Categories");
|
||||
}
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 2);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("remove", "", "");
|
||||
const PhotoCountAfterDelete = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 2);
|
||||
await toolbar.triggerToolbarAction("edit", "");
|
||||
await t
|
||||
.typeText(Selector(".input-title input"), "Holiday", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("All my animals")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("Pets")
|
||||
.click(Selector(".input-description textarea"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-category input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await menu.openPage("albums");
|
||||
await t
|
||||
.expect(Selector("div").withText("Holiday").visible)
|
||||
.ok()
|
||||
.expect(Selector("div").withText("Animals").exists)
|
||||
.notOk();
|
||||
});
|
||||
|
||||
//TODO test that sharing link works as expected --> move to sharing.js
|
||||
test.meta("testID", "albums-006")("Create, Edit, delete sharing link", async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("albums");
|
||||
});
|
||||
|
||||
test.meta("testID", "albums-007")("Create/delete album during add to album", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("browse");
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhotoUid = await photo.getNthPhotoUid("image", 1);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("album", "NotYetExistingAlbum", "album");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
await toolbar.search("NotYetExistingAlbum");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
});
|
||||
|
||||
test.meta("testID", "albums-008")("Test album autocomplete", async (t) => {
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await contextmenu.openContextMenu();
|
||||
await t
|
||||
.click(Selector("button.action-album"))
|
||||
.click(Selector(".input-album input"))
|
||||
.expect(newpage.selectOption.withText("Holiday").visible)
|
||||
.ok()
|
||||
.expect(newpage.selectOption.withText("Christmas").visible)
|
||||
.ok()
|
||||
.typeText(Selector(".input-album input"), "C", { replace: true })
|
||||
.expect(newpage.selectOption.withText("Holiday").visible)
|
||||
.notOk()
|
||||
.expect(newpage.selectOption.withText("Christmas").visible)
|
||||
.ok()
|
||||
.expect(newpage.selectOption.withText("C").visible)
|
||||
.ok();
|
||||
});
|
138
frontend/tests/acceptance-new/calendar.js
Normal file
138
frontend/tests/acceptance-new/calendar.js
Normal file
|
@ -0,0 +1,138 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import { RequestLogger } from "testcafe";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
|
||||
const logger = RequestLogger(/http:\/\/localhost:2343\/api\/v1\/*/, {
|
||||
logResponseHeaders: true,
|
||||
logResponseBody: true,
|
||||
});
|
||||
|
||||
fixture`Test calendar`.page`${testcafeconfig.url}`.requestHooks(logger);
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
|
||||
test.meta("testID", "albums-005")("View calendar", async (t) => {
|
||||
await menu.openPage("calendar");
|
||||
await t
|
||||
.expect(Selector("a").withText("May 2019").visible)
|
||||
.ok()
|
||||
.expect(Selector("a").withText("October 2019").visible)
|
||||
.ok();
|
||||
});
|
||||
|
||||
test.meta("testID", "calendar-001")("Update calendar", async (t) => {
|
||||
await menu.openPage("calendar");
|
||||
await toolbar.search("March 2014");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("March 2014")
|
||||
.click(newpage.cardTitle.nth(0))
|
||||
.typeText(Selector(".input-location input"), "Snow", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-description textarea"), "We went to ski")
|
||||
.typeText(Selector(".input-category input"), "Mountains")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm")
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("March 2014")
|
||||
.expect(newpage.cardDescription.nth(0).innerText)
|
||||
.contains("We went to ski")
|
||||
.expect(Selector("div.caption").nth(1).innerText)
|
||||
.contains("Mountains")
|
||||
.expect(Selector("div.caption").nth(2).innerText)
|
||||
.contains("Snow");
|
||||
await album.openNthAlbum(0);
|
||||
await t.expect(toolbar.toolbarTitle.innerText).contains("March 2014");
|
||||
await t.expect(toolbar.toolbarDescription.innerText).contains("We went to ski");
|
||||
await menu.openPage("calendar");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await toolbar.search("category:Mountains");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Mountains");
|
||||
}
|
||||
await t.expect(newpage.cardTitle.nth(0).innerText).contains("March 2014");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
await toolbar.triggerToolbarAction("edit", "");
|
||||
await t
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("We went to ski")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("Mountains")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("Snow")
|
||||
.click(Selector(".input-category input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-description textarea"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-location input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await menu.openPage("calendar");
|
||||
await toolbar.search("March 2014");
|
||||
await t
|
||||
.expect(newpage.cardDescription.innerText)
|
||||
.notContains("We went to ski")
|
||||
.expect(Selector("div.caption").nth(0).innerText)
|
||||
.notContains("Snow");
|
||||
});
|
||||
|
||||
//TODO test that sharing link works as expected
|
||||
test.meta("testID", "calendar-003")("Create, Edit, delete sharing link", async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("calendar");
|
||||
});
|
||||
|
||||
test.meta("testID", "calendar-004")("Create/delete album-clone from calendar", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("calendar");
|
||||
const SecondCalendar = await album.getNthAlbumUid("all", 1);
|
||||
await album.openAlbumWithUid(SecondCalendar);
|
||||
const PhotoCountInCalendar = await photo.getPhotoCount("all");
|
||||
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhoto = await photo.getNthPhotoUid("image", 1);
|
||||
await menu.openPage("calendar");
|
||||
await album.selectAlbumFromUID(SecondCalendar);
|
||||
await contextmenu.triggerContextMenuAction("clone", "NotYetExistingAlbumForCalendar", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
await toolbar.search("NotYetExistingAlbumForCalendar");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountInAlbum = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountInAlbum).eql(PhotoCountInCalendar);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await photo.checkPhotoVisibility(SecondPhoto, true);
|
||||
await menu.openPage("albums");
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
await menu.openPage("calendar");
|
||||
await album.openAlbumWithUid(SecondCalendar);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await photo.checkPhotoVisibility(SecondPhoto, true);
|
||||
});
|
61
frontend/tests/acceptance-new/components.js
Normal file
61
frontend/tests/acceptance-new/components.js
Normal file
|
@ -0,0 +1,61 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
|
||||
fixture`Test components`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const toolbar = new Toolbar();
|
||||
const photoviewer = new PhotoViewer();
|
||||
|
||||
test.meta("testID", "components-001")("Test filter options", async (t) => {
|
||||
await t.expect(Selector("body").withText("object Object").exists).notOk();
|
||||
});
|
||||
|
||||
test.meta("testID", "components-002")("Fullscreen mode", async (t) => {
|
||||
await t.click(Selector("div.v-image__image").nth(0));
|
||||
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();
|
||||
}
|
||||
});
|
||||
|
||||
test.meta("testID", "components-003")("Mosaic view", async (t) => {
|
||||
await toolbar.setFilter("view", "Mosaic");
|
||||
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()
|
||||
.expect(Selector("#photo-viewer").visible)
|
||||
.notOk();
|
||||
});
|
||||
|
||||
test.meta("testID", "components-004")("List view", async (t) => {
|
||||
await toolbar.setFilter("view", "List");
|
||||
await t
|
||||
.expect(Selector("table.v-datatable").visible)
|
||||
.ok()
|
||||
.expect(Selector("div.list-view").visible)
|
||||
.ok();
|
||||
});
|
||||
|
||||
test.meta("testID", "components-005")("#Card view", async (t) => {
|
||||
await toolbar.setFilter("view", "Cards");
|
||||
await t
|
||||
.expect(Selector("div.v-image__image").visible)
|
||||
.ok()
|
||||
.expect(Selector("div.is-photo div.caption").visible)
|
||||
.ok()
|
||||
.expect(Selector("#photo-viewer").visible)
|
||||
.notOk();
|
||||
});
|
144
frontend/tests/acceptance-new/folders.js
Normal file
144
frontend/tests/acceptance-new/folders.js
Normal file
|
@ -0,0 +1,144 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
|
||||
fixture`Test folders`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
|
||||
test.meta("testID", "albums-004")("View folders", async (t) => {
|
||||
await menu.openPage("folders");
|
||||
await t
|
||||
.expect(Selector("a").withText("BotanicalGarden").visible)
|
||||
.ok()
|
||||
.expect(Selector("a").withText("Kanada").visible)
|
||||
.ok()
|
||||
.expect(Selector("a").withText("KorsikaAdventure").visible)
|
||||
.ok();
|
||||
});
|
||||
|
||||
test.meta("testID", "folders-001")("Update folders", async (t) => {
|
||||
await menu.openPage("folders");
|
||||
await toolbar.search("Kanada");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Kanada")
|
||||
.click(newpage.cardTitle.nth(0))
|
||||
.expect(Selector(".input-title input").value)
|
||||
.eql("Kanada")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-title input"), "MyFolder", { replace: true })
|
||||
.typeText(Selector(".input-location input"), "USA", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-description textarea"), "Last holiday")
|
||||
.typeText(Selector(".input-category input"), "Mountains")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm")
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("MyFolder")
|
||||
.expect(newpage.cardDescription.nth(0).innerText)
|
||||
.contains("Last holiday")
|
||||
.expect(Selector("div.caption").nth(1).innerText)
|
||||
.contains("Mountains")
|
||||
.expect(Selector("div.caption").nth(2).innerText)
|
||||
.contains("USA");
|
||||
await album.openNthAlbum(0);
|
||||
await t
|
||||
.expect(toolbar.toolbarDescription.nth(0).innerText)
|
||||
.contains("Last holiday")
|
||||
.expect(toolbar.toolbarTitle.nth(0).innerText)
|
||||
.contains("MyFolder");
|
||||
//.expect(Selector("div").withText("MyFolder").exists)
|
||||
//.ok();
|
||||
await menu.openPage("folders");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await toolbar.search("category:Mountains");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Mountains");
|
||||
}
|
||||
await t.expect(newpage.cardTitle.nth(0).innerText).contains("MyFolder");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
await toolbar.triggerToolbarAction("edit", "");
|
||||
await t
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("Last holiday")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("Mountains")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("USA")
|
||||
.typeText(Selector(".input-title input"), "Kanada", { replace: true })
|
||||
.click(Selector(".input-category input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-description textarea"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-location input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await menu.openPage("folders");
|
||||
await toolbar.search("Kanada");
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Kanada")
|
||||
.expect(newpage.cardDescription.nth(0).innerText)
|
||||
.notContains("We went to ski")
|
||||
.expect(Selector("div.caption").nth(0).innerText)
|
||||
.notContains("USA");
|
||||
});
|
||||
|
||||
//TODO test that sharing link works as expected
|
||||
test.meta("testID", "folders-003")("Create, Edit, delete sharing link", async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("folders");
|
||||
});
|
||||
|
||||
test.meta("testID", "folders-004")("Create/delete album-clone from folder", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("folders");
|
||||
const ThirdFolder = await album.getNthAlbumUid("all", 2);
|
||||
await album.openAlbumWithUid(ThirdFolder);
|
||||
const PhotoCountInFolder = await photo.getPhotoCount("all");
|
||||
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
|
||||
await menu.openPage("folders");
|
||||
await album.selectAlbumFromUID(ThirdFolder);
|
||||
await contextmenu.triggerContextMenuAction("clone", "NotYetExistingAlbumForFolder", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
await toolbar.search("NotYetExistingAlbumForFolder");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountInAlbum = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountInAlbum).eql(PhotoCountInFolder);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await menu.openPage("albums");
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
await menu.openPage("folders");
|
||||
await album.openAlbumWithUid(ThirdFolder);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
});
|
217
frontend/tests/acceptance-new/labels.js
Normal file
217
frontend/tests/acceptance-new/labels.js
Normal file
|
@ -0,0 +1,217 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
import Label from "../page-model/label";
|
||||
import PhotoViews from "../page-model/photo-views";
|
||||
|
||||
fixture`Test labels`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
const label = new Label();
|
||||
const photoviews = new PhotoViews();
|
||||
|
||||
test.meta("testID", "labels-001")("Remove/Activate Add/Delete Label from photo", async (t) => {
|
||||
await menu.openPage("labels");
|
||||
const countImportantLabels = await label.getLabelCount();
|
||||
await toolbar.triggerToolbarAction("show-all", "");
|
||||
const countAllLabels = await label.getLabelCount();
|
||||
await t.expect(countAllLabels).gt(countImportantLabels);
|
||||
await toolbar.triggerToolbarAction("show-important", "");
|
||||
await toolbar.search("beacon");
|
||||
const LabelBeacon = await label.getNthLabeltUid(0);
|
||||
await label.openLabelWithUid(LabelBeacon);
|
||||
await toolbar.setFilter("view", "Cards");
|
||||
const PhotoBeacon = await photo.getNthPhotoUid("all", 0);
|
||||
await t.click(newpage.cardTitle.withAttribute("data-uid", PhotoBeacon));
|
||||
const PhotoKeywords = await Selector(".input-keywords textarea").value;
|
||||
await t
|
||||
.expect(PhotoKeywords)
|
||||
.contains("beacon")
|
||||
.click(Selector("#tab-labels"))
|
||||
.click(Selector("button.action-remove"), { timeout: 5000 })
|
||||
.typeText(Selector(".input-label input"), "Test")
|
||||
.click(Selector("button.p-photo-label-add"))
|
||||
.click(Selector("#tab-details"));
|
||||
const PhotoKeywordsAfterEdit = await Selector(".input-keywords textarea").value;
|
||||
await t
|
||||
.expect(PhotoKeywordsAfterEdit)
|
||||
.contains("test")
|
||||
.expect(PhotoKeywordsAfterEdit)
|
||||
.notContains("beacon")
|
||||
.click(Selector(".action-close"));
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("beacon");
|
||||
await t.expect(Selector("div.no-results").visible).ok();
|
||||
await toolbar.search("test");
|
||||
const LabelTest = await label.getNthLabeltUid(0);
|
||||
await label.openLabelWithUid(LabelTest);
|
||||
await t
|
||||
.click(newpage.cardTitle.withAttribute("data-uid", PhotoBeacon))
|
||||
.click(Selector("#tab-labels"))
|
||||
.click(Selector(".action-delete"), { timeout: 5000 })
|
||||
.click(Selector(".action-on"))
|
||||
.click(Selector("#tab-details"));
|
||||
const PhotoKeywordsAfterUndo = await Selector(".input-keywords textarea").value;
|
||||
await t
|
||||
.expect(PhotoKeywordsAfterUndo)
|
||||
.contains("beacon")
|
||||
.expect(PhotoKeywordsAfterUndo)
|
||||
.notContains("test")
|
||||
.click(Selector(".action-close"));
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("test");
|
||||
await t.expect(Selector("div.no-results").visible).ok();
|
||||
await toolbar.search("beacon");
|
||||
await album.checkAlbumVisibility(LabelBeacon, true);
|
||||
});
|
||||
|
||||
test.meta("testID", "labels-002")("Rename Label", async (t) => {
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("zebra");
|
||||
const LabelZebra = await label.getNthLabeltUid(0);
|
||||
await label.openNthLabel(0);
|
||||
const FirstPhotoZebra = await photo.getNthPhotoUid("all", 0);
|
||||
const SecondPhotoZebra = await photo.getNthPhotoUid("all", 1);
|
||||
await toolbar.setFilter("view", "Cards");
|
||||
await t.click(newpage.cardTitle.withAttribute("data-uid", FirstPhotoZebra));
|
||||
const FirstPhotoTitle = await Selector(".input-title input", { timeout: 5000 }).value;
|
||||
const FirstPhotoKeywords = await Selector(".input-keywords textarea", { timeout: 5000 }).value;
|
||||
await t
|
||||
.expect(FirstPhotoTitle)
|
||||
.contains("Zebra")
|
||||
.expect(FirstPhotoKeywords)
|
||||
.contains("zebra")
|
||||
.click(Selector("#tab-labels"))
|
||||
.click(Selector("div.p-inline-edit"))
|
||||
.typeText(Selector(".input-rename input"), "Horse", { replace: true })
|
||||
.pressKey("enter")
|
||||
.click(Selector("#tab-details"));
|
||||
const FirstPhotoTitleAfterEdit = await Selector(".input-title input", { timeout: 5000 }).value;
|
||||
const FirstPhotoKeywordsAfterEdit = await Selector(".input-keywords textarea", { timeout: 5000 })
|
||||
.value;
|
||||
await t
|
||||
.expect(FirstPhotoTitleAfterEdit)
|
||||
.contains("Horse")
|
||||
.expect(FirstPhotoKeywordsAfterEdit)
|
||||
.contains("horse")
|
||||
.expect(FirstPhotoTitleAfterEdit)
|
||||
.notContains("Zebra")
|
||||
.click(Selector(".action-close"));
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("horse");
|
||||
await album.checkAlbumVisibility(LabelZebra, true);
|
||||
await label.openLabelWithUid(LabelZebra);
|
||||
await photo.checkPhotoVisibility(FirstPhotoZebra, true);
|
||||
await t
|
||||
.click(newpage.cardTitle.withAttribute("data-uid", FirstPhotoZebra))
|
||||
.click(Selector("#tab-labels"))
|
||||
.click(Selector("div.p-inline-edit"))
|
||||
.typeText(Selector(".input-rename input"), "Zebra", { replace: true })
|
||||
.pressKey("enter")
|
||||
.click(Selector(".action-close"));
|
||||
await menu.openPage("labels");
|
||||
await page.search("horse");
|
||||
await t.expect(Selector("div.no-results").visible).ok();
|
||||
});
|
||||
|
||||
test.meta("testID", "labels-003")("Add label to album", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Christmas");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCount = await photo.getPhotoCount("all");
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("landscape");
|
||||
const LabelLandscape = await label.getNthLabeltUid(1);
|
||||
await label.openLabelWithUid(LabelLandscape);
|
||||
const FirstPhotoLandscape = await photo.getNthPhotoUid("all", 0);
|
||||
const SecondPhotoLandscape = await photo.getNthPhotoUid("all", 1);
|
||||
const ThirdPhotoLandscape = await photo.getNthPhotoUid("all", 2);
|
||||
const FourthPhotoLandscape = await photo.getNthPhotoUid("all", 3);
|
||||
const FifthPhotoLandscape = await photo.getNthPhotoUid("all", 4);
|
||||
const SixthPhotoLandscape = await photo.getNthPhotoUid("all", 5);
|
||||
await menu.openPage("labels");
|
||||
await label.triggerHoverAction("uid", LabelLandscape, "select");
|
||||
|
||||
//await page.selectFromUID(LabelLandscape);
|
||||
|
||||
//const clipboardCount = await Selector("span.count-clipboard");
|
||||
//await t.expect(clipboardCount.textContent).eql("1");
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
//await page.addSelectedToAlbum("Christmas", "album");
|
||||
await contextmenu.triggerContextMenuAction("album", "Christmas", "");
|
||||
await menu.openPage("albums");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 6);
|
||||
await photoviews.triggerHoverAction("uid", FirstPhotoLandscape, "select");
|
||||
await photoviews.triggerHoverAction("uid", SecondPhotoLandscape, "select");
|
||||
await photoviews.triggerHoverAction("uid", ThirdPhotoLandscape, "select");
|
||||
await photoviews.triggerHoverAction("uid", FourthPhotoLandscape, "select");
|
||||
await photoviews.triggerHoverAction("uid", FifthPhotoLandscape, "select");
|
||||
await photoviews.triggerHoverAction("uid", SixthPhotoLandscape, "select");
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountAfterDelete = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 6);
|
||||
});
|
||||
|
||||
test.meta("testID", "labels-004")("Delete label", async (t) => {
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("dome");
|
||||
const LabelDome = await label.getNthLabeltUid(0);
|
||||
await label.openLabelWithUid(LabelDome);
|
||||
const FirstPhotoDome = await photo.getNthPhotoUid("all", 0);
|
||||
await menu.openPage("labels");
|
||||
await label.triggerHoverAction("uid", LabelDome, "select");
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await toolbar.search("dome");
|
||||
await t.expect(Selector("div.no-results").visible).ok();
|
||||
await menu.openPage("browse");
|
||||
await toolbar.setFilter("view", "Cards");
|
||||
await t
|
||||
.click(newpage.cardTitle.withAttribute("data-uid", FirstPhotoDome))
|
||||
.click(Selector("#tab-labels"))
|
||||
.expect(Selector("td").withText("No labels found").visible)
|
||||
.ok()
|
||||
.typeText(Selector(".input-label input"), "Dome")
|
||||
.click(Selector("button.p-photo-label-add"));
|
||||
});
|
||||
|
||||
/*Does not work on sqlite
|
||||
test.skip("testID", "labels-005")("Check label count", async (t) => {
|
||||
await page.openNav();
|
||||
await t.click(Selector(".nav-labels"));
|
||||
await page.search("cat");
|
||||
const LabelCat = await Selector("a.is-label", { timeout: 55000 }).nth(0).getAttribute("data-uid");
|
||||
const CatCaption = await Selector("a[data-uid=" + LabelCat + "] div.caption").innerText;
|
||||
console.log(CatCaption);
|
||||
await t.click(Selector("a.is-label").withAttribute("data-uid", LabelCat));
|
||||
const countPhotosCat = await Selector("div.is-photo").count;
|
||||
await t.expect(CatCaption).contains(countPhotosCat.toString());
|
||||
console.log(countPhotosCat);
|
||||
await page.openNav();
|
||||
await t.click(Selector(".nav-labels"));
|
||||
await page.search("people");
|
||||
const LabelPeople = await Selector("a.is-label", { timeout: 55000 }).nth(0).getAttribute("data-uid");
|
||||
const PeopleCaption = await Selector("a[data-uid=" + LabelCat + "] div.caption").innerText;
|
||||
console.log(PeopleCaption);
|
||||
await t.click(Selector("a.is-label").withAttribute("data-uid", LabelPeople));
|
||||
const countPhotosPeople = await Selector("div.is-photo").count;
|
||||
await t.expect(CatCaption).contains(countPhotosPeople.toString());
|
||||
console.log(countPhotosPeople);
|
||||
});*/
|
131
frontend/tests/acceptance-new/moment.js
Normal file
131
frontend/tests/acceptance-new/moment.js
Normal file
|
@ -0,0 +1,131 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
|
||||
fixture`Test moments`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
|
||||
test.meta("testID", "moments-001")("Update moment", async (t) => {
|
||||
await menu.openPage("moments");
|
||||
await toolbar.search("Nature");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Nature")
|
||||
.click(newpage.cardTitle.nth(0))
|
||||
.expect(Selector(".input-title input").value)
|
||||
.eql("Nature & Landscape")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-title input"), "Winter", { replace: true })
|
||||
.typeText(Selector(".input-location input"), "Snow-Land", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-description textarea"), "We went to ski")
|
||||
.typeText(Selector(".input-category input"), "Mountains")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm")
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Winter")
|
||||
.expect(newpage.cardDescription.nth(0).innerText)
|
||||
.contains("We went to ski")
|
||||
.expect(Selector("div.caption").nth(1).innerText)
|
||||
.contains("Mountains")
|
||||
.expect(Selector("div.caption").nth(2).innerText)
|
||||
.contains("Snow-Land");
|
||||
await album.openNthAlbum(0);
|
||||
await t.expect(toolbar.toolbarTitle.innerText).contains("Winter");
|
||||
await t.expect(toolbar.toolbarDescription.innerText).contains("We went to ski");
|
||||
await menu.openPage("moments");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await toolbar.search("category:Mountains");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Mountains");
|
||||
}
|
||||
await t.expect(newpage.cardTitle.nth(0).innerText).contains("Winter");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
await toolbar.triggerToolbarAction("edit", "");
|
||||
await t
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("We went to ski")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("Mountains")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("Snow-Land")
|
||||
.typeText(Selector(".input-title input"), "Nature & Landscape", { replace: true })
|
||||
.click(Selector(".input-category input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-description textarea"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-location input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await menu.openPage("moments");
|
||||
await toolbar.search("Nature");
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Nature & Landscape")
|
||||
.expect(newpage.cardDescription.innerText)
|
||||
.notContains("We went to ski")
|
||||
.expect(Selector("div.caption").nth(0).innerText)
|
||||
.notContains("Snow-Land");
|
||||
});
|
||||
|
||||
//TODO test that sharing link works as expected
|
||||
test.meta("testID", "moments-003")("Create, Edit, delete sharing link", async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("moments");
|
||||
});
|
||||
|
||||
test.meta("testID", "moments-004")("Create/delete album-clone from moment", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("moments");
|
||||
const FirstMoment = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(FirstMoment);
|
||||
const PhotoCountInMoment = await photo.getPhotoCount("all");
|
||||
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhoto = await photo.getNthPhotoUid("image", 1);
|
||||
await menu.openPage("moments");
|
||||
await album.selectAlbumFromUID(FirstMoment);
|
||||
await contextmenu.triggerContextMenuAction("clone", "NotYetExistingAlbumForMoment", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
await toolbar.search("NotYetExistingAlbumForMoment");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountInAlbum = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountInAlbum).eql(PhotoCountInMoment);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await photo.checkPhotoVisibility(SecondPhoto, true);
|
||||
await menu.openPage("albums");
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
await menu.openPage("moments");
|
||||
await album.openAlbumWithUid(FirstMoment);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await photo.checkPhotoVisibility(SecondPhoto, true);
|
||||
});
|
76
frontend/tests/acceptance-new/originals.js
Normal file
76
frontend/tests/acceptance-new/originals.js
Normal file
|
@ -0,0 +1,76 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import PhotoViews from "../page-model/photo-views";
|
||||
import Label from "../page-model/label";
|
||||
import Album from "../page-model/album";
|
||||
import Subject from "../page-model/subject";
|
||||
import NewPage from "../page-model/page";
|
||||
import Originals from "../page-model/originals";
|
||||
|
||||
fixture`Test files`.page`${testcafeconfig.url}`;
|
||||
|
||||
const menu = new Menu();
|
||||
const photo = new Photo();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const album = new Album();
|
||||
const originals = new Originals();
|
||||
|
||||
test.meta("testID", "originals-001")("Add original files to album", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("KanadaVacation");
|
||||
await t.expect(Selector("div.no-results").visible).ok();
|
||||
await menu.openPage("originals");
|
||||
await t.click(Selector("button").withText("Vacation"));
|
||||
await t.wait(15000);
|
||||
const FirstItemInVacation = await Selector("div.result", { timeout: 15000 }).nth(0).innerText;
|
||||
const KanadaUid = await originals.getNthFolderUid(0);
|
||||
const SecondItemInVacation = await Selector("div.result").nth(1).innerText;
|
||||
await t
|
||||
.expect(FirstItemInVacation)
|
||||
.contains("Kanada")
|
||||
.expect(SecondItemInVacation)
|
||||
.contains("Korsika");
|
||||
await originals.openFolderWithUid(KanadaUid);
|
||||
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 originals.triggerHoverAction("is-folder","uid", KanadaUid, "select");
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.triggerContextMenuAction("album", "KanadaVacation", "");
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("KanadaVacation");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterAdd).eql(2);
|
||||
await menu.openPage("albums");
|
||||
await album.triggerHoverAction("uid", AlbumUid, "select");
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
});
|
||||
|
||||
test.meta("testID", "originals-002")("Download original files", async (t) => {
|
||||
await menu.openPage("originals");
|
||||
const FirstFile = await originals.getNthFileUid(0);
|
||||
await originals.triggerHoverAction("is-file", "uid", FirstFile, "select");
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.checkContextMenuActionAvailability("download", true);
|
||||
await contextmenu.clearSelection();
|
||||
const FirstFolder = await originals.getNthFolderUid(0);
|
||||
await originals.triggerHoverAction("is-folder","uid", FirstFolder, "select");
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.checkContextMenuActionAvailability("download", true);
|
||||
await contextmenu.clearSelection();
|
||||
});
|
248
frontend/tests/acceptance-new/people.js
Normal file
248
frontend/tests/acceptance-new/people.js
Normal file
|
@ -0,0 +1,248 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
import Subject from "../page-model/subject";
|
||||
import PhotoViews from "../page-model/photo-views";
|
||||
|
||||
fixture.only`Test people`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
const subject = new Subject();
|
||||
const photoviews = new PhotoViews();
|
||||
|
||||
test.meta("testID", "people-001")("Add + Rename", async (t) => {
|
||||
await menu.openPage("people");
|
||||
await t.click(Selector("#tab-people_faces > a"));
|
||||
await subject.triggerToolbarAction("reload", "");
|
||||
const countFaces = await subject.getFaceCount();
|
||||
await t.click(Selector("#tab-people > a"));
|
||||
const countSubjects = await subject.getSubjectCount();
|
||||
await t.click(Selector("#tab-people_faces > a"));
|
||||
const FirstFaceID = await subject.getNthFaceUid(0);
|
||||
await subject.openFaceWithUid(FirstFaceID);
|
||||
const countPhotosFace = await photo.getPhotoCount("all");
|
||||
await menu.openPage("people");
|
||||
await t
|
||||
.click(Selector("#tab-people_faces > a"))
|
||||
.typeText(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"), "Jane Doe")
|
||||
.pressKey("enter");
|
||||
await subject.triggerToolbarAction("reload");
|
||||
const countFacesAfterAdd = await subject.getFaceCount();
|
||||
await t
|
||||
.expect(countFacesAfterAdd)
|
||||
.eql(countFaces - 1)
|
||||
.click(Selector("#tab-people > a"));
|
||||
await subject.checkFaceVisibility(FirstFaceID, false);
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(6000);
|
||||
const countSubjectsAfterAdd = await subject.getSubjectCount();
|
||||
await t.expect(countSubjectsAfterAdd).eql(countSubjects + 1);
|
||||
await toolbar.search("Jane");
|
||||
const JaneUID = await subject.getNthSubjectUid(0);
|
||||
await t
|
||||
.expect(Selector("a[data-uid=" + JaneUID + "] div.caption").innerText)
|
||||
.contains(countPhotosFace.toString());
|
||||
await subject.openSubjectWithUid(JaneUID);
|
||||
const countPhotosSubject = await photo.getPhotoCount("all");
|
||||
await t.expect(countPhotosFace).eql(countPhotosSubject);
|
||||
await photoviews.triggerHoverAction("nth", 0, "select");
|
||||
await photoviews.triggerHoverAction("nth", 1, "select");
|
||||
await photoviews.triggerHoverAction("nth", 2, "select");
|
||||
await contextmenu.triggerContextMenuAction("edit", "", "");
|
||||
await t
|
||||
.click(Selector("#tab-people"))
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.contains("Jane Doe")
|
||||
.click("button.action-close");
|
||||
await menu.openPage("people");
|
||||
await t
|
||||
.click(Selector("a[data-uid=" + JaneUID + "] div.v-card__title"))
|
||||
.typeText(Selector("div.input-rename input"), "Max Mu", { replace: true })
|
||||
.pressKey("enter")
|
||||
.expect(Selector("a[data-uid=" + JaneUID + "] div.v-card__title").innerText)
|
||||
.contains("Max Mu");
|
||||
await subject.openSubjectWithUid(JaneUID);
|
||||
await t.eval(() => location.reload());
|
||||
await contextmenu.checkContextMenuCount("3");
|
||||
await contextmenu.triggerContextMenuAction("edit", "", "");
|
||||
await t
|
||||
.click(Selector("#tab-people"))
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.contains("Max Mu")
|
||||
.click(Selector("button.action-next"))
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.contains("Max Mu")
|
||||
.click(Selector("button.action-next"))
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.contains("Max Mu")
|
||||
.click(Selector("button.action-close"));
|
||||
await page.clearSelection();
|
||||
await toolbar.search("person:max-mu");
|
||||
const countPhotosSubjectAfterRename = await photo.getPhotoCount("all");
|
||||
await t.expect(countPhotosSubjectAfterRename).eql(countPhotosSubject);
|
||||
});
|
||||
|
||||
test.meta("testID", "people-002")("Add + Reject + Star", async (t) => {
|
||||
await menu.openPage("people");
|
||||
await t.click(Selector("#tab-people_faces > a"));
|
||||
await subject.triggerToolbarAction("reload");
|
||||
const FirstFaceID = await subject.getNthFaceUid(0);
|
||||
await t
|
||||
.expect(Selector("div.menuable__content__active").nth(0).visible)
|
||||
.notOk()
|
||||
.click(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"))
|
||||
.expect(Selector("div.menuable__content__active").nth(0).visible)
|
||||
.ok()
|
||||
.typeText(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"), "Andrea Doe")
|
||||
.pressKey("enter")
|
||||
.click(Selector("#tab-people > a"));
|
||||
await toolbar.search("Andrea");
|
||||
const AndreaUID = await subject.getNthSubjectUid(0);
|
||||
await subject.openSubjectWithUid(AndreaUID);
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(5000);
|
||||
const countPhotosAndreaAfterAdd = await photo.getPhotoCount("all");
|
||||
await photoviews.triggerHoverAction("nth", 1, "select");
|
||||
await contextmenu.triggerContextMenuAction("edit", "", "");
|
||||
await t
|
||||
.click(Selector("#tab-people"))
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.eql("Andrea Doe")
|
||||
.click(Selector("div.input-name div.v-input__icon--clear"))
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.eql("")
|
||||
.typeText(Selector("div.input-name input").nth(0), "Nicole", { replace: true })
|
||||
.pressKey("enter")
|
||||
.click("button.action-close");
|
||||
await contextmenu.clearSelection();
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(5000);
|
||||
const countPhotosAndreaAfterReject = await photo.getPhotoCount("all");
|
||||
const Diff = countPhotosAndreaAfterAdd - countPhotosAndreaAfterReject;
|
||||
await toolbar.search("person:nicole");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(5000);
|
||||
const countPhotosNicole = await photo.getPhotoCount("all");
|
||||
await t.expect(Diff).gte(countPhotosNicole);
|
||||
await menu.openPage("people");
|
||||
await toolbar.search("Nicole");
|
||||
const NicoleUID = await subject.getNthSubjectUid(0);
|
||||
await subject.triggerHoverAction("uid", NicoleUID, "favorite");
|
||||
await toolbar.search(" ");
|
||||
await t.expect(await subject.getNthSubjectUid(0)).eql(NicoleUID);
|
||||
});
|
||||
|
||||
test.meta("testID", "people-003")("Remove face", async (t) => {
|
||||
await toolbar.search("face:new");
|
||||
const FirstPhoto = await photo.getNthPhotoUid("all", 0);
|
||||
await photoviews.triggerHoverAction("nth", 0, "select");
|
||||
await contextmenu.triggerContextMenuAction("edit", "", "");
|
||||
await t.click(Selector("#tab-people"));
|
||||
const MarkerCount = await subject.getMarkerCount();
|
||||
if ((await Selector("div.input-name input").nth(0).value) == "") {
|
||||
await t
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.notOk()
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.eql("")
|
||||
.click(Selector("button.input-reject"))
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.ok()
|
||||
.click(Selector("button.action-undo"));
|
||||
} else if ((await Selector("div.input-name input").nth(0).value) != "") {
|
||||
await t
|
||||
.expect(Selector("div.input-name input").nth(1).value)
|
||||
.eql("")
|
||||
.click(Selector("button.input-reject"))
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.ok()
|
||||
.click(Selector("button.action-undo"));
|
||||
}
|
||||
await t.click("button.action-close");
|
||||
await contextmenu.clearSelection();
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(5000);
|
||||
await photoviews.triggerHoverAction("uid", FirstPhoto, "select");
|
||||
await contextmenu.triggerContextMenuAction("edit", "", "");
|
||||
await t.click(Selector("#tab-people"));
|
||||
if ((await Selector("div.input-name input").nth(0).value) == "") {
|
||||
await t
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.notOk()
|
||||
.expect(Selector("div.input-name input").nth(0).value)
|
||||
.eql("")
|
||||
.click(Selector("button.input-reject"))
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.ok();
|
||||
} else if ((await Selector("div.input-name input").nth(0).value) != "") {
|
||||
await t
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.notOk()
|
||||
.expect(Selector("div.input-name input").nth(1).value)
|
||||
.eql("")
|
||||
.click(Selector("button.input-reject"))
|
||||
.expect(Selector("button.action-undo").nth(0).visible)
|
||||
.ok();
|
||||
}
|
||||
await t.click("button.action-close");
|
||||
await t.eval(() => location.reload());
|
||||
await contextmenu.triggerContextMenuAction("edit", "", "");
|
||||
await t.click(Selector("#tab-people"));
|
||||
const MarkerCountAfterRemove = await subject.getMarkerCount();
|
||||
await t.expect(MarkerCountAfterRemove).eql(MarkerCount - 1);
|
||||
});
|
||||
|
||||
test.meta("testID", "people-004")("Hide face", async (t) => {
|
||||
await menu.openPage("people");
|
||||
await t.click(Selector("#tab-people_faces > a"));
|
||||
await subject.triggerToolbarAction("reload");
|
||||
const FirstFaceID = await subject.getNthFaceUid(0);
|
||||
await subject.checkFaceVisibility(FirstFaceID, true);
|
||||
await subject.triggerHoverAction("id", FirstFaceID, "hidden");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(5000);
|
||||
await subject.checkFaceVisibility(FirstFaceID, false);
|
||||
await subject.triggerToolbarAction("show-hidden");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(6000);
|
||||
await subject.checkFaceVisibility(FirstFaceID, true);
|
||||
await subject.triggerHoverAction("id", FirstFaceID, "hidden");
|
||||
await subject.triggerToolbarAction("exclude-hidden");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(6000);
|
||||
await subject.checkFaceVisibility(FirstFaceID, true);
|
||||
});
|
||||
|
||||
test.meta("testID", "people-005")("Hide person", async (t) => {
|
||||
await menu.openPage("people");
|
||||
await t.click(Selector("#tab-people > a"));
|
||||
const FirstPerson = await subject.getNthSubjectUid(0);
|
||||
await subject.checkSubjectVisibility("uid", FirstPerson, true);
|
||||
await subject.triggerHoverAction("uid", FirstPerson, "hidden");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(6000);
|
||||
await subject.checkSubjectVisibility("uid", FirstPerson, false);
|
||||
await subject.triggerToolbarAction("show-hidden");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(6000);
|
||||
await subject.checkSubjectVisibility("uid", FirstPerson, true);
|
||||
await subject.triggerHoverAction("uid", FirstPerson, "hidden");
|
||||
await subject.triggerToolbarAction("exclude-hidden");
|
||||
await t.eval(() => location.reload());
|
||||
await t.wait(5000);
|
||||
await subject.checkSubjectVisibility("uid", FirstPerson, true);
|
||||
});
|
130
frontend/tests/acceptance-new/states.js
Normal file
130
frontend/tests/acceptance-new/states.js
Normal file
|
@ -0,0 +1,130 @@
|
|||
import { Selector } from "testcafe";
|
||||
import testcafeconfig from "./testcafeconfig";
|
||||
import Page from "./page-model";
|
||||
import Menu from "../page-model/menu";
|
||||
import Album from "../page-model/album";
|
||||
import Toolbar from "../page-model/toolbar";
|
||||
import ContextMenu from "../page-model/context-menu";
|
||||
import Photo from "../page-model/photo";
|
||||
import PhotoViewer from "../page-model/photoviewer";
|
||||
import NewPage from "../page-model/page";
|
||||
|
||||
fixture`Test states`.page`${testcafeconfig.url}`;
|
||||
|
||||
const page = new Page();
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const newpage = new NewPage();
|
||||
|
||||
test.meta("testID", "states-001")("Update state", async (t) => {
|
||||
await menu.openPage("states");
|
||||
await toolbar.search("Canada");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("British Columbia")
|
||||
.click(newpage.cardTitle.nth(0))
|
||||
.expect(Selector(".input-title input").value)
|
||||
.eql("British Columbia")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("Canada")
|
||||
.typeText(Selector(".input-title input"), "Wonderland", { replace: true })
|
||||
.typeText(Selector(".input-location input"), "Earth", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("")
|
||||
.typeText(Selector(".input-description textarea"), "We love earth")
|
||||
.typeText(Selector(".input-category input"), "Mountains")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm")
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("Wonderland")
|
||||
.expect(newpage.cardDescription.nth(0).innerText)
|
||||
.contains("We love earth")
|
||||
.expect(Selector("div.caption").nth(1).innerText)
|
||||
.contains("Mountains")
|
||||
.expect(Selector("div.caption").nth(2).innerText)
|
||||
.contains("Earth");
|
||||
await album.openNthAlbum(0);
|
||||
await t.expect(toolbar.toolbarTitle.innerText).contains("Wonderland");
|
||||
await t.expect(toolbar.toolbarDescription.innerText).contains("We love earth");
|
||||
await menu.openPage("states");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await page.search("category:Mountains");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Mountains");
|
||||
}
|
||||
await t.expect(newpage.cardTitle.nth(0).innerText).contains("Wonderland");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
await toolbar.triggerToolbarAction("edit", "");
|
||||
await t
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
.eql("We love earth")
|
||||
.expect(Selector(".input-category input").value)
|
||||
.eql("Mountains")
|
||||
.expect(Selector(".input-location input").value)
|
||||
.eql("Earth")
|
||||
.typeText(Selector(".input-title input"), "British Columbia / Canada", { replace: true })
|
||||
.click(Selector(".input-category input"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.click(Selector(".input-description textarea"))
|
||||
.pressKey("ctrl+a delete")
|
||||
.pressKey("enter")
|
||||
.typeText(Selector(".input-location input"), "Canada", { replace: true })
|
||||
.click(".action-confirm");
|
||||
await menu.openPage("states");
|
||||
await toolbar.search("Canada");
|
||||
await t
|
||||
.expect(newpage.cardTitle.nth(0).innerText)
|
||||
.contains("British Columbia / Canada")
|
||||
.expect(newpage.cardDescription.innerText)
|
||||
.notContains("We love earth")
|
||||
.expect(Selector("div.caption").nth(0).innerText)
|
||||
.notContains("Earth");
|
||||
});
|
||||
|
||||
//TODO test that sharing link works as expected
|
||||
test.meta("testID", "states-003")("Create, Edit, delete sharing link", async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("states");
|
||||
});
|
||||
|
||||
test.meta("testID", "states-004")("Create/delete album-clone from state", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("states");
|
||||
await toolbar.search("Canada");
|
||||
const FirstState = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(FirstState);
|
||||
const PhotoCountInState = await photo.getPhotoCount("all");
|
||||
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhoto = await photo.getNthPhotoUid("image", 1);
|
||||
await menu.openPage("states");
|
||||
await album.selectAlbumFromUID(FirstState);
|
||||
await contextmenu.triggerContextMenuAction("clone", "NotYetExistingAlbumForState", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
await toolbar.search("NotYetExistingAlbumForState");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountInAlbum = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountInAlbum).eql(PhotoCountInState);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await photo.checkPhotoVisibility(SecondPhoto, true);
|
||||
await menu.openPage("albums");
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
await menu.openPage("states");
|
||||
await album.openAlbumWithUid(FirstState);
|
||||
await photo.checkPhotoVisibility(FirstPhoto, true);
|
||||
await photo.checkPhotoVisibility(SecondPhoto, true);
|
||||
});
|
4
frontend/tests/acceptance-new/testcafeconfig.json
Normal file
4
frontend/tests/acceptance-new/testcafeconfig.json
Normal file
|
@ -0,0 +1,4 @@
|
|||
{
|
||||
|
||||
"url": "localhost:2343/browse"
|
||||
}
|
Loading…
Add table
Reference in a new issue