Tests: Refactor acceptance tests

This commit is contained in:
theresa 2022-01-26 18:15:27 +01:00
parent c86569f34e
commit 6c8ec3eb3f
4 changed files with 859 additions and 557 deletions

View file

@ -5,11 +5,14 @@ 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 Page from "../page-model/page";
import Settings from "../page-model/settings";
import Library from "../page-model/library";
import PhotoEdit from "../page-model/photo-edit";
import AlbumDialog from "../page-model/dialog-album";
fixture`Test admin role`.page`${testcafeconfig.url}`;
@ -17,11 +20,14 @@ const menu = new Menu();
const photo = new Photo();
const toolbar = new Toolbar();
const contextmenu = new ContextMenu();
const photoviews = new PhotoViews();
const label = new Label();
const album = new Album();
const subject = new Subject();
const page = new Page();
const settings = new Settings();
const library = new Library();
const photoedit = new PhotoEdit();
const albumdialog = new AlbumDialog();
const getLocation = ClientFunction(() => document.location.href);
@ -34,25 +40,35 @@ test.meta("testID", "authentication-000")(
test.meta("testID", "admin-role-001")("Access to settings", async (t) => {
await page.login("admin", "photoprism");
await menu.checkMenuItemAvailability("settings", true);
await t.navigateTo("/settings");
await t
.wait(5000)
.expect(Selector(".input-language input", { timeout: 8000 }).visible)
.expect(settings.languageInput.visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk()
.navigateTo("/settings/library")
.notOk();
await t.navigateTo("/settings/library");
await t
.expect(Selector("form.p-form-settings").visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk()
.navigateTo("/settings/advanced")
.notOk();
await t.navigateTo("/settings/advanced");
await t
.expect(Selector("label").withText("Read-Only Mode").visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk()
.navigateTo("/settings/sync")
.notOk();
await t.navigateTo("/settings/sync");
await t
.expect(Selector("div.p-accounts-list").visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
@ -62,67 +78,97 @@ test.meta("testID", "admin-role-001")("Access to settings", async (t) => {
test.meta("testID", "admin-role-002")("Access to archive", async (t) => {
await page.login("admin", "photoprism");
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("archive", true);
await t.navigateTo("/archive");
await photo.checkPhotoVisibility("pqnahct2mvee8sr4", true);
const PhotoCountArchive = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).gte(PhotoCountArchive);
});
test.meta("testID", "admin-role-003")("Access to review", async (t) => {
await page.login("admin", "photoprism");
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("review", true);
await t.navigateTo("/review");
await photo.checkPhotoVisibility("pqzuein2pdcg1kc7", true);
const PhotoCountReview = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).gte(PhotoCountReview);
});
test.meta("testID", "admin-role-004")("Access to private", async (t) => {
await page.login("admin", "photoprism");
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("private", true);
await t.navigateTo("/private");
await photo.checkPhotoVisibility("pqmxlquf9tbc8mk2", true);
const PhotoCountPrivate = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).gte(PhotoCountPrivate);
});
test.meta("testID", "admin-role-005")("Access to library", async (t) => {
await page.login("admin", "photoprism");
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("library", true);
await t.navigateTo("/library");
await t
.expect(Selector(".input-index-folder input").visible)
.expect(library.indexFolderSelect.visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk()
.navigateTo("/library/import")
.expect(Selector(".input-import-folder input").visible)
.notOk();
await t.navigateTo("/library/import");
await t
.expect(library.openImportFolderSelect.visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk()
.navigateTo("/library/logs")
.notOk();
await t.navigateTo("/library/logs");
await t
.expect(Selector("div.terminal").visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk();
await menu.checkMenuItemAvailability("originals", true);
await t.navigateTo("/library/files");
await t
.navigateTo("/library/files")
.expect(Selector("div.p-page-files").visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
.notOk();
await menu.checkMenuItemAvailability("hidden", true);
await t.navigateTo("/library/hidden");
const PhotoCountHidden = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).gte(PhotoCountHidden);
await menu.checkMenuItemAvailability("errors", true);
await t.navigateTo("/library/errors");
await t
.navigateTo("/library/errors")
.expect(Selector("div.p-page-errors").visible)
.ok()
.expect(Selector("div.p-page-photos").visible)
@ -134,26 +180,35 @@ test.meta("testID", "admin-role-006")("private/archived photos in search results
const PhotoCountBrowse = await photo.getPhotoCount("all");
await toolbar.search("private:true");
const PhotoCountPrivate = await photo.getPhotoCount("all");
await t.expect(PhotoCountPrivate).eql(2);
await photo.checkPhotoVisibility("pqmxlquf9tbc8mk2", true);
await toolbar.search("archived:true");
const PhotoCountArchive = await photo.getPhotoCount("all");
await t.expect(PhotoCountArchive).eql(3);
await photo.checkPhotoVisibility("pqnahct2mvee8sr4", true);
await toolbar.search("quality:0");
const PhotoCountReview = await photo.getPhotoCount("all");
await t.expect(PhotoCountReview).gte(PhotoCountBrowse);
await photo.checkPhotoVisibility("pqzuein2pdcg1kc7", true);
await menu.openPage("places");
await t
.expect(Selector("#map").exists, { timeout: 15000 })
.ok()
.expect(Selector("div.p-map-control").visible)
.ok()
.wait(5000);
await t
.typeText(Selector('input[aria-label="Search"]'), "oaxaca", { replace: true })
.pressKey("enter");
await t
.expect(Selector("div.p-map-control").visible)
.ok()
@ -164,9 +219,11 @@ test.meta("testID", "admin-role-006")("private/archived photos in search results
.notOk()
.expect(Selector('div[title="Viewpoint / Mexico / 2018"]').visible)
.notOk();
await t
.typeText(Selector('input[aria-label="Search"]'), "canada", { replace: true })
.pressKey("enter");
await t
.expect(Selector("div.p-map-control").visible)
.ok()
@ -212,25 +269,34 @@ test.meta("testID", "admin-role-008")(
"Admin can private, archive, share, add/remove to album",
async (t) => {
await page.login("admin", "photoprism");
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhoto);
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhotoUid);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("archive", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.clearSelection();
await toolbar.setFilter("view", "List");
await photo.checkListViewActionAvailability("private", false);
await menu.openPage("albums");
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", true);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("remove", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.clearSelection();
await toolbar.triggerToolbarAction("list-view", "");
await toolbar.triggerToolbarAction("list-view");
await photo.checkListViewActionAvailability("private", false);
}
);
@ -239,119 +305,131 @@ test.meta("testID", "admin-role-009")("Admin can approve low quality photos", as
await page.login("admin", "photoprism");
await toolbar.search('quality:0 name:"photos-013_1"');
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.triggerContextMenuAction("edit", "", "");
await t.expect(Selector("button.action-approve").visible).ok();
await contextmenu.triggerContextMenuAction("edit", "");
await t.expect(photoedit.detailsApprove.visible).ok();
});
test.meta("testID", "admin-role-010")("Edit dialog is not read only for admin", async (t) => {
await page.login("admin", "photoprism");
await toolbar.search("faces:new");
//details
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhoto);
await contextmenu.triggerContextMenuAction("edit", "", "");
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhotoUid);
await contextmenu.triggerContextMenuAction("edit", "");
await t
.expect(Selector(".input-title input").hasAttribute("disabled"))
.expect(photoedit.title.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-local-time input").hasAttribute("disabled"))
.expect(photoedit.localTime.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-day input").hasAttribute("disabled"))
.expect(photoedit.day.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-month input").hasAttribute("disabled"))
.expect(photoedit.month.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-year input").hasAttribute("disabled"))
.expect(photoedit.year.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-timezone input").hasAttribute("disabled"))
.expect(photoedit.timezone.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-latitude input").hasAttribute("disabled"))
.expect(photoedit.latitude.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-longitude input").hasAttribute("disabled"))
.expect(photoedit.longitude.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-altitude input").hasAttribute("disabled"))
.expect(photoedit.altitude.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-country input").hasAttribute("disabled"))
.expect(photoedit.country.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-camera input").hasAttribute("disabled"))
.expect(photoedit.camera.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-iso input").hasAttribute("disabled"))
.expect(photoedit.iso.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-exposure input").hasAttribute("disabled"))
.expect(photoedit.exposure.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-lens input").hasAttribute("disabled"))
.expect(photoedit.lens.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-fnumber input").hasAttribute("disabled"))
.expect(photoedit.fnumber.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-focal-length input").hasAttribute("disabled"))
.expect(photoedit.focallength.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-subject textarea").hasAttribute("disabled"))
.expect(photoedit.subject.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-artist input").hasAttribute("disabled"))
.expect(photoedit.artist.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-copyright input").hasAttribute("disabled"))
.expect(photoedit.copyright.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-license textarea").hasAttribute("disabled"))
.expect(photoedit.license.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-description textarea").hasAttribute("disabled"))
.expect(photoedit.description.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-keywords textarea").hasAttribute("disabled"))
.expect(photoedit.keywords.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-notes textarea").hasAttribute("disabled"))
.expect(photoedit.notes.hasAttribute("disabled"))
.notOk()
.expect(Selector("button.action-apply").visible)
.expect(photoedit.detailsApply.visible)
.ok();
if (t.browser.platform !== "mobile") {
await t.expect(Selector("button.action-done").visible).ok();
await t.expect(photoedit.detailsDone.visible).ok();
}
//labels
await t.click(photoedit.labelsTab);
await t
.click(Selector("#tab-labels"))
.expect(Selector("button.action-remove").hasAttribute("disabled"))
.expect(photoedit.removeLabel.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-label input").exists)
.expect(photoedit.inputLabelName.exists)
.ok()
.expect(Selector("button.p-photo-label-add").exists)
.ok()
.click(Selector("div.p-inline-edit"))
.expect(Selector(".input-rename input").exists)
.expect(photoedit.addLabel.exists)
.ok();
//people
await t.click(photoedit.openInlineEdit);
await t.expect(photoedit.inputLabelRename.exists).ok();
await t.click(photoedit.peopleTab);
await t
.click(Selector("#tab-people"))
.expect(Selector(".input-name input").hasAttribute("disabled"))
.expect(photoedit.inputName.hasAttribute("disabled"))
.notOk()
.expect(Selector("button.input-reject").exists)
.expect(photoedit.removeMarker.exists)
.ok();
//info
await t.click(photoedit.infoTab);
await t
.click(Selector("#tab-info"))
.expect(Selector(".input-favorite input").hasAttribute("disabled"))
.expect(photoedit.favoriteInput.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-private input").hasAttribute("disabled"))
.expect(photoedit.privateInput.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-scan input").hasAttribute("disabled"))
.expect(photoedit.scanInput.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-panorama input").hasAttribute("disabled"))
.expect(photoedit.panoramaInput.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-stackable input").hasAttribute("disabled"))
.expect(photoedit.stackableInput.hasAttribute("disabled"))
.notOk()
.expect(Selector(".input-type input").hasAttribute("disabled"))
.expect(photoedit.typeInput.hasAttribute("disabled"))
.notOk();
});
test.meta("testID", "admin-role-011")("Edit labels functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("labels");
const FirstLabel = await label.getNthLabeltUid(0);
await label.checkHoverActionState("uid", FirstLabel, "favorite", false);
await label.triggerHoverAction("uid", FirstLabel, "favorite");
await label.checkHoverActionState("uid", FirstLabel, "favorite", true);
await label.triggerHoverAction("uid", FirstLabel, "favorite");
await label.checkHoverActionState("uid", FirstLabel, "favorite", false);
await t
.click(Selector(`a.uid-${FirstLabel} div.inline-edit`))
.expect(Selector(".input-rename input").visible)
.ok();
await label.selectLabelFromUID(FirstLabel);
const FirstLabelUid = await label.getNthLabeltUid(0);
await label.checkHoverActionState("uid", FirstLabelUid, "favorite", false);
await label.triggerHoverAction("uid", FirstLabelUid, "favorite");
await label.checkHoverActionState("uid", FirstLabelUid, "favorite", true);
await label.triggerHoverAction("uid", FirstLabelUid, "favorite");
await label.checkHoverActionState("uid", FirstLabelUid, "favorite", false);
await t.click(Selector(`a.uid-${FirstLabelUid} div.inline-edit`));
await t.expect(photoedit.inputLabelRename.visible).ok();
await label.selectLabelFromUID(FirstLabelUid);
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.checkContextMenuActionAvailability("album", true);
});
@ -359,39 +437,46 @@ test.meta("testID", "admin-role-011")("Edit labels functionality", async (t) =>
test.meta("testID", "admin-role-012")("Edit album functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("albums");
await toolbar.checkToolbarActionAvailability("add", true);
await t.expect(Selector("a.is-album button.action-share").visible).ok();
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 1, "share", true);
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("clone", true);
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.ok()
.click(Selector("button.action-cancel"));
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).ok();
await t.click(albumdialog.dialogCancel);
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", true);
await toolbar.checkToolbarActionAvailability("edit", true);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
@ -401,9 +486,12 @@ test.meta("testID", "admin-role-012")("Edit album functionality", async (t) => {
test.meta("testID", "admin-role-013")("Edit moment functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("moments");
await t.expect(Selector("a.is-album button.action-share").visible).ok();
const FirstAlbum = await album.getNthAlbumUid("moment", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", true);
const FirstAlbumUid = await album.getNthAlbumUid("moment", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("clone", true);
@ -411,28 +499,32 @@ test.meta("testID", "admin-role-013")("Edit moment functionality", async (t) =>
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.ok()
.click(Selector("button.action-cancel"));
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).ok();
await t.click(albumdialog.dialogCancel);
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", true);
await toolbar.checkToolbarActionAvailability("edit", true);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
@ -443,37 +535,46 @@ test.meta("testID", "admin-role-013")("Edit moment functionality", async (t) =>
test.meta("testID", "admin-role-014")("Edit state functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("states");
await t.expect(Selector("a.is-album button.action-share").visible).ok();
const FirstAlbum = await album.getNthAlbumUid("state", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", true);
const FirstAlbumUid = await album.getNthAlbumUid("state", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("clone", true);
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.ok()
.click(Selector("button.action-cancel"));
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).ok();
await t.click(albumdialog.dialogCancel);
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", true);
await toolbar.checkToolbarActionAvailability("edit", true);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
@ -484,37 +585,46 @@ test.meta("testID", "admin-role-014")("Edit state functionality", async (t) => {
test.meta("testID", "admin-role-015")("Edit calendar functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("calendar");
await t.expect(Selector("a.is-album button.action-share").visible).ok();
const FirstAlbum = await album.getNthAlbumUid("month", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", true);
const FirstAlbumUid = await album.getNthAlbumUid("month", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("clone", true);
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.ok()
.click(Selector("button.action-cancel"));
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).ok();
await t.click(albumdialog.dialogCancel);
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", true);
await toolbar.checkToolbarActionAvailability("edit", true);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
@ -524,37 +634,46 @@ test.meta("testID", "admin-role-015")("Edit calendar functionality", async (t) =
test.meta("testID", "admin-role-016")("Edit folder functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("folders");
await t.expect(Selector("a.is-album button.action-share").visible).ok();
const FirstAlbum = await album.getNthAlbumUid("folder", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", true);
const FirstAlbumUid = await album.getNthAlbumUid("folder", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("clone", true);
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.ok()
.click(Selector("button.action-cancel"));
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).ok();
await t.click(albumdialog.dialogCancel);
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", true);
await toolbar.checkToolbarActionAvailability("edit", true);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
@ -564,45 +683,58 @@ test.meta("testID", "admin-role-016")("Edit folder functionality", async (t) =>
test.meta("testID", "admin-role-017")("Edit people functionality", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("people");
await toolbar.checkToolbarActionAvailability("show-hidden", true);
await t.expect(Selector("#tab-people_faces > a").exists).ok();
await t.expect(subject.newTab.exists).ok();
await subject.checkSubjectVisibility("name", "Otto Visible", true);
await subject.checkSubjectVisibility("name", "Monika Hide", false);
await toolbar.triggerToolbarAction("show-hidden", "");
await toolbar.triggerToolbarAction("show-hidden");
await subject.checkSubjectVisibility("name", "Otto Visible", true);
await subject.checkSubjectVisibility("name", "Monika Hide", true);
await t
.click(Selector("a div.v-card__title").nth(0))
.expect(Selector("div.input-rename input").visible)
.ok();
await t.click(Selector("a div.v-card__title").nth(0));
await t.expect(Selector("div.input-rename input").visible).ok();
await subject.checkHoverActionAvailability("nth", 0, "hidden", true);
await subject.toggleSelectNthSubject(0);
await contextmenu.checkContextMenuActionAvailability("album", "true");
await contextmenu.clearSelection();
const FirstSubject = await subject.getNthSubjectUid(0);
if (await Selector(`a.uid-${FirstSubject}`).hasClass("is-favorite")) {
await subject.checkHoverActionState("uid", FirstSubject, "favorite", true);
await subject.triggerHoverAction("uid", FirstSubject, "favorite");
await subject.checkHoverActionState("uid", FirstSubject, "favorite", false);
await subject.triggerHoverAction("uid", FirstSubject, "favorite");
await subject.checkHoverActionState("uid", FirstSubject, "favorite", true);
const FirstSubjectUid = await subject.getNthSubjectUid(0);
if (await Selector(`a.uid-${FirstSubjectUid}`).hasClass("is-favorite")) {
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", true);
await subject.triggerHoverAction("uid", FirstSubjectUid, "favorite");
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", false);
await subject.triggerHoverAction("uid", FirstSubjectUid, "favorite");
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", true);
} else {
await subject.checkHoverActionState("uid", FirstSubject, "favorite", false);
await subject.triggerHoverAction("uid", FirstSubject, "favorite");
await subject.checkHoverActionState("uid", FirstSubject, "favorite", true);
await subject.triggerHoverAction("uid", FirstSubject, "favorite");
await subject.checkHoverActionState("uid", FirstSubject, "favorite", false);
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", false);
await subject.triggerHoverAction("uid", FirstSubjectUid, "favorite");
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", true);
await subject.triggerHoverAction("uid", FirstSubjectUid, "favorite");
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", false);
}
await subject.openNthSubject(0);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.triggerContextMenuAction("edit", "", "");
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.peopleTab);
await t
.click(Selector("#tab-people"))
.expect(Selector(".input-name input").hasAttribute("disabled"))
.expect(photoedit.inputName.hasAttribute("disabled"))
.notOk()
.expect(Selector("div.v-input__icon--clear > i").hasClass("v-icon--disabled"))
.notOk()
.navigateTo("/people/new")
.expect(Selector("div.is-face").visible)
.ok();
.expect(photoedit.rejectName.hasClass("v-icon--disabled"))
.notOk();
await t.navigateTo("/people/new");
await t.expect(Selector("div.is-face").visible).ok();
await t.navigateTo("/people?hidden=yes&order=relevance");
await t.expect(Selector("a.is-subject").visible).ok();
});

View file

@ -1,123 +1,135 @@
import { Selector } from "testcafe";
import testcafeconfig from "../acceptance/testcafeconfig";
import Page from "../page-model/page";
import Account from "../page-model/account";
import Menu from "../page-model/menu";
fixture`Test authentication`.page`${testcafeconfig.url}`;
const page = new Page();
const account = new Account();
const menu = new Menu();
test.meta("testID", "authentication-000")(
"Time to start instance (will be marked as unstable)",
test.meta("testID", "authentication-001").meta({ type: "smoke" })("Login and Logout", async (t) => {
await t.navigateTo("/browse");
await t
.expect(page.nameInput.visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
await t.typeText(page.nameInput, "admin", { replace: true });
await t.expect(page.loginAction.hasAttribute("disabled", "disabled")).ok();
await t.typeText(page.passwordInput, "photoprism", { replace: true });
await t.expect(page.passwordInput.hasAttribute("type", "password")).ok();
await t.click(page.togglePasswordMode);
await t.expect(page.passwordInput.hasAttribute("type", "text")).ok();
await t.click(page.togglePasswordMode);
await t.expect(page.passwordInput.hasAttribute("type", "password")).ok();
await t.click(page.loginAction);
await t.expect(Selector(".input-search input", { timeout: 7000 }).visible).ok();
await page.logout();
await t
.expect(page.nameInput.visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
await t.navigateTo("/settings");
await t
.expect(page.nameInput.visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
});
test.meta("testID", "authentication-002").meta({ type: "smoke" })(
"Login with wrong credentials",
async (t) => {
await t.wait(5000);
await page.login("wrong", "photoprism");
await t.navigateTo("/favorites");
await t
.expect(page.nameInput.visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
await page.login("admin", "abcdefg");
await t.navigateTo("/archive");
await t
.expect(page.nameInput.visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
}
);
test.meta("testID", "authentication-001")("Login and Logout", async (t) => {
test.meta("testID", "authentication-003").meta({ type: "smoke" })("Change password", async (t) => {
await t.navigateTo("/browse");
await t
.expect(Selector(".input-name input").visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk()
.typeText(Selector(".input-name input"), "admin", { replace: true })
.expect(Selector(".action-confirm").hasAttribute("disabled", "disabled"))
.ok()
.typeText(Selector(".input-password input"), "photoprism", { replace: true })
.expect(Selector(".input-password input").hasAttribute("type", "password"))
.ok()
.click(Selector(".v-input__icon--append"))
.expect(Selector(".input-password input").hasAttribute("type", "text"))
.ok()
.click(Selector(".v-input__icon--append"))
.expect(Selector(".input-password input").hasAttribute("type", "password"))
.ok()
.click(Selector(".action-confirm"))
.expect(Selector(".input-search input", { timeout: 7000 }).visible)
.ok();
await menu.openNav();
await t
.click(Selector('div[title="Logout"]'))
.expect(Selector(".input-name input").visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
await t.navigateTo("/settings");
await t
.expect(Selector(".input-name input").visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
});
//TODO test all pages not accessible while logged out
test.meta("testID", "authentication-002")("Login with wrong credentials", async (t) => {
await page.login("wrong", "photoprism");
await t
.navigateTo("/favorites")
.expect(Selector(".input-name input").visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
await page.login("admin", "abcdefg");
await t
.navigateTo("/archive")
.expect(Selector(".input-name input").visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
});
test.meta("testID", "authentication-003")("Change password", async (t) => {
await page.login("admin", "photoprism");
await t.expect(Selector(".input-search input").visible).ok();
await page.openNav();
await t.expect(Selector(".input-search input", { timeout: 15000 }).visible).ok();
await menu.openPage("profile");
await t
.click(Selector(".p-profile"))
.typeText(Selector(".input-current-password input"), "wrong", { replace: true })
.typeText(Selector(".input-new-password input"), "photoprism", { replace: true })
.expect(Selector(".action-confirm").hasAttribute("disabled", "disabled"))
.ok()
.typeText(Selector(".input-retype-password input"), "photoprism", { replace: true })
.expect(Selector(".action-confirm").hasAttribute("disabled", "disabled"))
.notOk()
.click(".action-confirm")
.typeText(Selector(".input-current-password input"), "photoprism", { replace: true })
.typeText(Selector(".input-new-password input"), "photoprism123", { replace: true })
.expect(Selector(".action-confirm").hasAttribute("disabled", "disabled"))
.ok()
.typeText(Selector(".input-retype-password input"), "photoprism123", { replace: true })
.expect(Selector(".action-confirm").hasAttribute("disabled", "disabled"))
.notOk()
.click(".action-confirm");
await page.openNav();
await t.click(Selector('div[title="Logout"]'));
.typeText(account.currentPassword, "wrong", { replace: true })
.typeText(account.newPassword, "photoprism", { replace: true });
await t.expect(account.confirm.hasAttribute("disabled", "disabled")).ok();
await t.typeText(account.retypePassword, "photoprism", { replace: true });
await t.expect(account.confirm.hasAttribute("disabled", "disabled")).notOk();
await t
.click(account.confirm)
.typeText(account.currentPassword, "photoprism", { replace: true })
.typeText(account.newPassword, "photoprism123", { replace: true });
await t.expect(account.confirm.hasAttribute("disabled", "disabled")).ok();
await t.typeText(account.retypePassword, "photoprism123", { replace: true });
await t.expect(account.confirm.hasAttribute("disabled", "disabled")).notOk();
await t.click(account.confirm);
await page.logout();
if (t.browser.platform === "mobile") {
await t.wait(7000);
}
await page.login("admin", "photoprism");
await t.navigateTo("/archive");
await t
.navigateTo("/archive")
.expect(Selector(".input-name input", { timeout: 7000 }).visible)
.expect(page.nameInput.visible)
.ok()
.expect(Selector(".input-search input").visible)
.notOk();
await page.login("admin", "photoprism123");
await t.expect(Selector(".input-search input").visible).ok();
await page.openNav();
await menu.openPage("profile");
await t
.click(Selector(".p-profile", { timeout: 7000 }))
.typeText(Selector(".input-current-password input"), "photoprism123", { replace: true })
.typeText(Selector(".input-new-password input"), "photoprism", { replace: true })
.typeText(Selector(".input-retype-password input"), "photoprism", { replace: true })
.click(".action-confirm");
await page.openNav();
await t.click(Selector('div[title="Logout"]'));
.typeText(account.currentPassword, "photoprism123", { replace: true })
.typeText(account.newPassword, "photoprism", { replace: true })
.typeText(account.retypePassword, "photoprism", { replace: true })
.click(account.confirm);
await page.logout();
await page.login("admin", "photoprism");
await t.expect(Selector(".input-search input").visible).ok();
await page.openNav();
await t.click(Selector('div[title="Logout"]'));
await page.logout();
});

View file

@ -5,13 +5,15 @@ 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 PhotoViewer from "../page-model/photoviewer";
import PhotoEdit from "../page-model/photo-edit";
import Page from "../page-model/page";
import Settings from "../page-model/settings";
import Library from "../page-model/library";
import AlbumDialog from "../page-model/dialog-album";
fixture`Test member role`.page`${testcafeconfig.url}`;
@ -19,35 +21,50 @@ const menu = new Menu();
const photo = new Photo();
const toolbar = new Toolbar();
const contextmenu = new ContextMenu();
const photoviews = new PhotoViews();
const label = new Label();
const album = new Album();
const subject = new Subject();
const photoviewer = new PhotoViewer();
const photoedit = new PhotoEdit();
const page = new Page();
const settings = new Settings();
const library = new Library();
const albumdialog = new AlbumDialog();
const getLocation = ClientFunction(() => document.location.href);
test.meta("testID", "member-role-001")("No access to settings", async (t) => {
await page.login("member", "passwdmember");
await menu.checkMenuItemAvailability("settings", false);
await t.navigateTo("/settings");
await t
.expect(Selector(".input-language input", { timeout: 8000 }).visible)
.expect(settings.languageInput.visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok()
.navigateTo("/settings/library")
.ok();
await t.navigateTo("/settings/library");
await t
.expect(Selector("form.p-form-settings").visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok()
.navigateTo("/settings/advanced")
.ok();
await t.navigateTo("/settings/advanced");
await t
.expect(Selector("label").withText("Read-Only Mode").visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok()
.navigateTo("/settings/sync")
.ok();
await t.navigateTo("/settings/sync");
await t
.expect(Selector("div.p-accounts-list").visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
@ -60,12 +77,17 @@ test.meta("testID", "member-role-002")("No access to archive", async (t) => {
await t.wait(5000);
}
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("archive", false);
await t.navigateTo("/archive");
await photo.checkPhotoVisibility("pqnahct2mvee8sr4", false);
if (t.browser.platform === "mobile") {
await t.wait(5000);
}
const PhotoCountArchive = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).eql(PhotoCountArchive);
});
@ -76,13 +98,18 @@ test.meta("testID", "member-role-003")("No access to review", async (t) => {
await t.wait(5000);
}
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("review", false);
await t.navigateTo("/review");
await photo.checkPhotoVisibility("pqzuein2pdcg1kc7", false);
if (t.browser.platform === "mobile") {
await t.wait(5000);
}
const PhotoCountReview = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).eql(PhotoCountReview);
});
@ -92,13 +119,18 @@ test.meta("testID", "member-role-004")("No access to private", async (t) => {
await t.wait(5000);
}
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("private", false);
await t.navigateTo("/private");
await photo.checkPhotoVisibility("pqmxlquf9tbc8mk2", false);
if (t.browser.platform === "mobile") {
await t.wait(5000);
}
const PhotoCountPrivate = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).eql(PhotoCountPrivate);
});
@ -108,40 +140,55 @@ test.meta("testID", "member-role-005")("No access to library", async (t) => {
await t.wait(5000);
}
const PhotoCountBrowse = await photo.getPhotoCount("all");
await menu.checkMenuItemAvailability("library", false);
await t.navigateTo("/library");
await t
.expect(Selector(".input-index-folder input").visible)
.expect(library.indexFolderSelect.visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok()
.navigateTo("/library/import")
.expect(Selector(".input-import-folder input").visible)
.ok();
await t.navigateTo("/library/import");
await t
.expect(library.openImportFolderSelect.visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok()
.navigateTo("/library/logs")
.ok();
await t.navigateTo("/library/logs");
await t
.expect(Selector("p.p-log-message").visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok();
await menu.checkMenuItemAvailability("originals", false);
await t.navigateTo("/library/files");
await t
.navigateTo("/library/files")
.expect(Selector("div.p-page-files").visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
.ok();
await menu.checkMenuItemAvailability("hidden", false);
await t.navigateTo("/library/hidden");
if (t.browser.platform === "mobile") {
await t.wait(5000);
}
const PhotoCountHidden = await photo.getPhotoCount("all");
await t.expect(PhotoCountBrowse).eql(PhotoCountHidden);
await menu.checkMenuItemAvailability("errors", false);
await t.navigateTo("/library/errors");
await t
.navigateTo("/library/errors")
.expect(Selector("div.p-page-errors").visible)
.notOk()
.expect(Selector("div.p-page-photos").visible)
@ -158,29 +205,38 @@ test.meta("testID", "member-role-006")(
const PhotoCountBrowse = await photo.getPhotoCount("all");
await toolbar.search("private:true");
const PhotoCountPrivate = await photo.getPhotoCount("all");
await t.expect(PhotoCountPrivate).eql(0);
await photo.checkPhotoVisibility("pqmxlquf9tbc8mk2", false);
await toolbar.search("archived:true");
const PhotoCountArchive = await photo.getPhotoCount("all");
await t.expect(PhotoCountArchive).eql(0);
await photo.checkPhotoVisibility("pqnahct2mvee8sr4", false);
await toolbar.search("quality:0");
if (t.browser.platform === "mobile") {
await t.wait(5000);
}
const PhotoCountReview = await photo.getPhotoCount("all");
await t.expect(PhotoCountReview).gte(PhotoCountBrowse);
await photo.checkPhotoVisibility("pqzuein2pdcg1kc7", true);
await menu.openPage("places");
await t
.expect(Selector("#map").exists, { timeout: 15000 })
.ok()
.expect(Selector("div.p-map-control").visible)
.ok()
.wait(5000);
await t
.typeText(Selector('input[aria-label="Search"]'), "oaxaca", { replace: true })
.pressKey("enter");
await t
.expect(Selector("div.p-map-control").visible)
.ok()
@ -191,9 +247,11 @@ test.meta("testID", "member-role-006")(
.notOk()
.expect(Selector('div[title="Viewpoint / Mexico / 2018"]').visible)
.notOk();
await t
.typeText(Selector('input[aria-label="Search"]'), "canada", { replace: true })
.pressKey("enter");
await t
.expect(Selector("div.p-map-control").visible)
.ok()
@ -240,56 +298,72 @@ test.meta("testID", "member-role-007")("No upload functionality", async (t) => {
test.meta("testID", "member-role-008")("Member cannot like photos", async (t) => {
await page.login("member", "passwdmember");
await t.wait(5000);
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
const SecondPhoto = await photo.getNthPhotoUid("all", 1);
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
const SecondPhotoUid = await photo.getNthPhotoUid("all", 1);
await menu.openPage("favorites");
const FirstFavorite = await photo.getNthPhotoUid("image", 0);
await photo.checkHoverActionState("uid", FirstFavorite, "favorite", true);
await photo.triggerHoverAction("uid", FirstFavorite, "favorite");
await photo.checkHoverActionState("uid", FirstFavorite, "favorite", true);
await t
.expect(Selector("div").withAttribute("data-uid", FirstPhoto).exists, { timeout: 5000 })
.notOk()
.expect(Selector("div").withAttribute("data-uid", SecondPhoto).exists, { timeout: 5000 })
.notOk();
const FirstFavoriteUid = await photo.getNthPhotoUid("image", 0);
await photo.checkHoverActionState("uid", FirstFavoriteUid, "favorite", true);
await photo.triggerHoverAction("uid", FirstFavoriteUid, "favorite");
await photo.checkHoverActionState("uid", FirstFavoriteUid, "favorite", true);
await photo.checkPhotoVisibility(FirstPhotoUid, false);
await photo.checkPhotoVisibility(SecondPhotoUid, false);
await menu.openPage("browse");
await photoviewer.openPhotoViewer("uid", FirstPhoto);
await t.expect(Selector("#photo-viewer").visible).ok();
await photoviewer.openPhotoViewer("uid", FirstPhotoUid);
await photoviewer.checkPhotoViewerActionAvailability("like", false);
await photoviewer.checkPhotoViewerActionAvailability("close", true);
await photoviewer.triggerPhotoViewerAction("close");
await t.wait(5000).click(Selector(".p-expand-search", { timeout: 10000 }));
await toolbar.setFilter("view", "Cards");
await photo.checkHoverActionState("uid", FirstPhoto, "favorite", false);
await photo.triggerHoverAction("uid", FirstPhoto, "favorite");
await photo.checkHoverActionState("uid", FirstPhoto, "favorite", false);
await photo.selectPhotoFromUID(SecondPhoto);
await contextmenu.triggerContextMenuAction("edit", "", "");
await t
.click("#tab-info")
.expect(Selector(".input-favorite input").hasAttribute("disabled"))
.ok();
await photo.checkHoverActionState("uid", FirstPhotoUid, "favorite", false);
await photo.triggerHoverAction("uid", FirstPhotoUid, "favorite");
await photo.checkHoverActionState("uid", FirstPhotoUid, "favorite", false);
await photo.selectPhotoFromUID(SecondPhotoUid);
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.infoTab);
await t.expect(Selector(".input-favorite input").hasAttribute("disabled")).ok();
await photoedit.turnSwitchOn("favorite");
await t.click(Selector(".action-close"));
await contextmenu.clearSelection();
await photo.checkHoverActionState("uid", SecondPhoto, "favorite", false);
await photo.checkHoverActionState("uid", SecondPhotoUid, "favorite", false);
await menu.openPage("browse");
await toolbar.setFilter("view", "Mosaic");
await photo.checkHoverActionState("uid", FirstPhoto, "favorite", false);
await photo.triggerHoverAction("uid", FirstPhoto, "favorite");
await photo.checkHoverActionState("uid", FirstPhoto, "favorite", false);
await photo.checkHoverActionState("uid", FirstPhotoUid, "favorite", false);
await photo.triggerHoverAction("uid", FirstPhotoUid, "favorite");
await photo.checkHoverActionState("uid", FirstPhotoUid, "favorite", false);
await toolbar.setFilter("view", "List");
await photo.checkListViewActionAvailability("like", true);
await photo.triggerListViewActions("nth", 0, "like");
await toolbar.setFilter("view", "Cards");
await photo.checkHoverActionState("uid", FirstPhoto, "favorite", false);
await photo.checkHoverActionState("uid", FirstPhotoUid, "favorite", false);
await menu.openPage("albums");
await t.click(Selector("a.is-album").nth(0));
await toolbar.triggerToolbarAction("list-view", "");
await album.openNthAlbum(0);
await toolbar.triggerToolbarAction("list-view");
if (t.browser.platform === "mobile") {
await toolbar.triggerToolbarAction("list-view", "");
await toolbar.triggerToolbarAction("list-view");
}
await photo.checkListViewActionAvailability("like", true);
});
@ -297,30 +371,39 @@ test.meta("testID", "member-role-009")(
"Member cannot private, archive, share, add/remove to album",
async (t) => {
await page.login("member", "passwdmember");
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhoto);
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhotoUid);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("archive", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.clearSelection();
await toolbar.setFilter("view", "List");
await photo.checkListViewActionAvailability("private", true);
await menu.openPage("albums");
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", false);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("remove", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.clearSelection();
await toolbar.triggerToolbarAction("list-view", "");
await toolbar.triggerToolbarAction("list-view");
if (t.browser.platform === "mobile") {
await toolbar.triggerToolbarAction("list-view", "");
await toolbar.triggerToolbarAction("list-view");
}
await photo.checkListViewActionAvailability("private", true);
}
);
@ -329,112 +412,120 @@ test.meta("testID", "member-role-010")("Member cannot approve low quality photos
await page.login("member", "passwdmember");
await toolbar.search('quality:0 name:"photos-013_1"');
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.triggerContextMenuAction("edit", "", "");
await t.expect(Selector("button.action-approve").visible).notOk();
await contextmenu.triggerContextMenuAction("edit", "");
await t.expect(photoedit.detailsApprove.visible).notOk();
});
test.meta("testID", "member-role-011")("Edit dialog is read only for member", async (t) => {
await page.login("member", "passwdmember");
await toolbar.search("faces:new");
//details
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhoto);
await contextmenu.triggerContextMenuAction("edit", "", "");
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhotoUid);
await contextmenu.triggerContextMenuAction("edit", "");
await t
.expect(Selector(".input-title input").hasAttribute("disabled"))
.expect(photoedit.title.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-local-time input").hasAttribute("disabled"))
.expect(photoedit.localTime.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-day input").hasAttribute("disabled"))
.expect(photoedit.day.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-month input").hasAttribute("disabled"))
.expect(photoedit.month.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-year input").hasAttribute("disabled"))
.expect(photoedit.year.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-timezone input").hasAttribute("disabled"))
.expect(photoedit.timezone.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-latitude input").hasAttribute("disabled"))
.expect(photoedit.latitude.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-longitude input").hasAttribute("disabled"))
.expect(photoedit.longitude.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-altitude input").hasAttribute("disabled"))
.expect(photoedit.altitude.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-country input").hasAttribute("disabled"))
.expect(photoedit.country.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-camera input").hasAttribute("disabled"))
.expect(photoedit.camera.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-iso input").hasAttribute("disabled"))
.expect(photoedit.iso.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-exposure input").hasAttribute("disabled"))
.expect(photoedit.exposure.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-lens input").hasAttribute("disabled"))
.expect(photoedit.lens.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-fnumber input").hasAttribute("disabled"))
.expect(photoedit.fnumber.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-focal-length input").hasAttribute("disabled"))
.expect(photoedit.focallength.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-subject textarea").hasAttribute("disabled"))
.expect(photoedit.subject.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-artist input").hasAttribute("disabled"))
.expect(photoedit.artist.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-copyright input").hasAttribute("disabled"))
.expect(photoedit.copyright.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-license textarea").hasAttribute("disabled"))
.expect(photoedit.license.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-description textarea").hasAttribute("disabled"))
.expect(photoedit.description.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-keywords textarea").hasAttribute("disabled"))
.expect(photoedit.keywords.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-notes textarea").hasAttribute("disabled"))
.expect(photoedit.notes.hasAttribute("disabled"))
.ok()
.expect(Selector("button.action-apply").visible)
.expect(photoedit.detailsApply.visible)
.notOk();
if (t.browser.platform !== "mobile") {
await t.expect(Selector("button.action-done").visible).notOk();
await t.expect(photoedit.detailsDone.visible).notOk();
}
//labels
await t.click(photoedit.labelsTab);
await t
.click(Selector("#tab-labels"))
.expect(Selector("button.action-remove").hasAttribute("disabled"))
.expect(photoedit.removeLabel.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-label input").exists)
.expect(photoedit.inputLabelName.exists)
.notOk()
.expect(Selector("button.p-photo-label-add").exists)
.notOk()
.click(Selector("div.p-inline-edit"))
.expect(Selector(".input-rename input").exists)
.expect(photoedit.addLabel.exists)
.notOk();
//people
await t.click(photoedit.openInlineEdit);
await t.expect(photoedit.inputLabelRename.exists).notOk();
await t.click(photoedit.peopleTab);
await t
.click(Selector("#tab-people"))
.expect(Selector(".input-name input").hasAttribute("disabled"))
.expect(photoedit.inputName.hasAttribute("disabled"))
.ok()
.expect(Selector("button.input-reject").exists)
.expect(photoedit.removeMarker.exists)
.notOk();
//info
await t.click(photoedit.infoTab);
await t
.click(Selector("#tab-info"))
.expect(Selector(".input-favorite input").hasAttribute("disabled"))
.expect(photoedit.favoriteInput.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-private input").hasAttribute("disabled"))
.expect(photoedit.privateInput.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-scan input").hasAttribute("disabled"))
.expect(photoedit.scanInput.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-panorama input").hasAttribute("disabled"))
.expect(photoedit.panoramaInput.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-stackable input").hasAttribute("disabled"))
.expect(photoedit.stackableInput.hasAttribute("disabled"))
.ok()
.expect(Selector(".input-type input").hasAttribute("disabled"))
.expect(photoedit.typeInput.hasAttribute("disabled"))
.ok();
});
test.meta("testID", "member-role-012")("No edit album functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("albums");
await toolbar.checkToolbarActionAvailability("add", false);
await t.expect(Selector("a.is-album button.action-share").visible).notOk();
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 1, "share", false);
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("clone", false);
@ -442,24 +533,26 @@ test.meta("testID", "member-role-012")("No edit album functionality", async (t)
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.notOk();
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).notOk();
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", false);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
@ -469,9 +562,12 @@ test.meta("testID", "member-role-012")("No edit album functionality", async (t)
test.meta("testID", "member-role-013")("No edit moment functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("moments");
await t.expect(Selector("a.is-album button.action-share").visible).notOk();
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", false);
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("clone", false);
@ -479,24 +575,26 @@ test.meta("testID", "member-role-013")("No edit moment functionality", async (t)
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.notOk();
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).notOk();
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", false);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
@ -506,9 +604,12 @@ test.meta("testID", "member-role-013")("No edit moment functionality", async (t)
test.meta("testID", "member-role-014")("No edit state functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("states");
await t.expect(Selector("a.is-album button.action-share").visible).notOk();
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", false);
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("clone", false);
@ -516,24 +617,26 @@ test.meta("testID", "member-role-014")("No edit state functionality", async (t)
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.notOk();
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).notOk();
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", false);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
@ -543,9 +646,12 @@ test.meta("testID", "member-role-014")("No edit state functionality", async (t)
test.meta("testID", "member-role-015")("No edit calendar functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("calendar");
await t.expect(Selector("a.is-album button.action-share").visible).notOk();
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", false);
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("clone", false);
@ -553,24 +659,26 @@ test.meta("testID", "member-role-015")("No edit calendar functionality", async (
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.notOk();
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).notOk();
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", false);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
@ -580,9 +688,12 @@ test.meta("testID", "member-role-015")("No edit calendar functionality", async (
test.meta("testID", "member-role-016")("No edit folder functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("folders");
await t.expect(Selector("a.is-album button.action-share").visible).notOk();
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbum);
await album.checkHoverActionAvailability("nth", 0, "share", false);
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.selectAlbumFromUID(FirstAlbumUid);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("clone", false);
@ -590,24 +701,27 @@ test.meta("testID", "member-role-016")("No edit folder functionality", async (t)
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await t
.click(page.cardTitle)
.expect(Selector(".input-description textarea").visible)
.notOk();
if (await Selector(`a.uid-${FirstAlbum}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", true);
await t.click(page.cardTitle);
await t.expect(albumdialog.description.visible).notOk();
if (await Selector(`a.uid-${FirstAlbumUid}`).hasClass("is-favorite")) {
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", true);
} else {
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbum, "favorite");
await album.checkHoverActionState("uid", FirstAlbum, "favorite", false);
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
await album.triggerHoverAction("uid", FirstAlbumUid, "favorite");
await album.checkHoverActionState("uid", FirstAlbumUid, "favorite", false);
}
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", false);
await photo.toggleSelectNthPhoto(0, "all");
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
@ -617,15 +731,20 @@ test.meta("testID", "member-role-016")("No edit folder functionality", async (t)
test.meta("testID", "member-role-017")("No edit labels functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("labels");
const FirstLabel = await label.getNthLabeltUid(0);
await label.checkHoverActionState("uid", FirstLabel, "favorite", false);
await label.triggerHoverAction("uid", FirstLabel, "favorite");
await label.checkHoverActionState("uid", FirstLabel, "favorite", false);
await t
.click(Selector(`a.uid-${FirstLabel} div.inline-edit`))
.expect(Selector(".input-rename input").visible)
.notOk();
await label.selectLabelFromUID(FirstLabel);
const FirstLabelUid = await label.getNthLabeltUid(0);
await label.checkHoverActionState("uid", FirstLabelUid, "favorite", false);
await label.triggerHoverAction("uid", FirstLabelUid, "favorite");
await label.checkHoverActionState("uid", FirstLabelUid, "favorite", false);
await t.click(Selector(`a.uid-${FirstLabelUid} div.inline-edit`));
await t.expect(photoedit.inputLabelRename.visible).notOk();
await label.selectLabelFromUID(FirstLabelUid);
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.checkContextMenuActionAvailability("album", false);
});
@ -633,72 +752,81 @@ test.meta("testID", "member-role-017")("No edit labels functionality", async (t)
test.meta("testID", "member-role-018")("No unstack, change primary actions", async (t) => {
await page.login("member", "passwdmember");
await toolbar.search("stack:true");
//details
const FirstPhoto = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhoto);
await contextmenu.triggerContextMenuAction("edit", "", "");
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
await photo.selectPhotoFromUID(FirstPhotoUid);
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.filesTab);
await t
.click(Selector("#tab-files"))
.expect(Selector("button.action-download").visible)
.expect(photoedit.downloadFile.visible)
.ok()
.expect(Selector("button.action-download").hasAttribute("disabled"))
.notOk()
.click(Selector("li.v-expansion-panel__container").nth(1))
.expect(Selector("button.action-download").visible)
.expect(photoedit.downloadFile.hasAttribute("disabled"))
.notOk();
await t.click(photoedit.toggleExpandFile.nth(1));
await t
.expect(photoedit.downloadFile.visible)
.ok()
.expect(Selector("button.action-download").hasAttribute("disabled"))
.expect(photoedit.downloadFile.hasAttribute("disabled"))
.notOk()
.expect(Selector("button.action-unstack").visible)
.expect(photoedit.unstackFile.visible)
.notOk()
.expect(Selector("button.action-primary").visible)
.expect(photoedit.makeFilePrimary.visible)
.notOk()
.expect(Selector("button.action-delete").visible)
.expect(photoedit.deleteFile.visible)
.notOk();
});
test.meta("testID", "member-role-019")("No edit people functionality", async (t) => {
await page.login("member", "passwdmember");
await menu.openPage("people");
await toolbar.checkToolbarActionAvailability("show-hidden", false);
await toolbar.checkToolbarActionAvailability("upload", false);
await subject.checkSubjectVisibility("name", "Otto Visible", true);
await subject.checkSubjectVisibility("name", "Monika Hide", false);
await t
.expect(Selector("#tab-people_faces > a").exists)
.notOk()
.click(Selector("a div.v-card__title").nth(0))
.expect(Selector("div.input-rename input").visible)
.notOk();
await t.expect(subject.newTab.exists).notOk();
await t.click(Selector("a div.v-card__title").nth(0));
await t.expect(Selector("div.input-rename input").visible).notOk();
await subject.checkHoverActionAvailability("nth", 0, "hidden", false);
await subject.toggleSelectNthSubject(0);
await contextmenu.checkContextMenuActionAvailability("album", "false");
await contextmenu.checkContextMenuActionAvailability("download", "true");
await contextmenu.clearSelection();
const FirstSubject = subject.getNthSubjectUid(0);
if (await Selector(`a.uid-${FirstSubject}`).hasClass("is-favorite")) {
await subject.checkHoverActionState("uid", FirstSubject, "favorite", true);
await subject.triggerHoverAction("uid", FirstSubject, "favorite");
await subject.checkHoverActionState("uid", FirstSubject, "favorite", true);
const FirstSubjectUid = subject.getNthSubjectUid(0);
if (await Selector(`a.uid-${FirstSubjectUid}`).hasClass("is-favorite")) {
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", true);
await subject.triggerHoverAction("uid", FirstSubjectUid, "favorite");
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", true);
} else {
await subject.checkHoverActionState("uid", FirstSubject, "favorite", false);
await subject.triggerHoverAction("uid", FirstSubject, "favorite");
await subject.checkHoverActionState("uid", FirstSubject, "favorite", false);
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", false);
await subject.triggerHoverAction("uid", FirstSubjectUid, "favorite");
await subject.checkHoverActionState("uid", FirstSubjectUid, "favorite", false);
}
await subject.openNthSubject(0);
await photo.toggleSelectNthPhoto(0);
await contextmenu.triggerContextMenuAction("edit", "", "");
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.peopleTab);
await t
.click(Selector("#tab-people"))
.expect(Selector(".input-name input").hasAttribute("disabled"))
.expect(photoedit.inputName.hasAttribute("disabled"))
.ok()
.expect(Selector("div.v-input__icon--clear > i").hasClass("v-icon--disabled"))
.ok()
.navigateTo("/people/new")
.expect(Selector("div.is-face").visible)
.notOk()
.expect(Selector("#tab-people_faces > a").exists)
.notOk()
.navigateTo("/people?hidden=yes&order=relevance")
.expect(Selector("a.is-subject").visible)
.notOk();
.expect(photoedit.rejectName.hasClass("v-icon--disabled"))
.ok();
await t.navigateTo("/people/new");
await t.expect(Selector("div.is-face").visible).notOk().expect(subject.newTab.exists).notOk();
await t.navigateTo("/people?hidden=yes&order=relevance");
await t.expect(Selector("a.is-subject").visible).notOk();
});

View file

@ -5,10 +5,10 @@ import Page from "../page-model/page";
import Menu from "../page-model/menu";
import Toolbar from "../page-model/toolbar";
import ContextMenu from "../page-model/context-menu";
import PhotoViews from "../page-model/photo-views";
import Album from "../page-model/album";
import PhotoViewer from "../page-model/photoviewer";
import ShareDialog from "../page-model/dialog-share";
import Photo from "../page-model/photo";
fixture`Test link sharing`.page`${testcafeconfig.url}`.skip("Urls are not working anymore");
@ -16,10 +16,10 @@ const page = new Page();
const menu = new Menu();
const toolbar = new Toolbar();
const contextmenu = new ContextMenu();
const photoviews = new PhotoViews();
const album = new Album();
const photoviewer = new PhotoViewer();
const sharedialog = new ShareDialog();
const photo = new Photo();
//TODO merge with other sharing test
test.skip.meta("testID", "authentication-000")(
@ -32,10 +32,10 @@ test.skip.meta("testID", "authentication-000")(
test.skip.meta("testID", "sharing-001")("View shared albums", async (t) => {
await page.login("admin", "photoprism");
await menu.openPage("albums");
const FirstAlbum = await album.getNthAlbumUid("all", 0);
await album.triggerHoverAction("uid", FirstAlbum, "select");
const FirstAlbumUid = await album.getNthAlbumUid("all", 0);
await album.triggerHoverAction("uid", FirstAlbumUid, "select");
await contextmenu.checkContextMenuCount("1");
await contextmenu.triggerContextMenuAction("share", "", "");
await contextmenu.triggerContextMenuAction("share", "");
await t.click(sharedialog.expandLink.nth(0));
await t
.typeText(sharedialog.linkSecretInput, "secretForTesting", { replace: true })
@ -44,15 +44,17 @@ test.skip.meta("testID", "sharing-001")("View shared albums", async (t) => {
.click(sharedialog.dialogSave);
const Url = await sharedialog.linkUrl.value;
const Expire = await Selector("div.v-select__selections").innerText;
await t.expect(Url).contains("secretfortesting").expect(Expire).contains("After 1 day");
let url = Url.replace("2342", "2343");
await t.click(sharedialog.dialogClose);
await contextmenu.clearSelection();
await t.click(Selector(".nav-folders"));
const FirstFolder = await album.getNthAlbumUid("all", 0);
await album.triggerHoverAction("uid", FirstFolder, "select");
await menu.openPage("folders");
const FirstFolderUid = await album.getNthAlbumUid("all", 0);
await album.triggerHoverAction("uid", FirstFolderUid, "select");
await contextmenu.checkContextMenuCount("1");
await contextmenu.triggerContextMenuAction("share", "", "");
await contextmenu.triggerContextMenuAction("share", "");
await t.click(sharedialog.expandLink.nth(0));
await t
.typeText(sharedialog.linkSecretInput, "secretForTesting", { replace: true })
@ -62,50 +64,64 @@ test.skip.meta("testID", "sharing-001")("View shared albums", async (t) => {
.click(sharedialog.dialogSave);
await contextmenu.clearSelection();
await t.navigateTo(url);
await t
.expect(toolbar.toolbarTitle.withText("Christmas").visible)
.ok()
.click(Selector("button").withText("@photoprism_app"))
.expect(toolbar.toolbarTitle.withText("Albums").visible)
.ok();
const countAlbums = await album.getAlbumCount("all");
await t.expect(countAlbums).gte(40).useRole(Role.anonymous());
await t.expect(toolbar.toolbarTitle.withText("Christmas").visible).ok();
await t.click(Selector("button").withText("@photoprism_app"));
await t.expect(toolbar.toolbarTitle.withText("Albums").visible).ok();
const AlbumCount = await album.getAlbumCount("all");
await t.expect(AlbumCount).gte(40);
await t.useRole(Role.anonymous());
await t.navigateTo(url);
await t
.expect(toolbar.toolbarTitle.withText("Christmas").visible)
.ok()
.click(Selector("button").withText("@photoprism_app"))
.expect(toolbar.toolbarTitle.withText("Albums").visible)
.ok();
const countAlbumsAnonymous = await Selector("a.is-album").count;
await t.expect(countAlbumsAnonymous).eql(2);
await t.expect(toolbar.toolbarTitle.withText("Christmas").visible).ok();
await t.click(Selector("button").withText("@photoprism_app"));
await t.expect(toolbar.toolbarTitle.withText("Albums").visible).ok();
const AlbumCountAnonymous = await Selector("a.is-album").count;
await t.expect(AlbumCountAnonymous).eql(2);
await t.navigateTo("http://localhost:2343/browse");
await page.login("admin", "photoprism");
await menu.openPage("albums");
await album.openAlbumWithUid(FirstAlbum);
await toolbar.triggerToolbarAction("share", "");
await album.openAlbumWithUid(FirstAlbumUid);
await toolbar.triggerToolbarAction("share");
await t
.click(sharedialog.expandLink.nth(0))
.click(sharedialog.deleteLink)
.useRole(Role.anonymous())
.expect(Selector(".input-name input").visible)
.ok();
.useRole(Role.anonymous());
await t.expect(Selector(".input-name input").visible).ok();
await t.navigateTo("http://localhost:2343/s/secretfortesting");
await t.expect(toolbar.toolbarTitle.withText("Albums").visible).ok();
const countAlbumsAnonymousAfterDelete = await album.getAlbumCount("all");
await t.expect(countAlbumsAnonymousAfterDelete).eql(1);
const AlbumCountAnonymousAfterDelete = await album.getAlbumCount("all");
await t.expect(AlbumCountAnonymousAfterDelete).eql(1);
await t.navigateTo("http://localhost:2343/browse");
await page.login("admin", "photoprism");
await menu.openPage("folders");
await album.openAlbumWithUid(FirstFolder);
await toolbar.triggerToolbarAction("share", "");
await album.openAlbumWithUid(FirstFolderUid);
await toolbar.triggerToolbarAction("share");
await t
.click(sharedialog.expandLink.nth(0))
.click(sharedialog.deleteLink)
.useRole(Role.anonymous())
.expect(Selector(".input-name input").visible)
.ok();
.useRole(Role.anonymous());
await t.expect(Selector(".input-name input").visible).ok();
await t.navigateTo("http://localhost:2343/s/secretfortesting");
await t
.expect(toolbar.toolbarTitle.withText("Christmas").visible)
.notOk()
@ -117,32 +133,44 @@ test.skip.meta("testID", "sharing-001")("View shared albums", async (t) => {
test.skip.meta("testID", "sharing-002")("Verify anonymous user has limited options", async (t) => {
await t.navigateTo("http://localhost:2343/s/jxoux5ub1e/british-columbia-canada");
await t.expect(toolbar.toolbarTitle.withText("British Columbia").visible).ok();
await toolbar.checkToolbarActionAvailability("edit", false);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("upload", false);
await toolbar.checkToolbarActionAvailability("reload", true);
await toolbar.checkToolbarActionAvailability("download", true);
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("archive", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("album", false);
await contextmenu.clearSelection();
await t.expect(page.cardTitle.visible).notOk();
await photoviewer.openPhotoViewer("nth", 0);
await photoviewer.checkPhotoViewerActionAvailability("download", true);
await photoviewer.checkPhotoViewerActionAvailability("select", true);
await photoviewer.checkPhotoViewerActionAvailability("fullscreen", true);
await photoviewer.checkPhotoViewerActionAvailability("slideshow", true);
await photoviewer.checkPhotoViewerActionAvailability("like", false);
await photoviewer.checkPhotoViewerActionAvailability("edit", false);
await photoviewer.triggerPhotoViewerAction("close");
await photo.checkHoverActionAvailability("nth", 0, "favorite", false);
await photo.checkHoverActionAvailability("nth", 0, "select", true);
await toolbar.triggerToolbarAction("view-list", "");
await toolbar.triggerToolbarAction("view-list");
await t
.expect(Selector(`td button.input-private`).visible)
.notOk()
@ -151,8 +179,10 @@ test.skip.meta("testID", "sharing-002")("Verify anonymous user has limited optio
.click(Selector("button").withText("@photoprism_app"))
.expect(toolbar.toolbarTitle.withText("Albums").visible)
.ok();
const AlbumUid = await album.getNthAlbumUid("all", 0);
await album.triggerHoverAction("uid", AlbumUid, "select");
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.checkContextMenuActionAvailability("album", false);