Tests: Refactor acceptance tests

This commit is contained in:
theresa 2022-01-28 17:06:40 +01:00
parent 02ec17317f
commit 7f66c73506
3 changed files with 312 additions and 146 deletions

View file

@ -9,6 +9,7 @@ import Photo from "../../page-model/photo";
import PhotoEdit from "../../page-model/photo-edit";
import Album from "../../page-model/album";
import Settings from "../../page-model/settings";
import Library from "../../page-model/library";
fixture`Test settings`.page`${testcafeconfig.url}`;
@ -21,21 +22,271 @@ const photo = new Photo();
const photoedit = new PhotoEdit();
const album = new Album();
const settings = new Settings();
const library = new Library();
test.meta("testID", "settings-general-001").meta({ type: "smoke" })(
"Apply general Settings",
test.meta("testID", "settings-general-001").meta({ type: "smoke" })("Disable delete", async (t) => {
await menu.openPage("archive");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.clearSelection();
await menu.openPage("settings");
await t.click(settings.deleteCheckbox);
await menu.openPage("archive");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("restore", true);
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await menu.openPage("browse");
await toolbar.search("stack:true");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.filesTab);
await t.click(photoedit.toggleExpandFile.nth(1));
await t.expect(photoedit.deleteFile.visible).notOk();
await t.click(photoedit.dialogClose);
await contextmenu.clearSelection();
await menu.openPage("settings");
await t.click(settings.deleteCheckbox);
});
test.meta("testID", "settings-general-002").meta({ type: "smoke" })(
"Change language",
async (t) => {
await toolbar.checkToolbarActionAvailability("upload", true);
await t.expect(Selector(".nav-browse").innerText).contains("Search");
await t.expect(Selector(".nav-browse").innerText).contains("Search").navigateTo("/browse");
await menu.openPage("settings");
await t
.click(settings.languageInput)
.hover(Selector("div").withText("Deutsch").parent('div[role="listitem"]'))
.click(Selector("div").withText("Deutsch").parent('div[role="listitem"]'));
await t.eval(() => location.reload());
await t.expect(Selector(".nav-browse").innerText).contains("Suche");
await t
.click(settings.languageInput)
.hover(Selector("div").withText("English").parent('div[role="listitem"]'))
.click(Selector("div").withText("English").parent('div[role="listitem"]'));
await t.expect(Selector(".nav-browse").innerText).contains("Search");
}
);
test.meta("testID", "settings-general-003").meta({ type: "smoke" })(
"Disable pages: import, originals, logs, moments, places, library",
async (t) => {
await t.expect(page.cardLocation.exists).ok();
await menu.openPage("library");
await t
.expect(library.importTab.visible)
.ok()
.expect(library.logsTab.visible)
.ok()
.expect(library.indexTab.visible)
.ok();
await menu.checkMenuItemAvailability("originals", true);
await menu.checkMenuItemAvailability("folders", true);
await menu.checkMenuItemAvailability("moments", true);
await menu.checkMenuItemAvailability("places", true);
await menu.checkMenuItemAvailability("library", true);
await menu.openPage("settings");
await t
.click(settings.importCheckbox)
.click(settings.filesCheckbox)
.click(settings.momentsCheckbox)
.click(settings.logsCheckbox)
.click(settings.placesCheckbox);
await t.eval(() => location.reload());
await menu.openPage("browse");
await t.expect(page.cardLocation.exists).notOk();
await menu.openPage("library");
await t
.expect(library.importTab.visible)
.notOk()
.expect(library.logsTab.visible)
.notOk()
.expect(library.indexTab.visible)
.ok();
await menu.checkMenuItemAvailability("originals", false);
await menu.checkMenuItemAvailability("folders", true);
await menu.checkMenuItemAvailability("moments", false);
await menu.checkMenuItemAvailability("places", false);
await menu.checkMenuItemAvailability("library", true);
await menu.openPage("settings");
await t
.click(settings.importCheckbox)
.click(settings.filesCheckbox)
.click(settings.momentsCheckbox)
.click(settings.logsCheckbox)
.click(settings.placesCheckbox)
.click(settings.libraryCheckbox);
await menu.checkMenuItemAvailability("originals", false);
await menu.checkMenuItemAvailability("folders", true);
await menu.checkMenuItemAvailability("moments", true);
await menu.checkMenuItemAvailability("places", true);
await menu.checkMenuItemAvailability("library", false);
await t.click(settings.libraryCheckbox);
await menu.checkMenuItemAvailability("originals", true);
await menu.checkMenuItemAvailability("library", true);
}
);
test.meta("testID", "settings-general-004").meta({ type: "smoke" })(
"Disable people and labels",
async (t) => {
await t.click(page.cardTitle.nth(0));
await t.click(photoedit.labelsTab);
await t.expect(photoedit.addLabel.visible).ok();
await t.click(photoedit.peopleTab);
await t.expect(Selector("div.p-faces").visible).ok();
await t.click(photoedit.dialogClose);
await menu.checkMenuItemAvailability("people", true);
await menu.checkMenuItemAvailability("labels", true);
await menu.openPage("settings");
await t.click(settings.peopleCheckbox).click(settings.labelsCheckbox);
await t.eval(() => location.reload());
await menu.openPage("browse");
await t.click(page.cardTitle.nth(0));
await t.click(photoedit.labelsTab);
await t.expect(photoedit.addLabel.exists).notOk();
await t.click(photoedit.peopleTab);
await t.expect(Selector("div.p-faces ").exists).notOk();
await t.click(photoedit.dialogClose);
await menu.checkMenuItemAvailability("people", false);
await menu.checkMenuItemAvailability("labels", false);
await menu.openPage("settings");
await t.click(settings.peopleCheckbox).click(settings.labelsCheckbox);
await menu.checkMenuItemAvailability("people", true);
await menu.checkMenuItemAvailability("labels", true);
}
);
test.meta("testID", "settings-general-005").meta({ type: "smoke" })(
"Disable private, archive and quality filter",
async (t) => {
await menu.checkMenuItemAvailability("private", true);
await menu.checkMenuItemAvailability("archive", true);
await menu.checkMenuItemAvailability("review", true);
await toolbar.search("photo:true stack:true");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("archive", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.infoTab);
await photoedit.checkFieldDisabled(photoedit.privateInput, false);
await t.click(photoedit.dialogClose);
await contextmenu.clearSelection();
await toolbar.search("Viewpoint / Mexico / 2017");
await photo.checkPhotoVisibility("pqmxlr7188hz4bih", false);
await toolbar.search("Truck / Vancouver / 2019");
await photo.checkPhotoVisibility("pqmxlr0kg161o9ek", false);
await toolbar.search("Archive / 2020");
await photo.checkPhotoVisibility("pqnah1k2frui6p63", false);
await menu.openPage("settings");
await t
.click(settings.archiveCheckbox)
.click(settings.privateCheckbox)
.click(Selector(settings.libraryTab))
.click(settings.reviewCheckbox);
await t.eval(() => location.reload());
await menu.checkMenuItemAvailability("private", false);
await menu.checkMenuItemAvailability("archive", false);
await menu.checkMenuItemAvailability("review", false);
await menu.openPage("browse");
await toolbar.search("photo:true");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("archive", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.triggerContextMenuAction("edit", "");
await t.click(photoedit.infoTab);
//await photoedit.checkFieldDisabled(photoedit.privateInput, true);
await t.click(photoedit.dialogClose);
await contextmenu.clearSelection();
await toolbar.search("Viewpoint / Mexico / 2017");
await photo.checkPhotoVisibility("pqmxlr7188hz4bih", true);
await toolbar.search("Truck / Vancouver / 2019");
await photo.checkPhotoVisibility("pqmxlr0kg161o9ek", false);
await toolbar.search("Archive / 2020");
await photo.checkPhotoVisibility("pqnah1k2frui6p63", true);
await menu.openPage("settings");
await t
.click(settings.privateCheckbox)
.click(settings.archiveCheckbox)
.click(Selector(settings.libraryTab))
.click(settings.reviewCheckbox);
await menu.checkMenuItemAvailability("archive", true);
await menu.checkMenuItemAvailability("private", true);
await menu.checkMenuItemAvailability("review", true);
}
);
test.meta("testID", "settings-general-006").meta({ type: "smoke" })(
"Disable upload, download, edit and share",
async (t) => {
await toolbar.checkToolbarActionAvailability("upload", true);
await toolbar.search("photo:true stack:true");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("download", true);
await contextmenu.checkContextMenuActionAvailability("share", true);
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("private", true);
await contextmenu.triggerContextMenuAction("edit", "");
await photoedit.checkAllDetailsFieldsDisabled(false);
await t.expect(photoedit.infoTab.visible).ok();
await t.click(photoedit.filesTab);
await t
@ -50,119 +301,94 @@ test.meta("testID", "settings-general-001").meta({ type: "smoke" })(
await contextmenu.clearSelection();
await photoviewer.openPhotoViewer("nth", 0);
await photoviewer.checkPhotoViewerActionAvailability("download", true);
await photoviewer.triggerPhotoViewerAction("close");
await t
.expect(page.cardLocation.visible)
.ok()
.click(page.cardTitle.nth(0))
.expect(Selector(".input-title input", { timeout: 8000 }).hasAttribute("disabled"))
.notOk();
await t.click(photoedit.labelsTab);
await t.expect(photoedit.addLabel.visible).ok();
await t.click(photoedit.detailsTab).click(photoedit.dialogClose);
await menu.openPage("library");
await t
.expect(Selector("#tab-library-import a").visible)
.ok()
.expect(Selector("#tab-library-logs a").visible)
.ok();
await menu.openPage("archive");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.clearSelection();
await menu.checkMenuItemAvailability("archive", true);
await menu.checkMenuItemAvailability("review", true);
await menu.checkMenuItemAvailability("originals", true);
await menu.checkMenuItemAvailability("folders", true);
await menu.checkMenuItemAvailability("moments", true);
await menu.checkMenuItemAvailability("people", true);
await menu.checkMenuItemAvailability("labels", true);
await menu.checkMenuItemAvailability("places", true);
await menu.checkMenuItemAvailability("private", true);
await menu.openPage("settings");
await t
.click(settings.languageInput)
.hover(Selector("div").withText("Deutsch").parent('div[role="listitem"]'))
.click(Selector("div").withText("Deutsch").parent('div[role="listitem"]'))
.click(settings.uploadCheckbox)
.click(settings.downloadCheckbox)
.click(settings.importCheckbox)
.click(settings.archiveCheckbox)
.click(settings.editCheckbox)
.click(settings.filesCheckbox)
.click(settings.peopleCheckbox)
.click(settings.momentsCheckbox)
.click(settings.labelsCheckbox)
.click(settings.logsCheckbox)
.click(settings.shareCheckbox)
.click(settings.placesCheckbox)
.click(settings.deleteCheckbox)
.click(settings.privateCheckbox)
.click(Selector(settings.libraryTab))
.click(settings.reviewCheckbox);
.click(settings.shareCheckbox);
await t.eval(() => location.reload());
await t.navigateTo("/calendar");
await toolbar.checkToolbarActionAvailability("upload", false);
await album.checkHoverActionAvailability("nth", 2, "share", false);
await album.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("download", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.clearSelection();
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("upload", false);
await toolbar.checkToolbarActionAvailability("download", false);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", true);
await t.navigateTo("/folders");
await toolbar.checkToolbarActionAvailability("upload", false);
await album.checkHoverActionAvailability("nth", 0, "share", false);
await album.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("download", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.clearSelection();
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("upload", false);
await toolbar.checkToolbarActionAvailability("download", false);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", true);
await t.navigateTo("/albums");
await toolbar.checkToolbarActionAvailability("upload", false);
await album.checkHoverActionAvailability("nth", 0, "share", false);
await album.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("edit", true);
await contextmenu.checkContextMenuActionAvailability("delete", true);
await contextmenu.checkContextMenuActionAvailability("download", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.clearSelection();
await album.openNthAlbum(0);
await toolbar.checkToolbarActionAvailability("upload", false);
await toolbar.checkToolbarActionAvailability("download", false);
await toolbar.checkToolbarActionAvailability("share", false);
await toolbar.checkToolbarActionAvailability("edit", true);
await t.navigateTo("/browse");
await toolbar.checkToolbarActionAvailability("upload", false);
await t.expect(Selector(".nav-browse").innerText).contains("Suche");
await t.navigateTo("/browse");
await toolbar.checkToolbarActionAvailability("upload", false);
await toolbar.search("photo:true stack:true");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("download", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("private", false);
await contextmenu.checkContextMenuActionAvailability("archive", false);
await contextmenu.clearSelection();
await t.click(page.cardTitle.nth(0)).click(photoedit.filesTab);
await t.click(page.cardTitle.nth(0));
await photoedit.checkAllDetailsFieldsDisabled(true);
await t.expect(photoedit.infoTab.visible).notOk();
await t.click(photoedit.filesTab);
await t
.expect(photoedit.downloadFile.nth(0).visible)
@ -171,7 +397,7 @@ test.meta("testID", "settings-general-001").meta({ type: "smoke" })(
.expect(photoedit.downloadFile.nth(1).visible)
.notOk()
.expect(photoedit.deleteFile.visible)
.notOk();
.ok();
await t.click(photoedit.dialogClose);
await toolbar.search("photo:true");
@ -180,72 +406,11 @@ test.meta("testID", "settings-general-001").meta({ type: "smoke" })(
await photoviewer.checkPhotoViewerActionAvailability("edit", true);
await photoviewer.triggerPhotoViewerAction("close");
await t.expect(page.cardLocation.exists).notOk();
await t.click(page.cardTitle.nth(0));
await t
.expect(Selector(".input-title input").hasAttribute("disabled"))
.ok()
.expect(Selector(".input-latitude input").hasAttribute("disabled"))
.ok()
.expect(Selector(".input-timezone input").hasAttribute("disabled"))
.ok()
.expect(Selector(".input-country input").hasAttribute("disabled"))
.ok()
.expect(Selector(".input-description textarea").hasAttribute("disabled"))
.ok()
.expect(Selector(".input-keywords textarea").hasAttribute("disabled"))
.ok();
await t.click(photoedit.labelsTab);
await t.expect(photoedit.addLabel.exists).notOk();
await t.click(photoedit.dialogClose);
await menu.openPage("library");
await t
.expect(Selector("#tab-library-import a").exists)
.notOk()
.expect(Selector("#tab-library-logs a").exists)
.notOk();
await menu.checkMenuItemAvailability("archive", false);
await menu.checkMenuItemAvailability("review", false);
await menu.checkMenuItemAvailability("originals", false);
await menu.checkMenuItemAvailability("folders", true);
await menu.checkMenuItemAvailability("moments", false);
await menu.checkMenuItemAvailability("people", false);
await menu.checkMenuItemAvailability("labels", false);
await menu.checkMenuItemAvailability("places", false);
await menu.checkMenuItemAvailability("private", false);
await menu.openPage("settings");
await t
.click(settings.languageInput)
.hover(Selector("div").withText("English").parent('div[role="listitem"]'))
.click(Selector("div").withText("English").parent('div[role="listitem"]'))
.click(settings.uploadCheckbox)
.click(settings.downloadCheckbox)
.click(settings.importCheckbox)
.click(settings.archiveCheckbox)
.click(settings.editCheckbox)
.click(settings.filesCheckbox)
.click(settings.peopleCheckbox)
.click(settings.momentsCheckbox)
.click(settings.labelsCheckbox)
.click(settings.logsCheckbox)
.click(settings.shareCheckbox)
.click(settings.placesCheckbox)
.click(settings.privateCheckbox)
.click(settings.libraryTab)
.click(settings.reviewCheckbox);
await menu.openPage("archive");
await photo.triggerHoverAction("nth", 0, "select");
await contextmenu.checkContextMenuActionAvailability("restore", true);
await contextmenu.checkContextMenuActionAvailability("delete", false);
await contextmenu.clearSelection();
await menu.openPage("settings");
await t.click(settings.deleteCheckbox);
.click(settings.shareCheckbox);
}
);

View file

@ -2,23 +2,24 @@ import { Selector, t } from "testcafe";
export default class Page {
constructor() {
this.languageInput = Selector(".input-language input", { timeout: 5000 });
this.uploadCheckbox = Selector(".input-upload input", { timeout: 5000 });
this.downloadCheckbox = Selector(".input-download input", { timeout: 5000 });
this.importCheckbox = Selector(".input-import input", { timeout: 5000 });
this.archiveCheckbox = Selector(".input-archive input", { timeout: 5000 });
this.editCheckbox = Selector(".input-edit input", { timeout: 5000 });
this.filesCheckbox = Selector(".input-files input", { timeout: 5000 });
this.momentsCheckbox = Selector(".input-moments input", { timeout: 5000 });
this.labelsCheckbox = Selector(".input-labels input", { timeout: 5000 });
this.logsCheckbox = Selector(".input-logs input", { timeout: 5000 });
this.shareCheckbox = Selector(".input-share input", { timeout: 5000 });
this.placesCheckbox = Selector(".input-places input", { timeout: 5000 });
this.privateCheckbox = Selector(".input-private input", { timeout: 5000 });
this.peopleCheckbox = Selector(".input-people input", { timeout: 5000 });
this.deleteCheckbox = Selector(".input-delete input", { timeout: 5000 });
this.languageInput = Selector(".input-language input");
this.uploadCheckbox = Selector(".input-upload input");
this.downloadCheckbox = Selector(".input-download input");
this.importCheckbox = Selector(".input-import input");
this.archiveCheckbox = Selector('input[aria-label="Archive"]');
this.editCheckbox = Selector(".input-edit input");
this.filesCheckbox = Selector(".input-files input");
this.momentsCheckbox = Selector(".input-moments input");
this.labelsCheckbox = Selector(".input-labels input");
this.logsCheckbox = Selector(".input-logs input");
this.shareCheckbox = Selector(".input-share input");
this.placesCheckbox = Selector(".input-places input");
this.privateCheckbox = Selector('input[aria-label="Private"]');
this.peopleCheckbox = Selector(".input-people input");
this.deleteCheckbox = Selector(".input-delete input");
this.libraryCheckbox = Selector(".input-library input");
this.libraryTab = Selector("#tab-settings-library", { timeout: 15000 });
this.reviewCheckbox = Selector(".input-review input", { timeout: 5000 });
this.libraryTab = Selector("#tab-settings-library");
this.reviewCheckbox = Selector(".input-review input");
}
}

View file

@ -2,11 +2,11 @@ import { Selector, t } from "testcafe";
export default class Page {
constructor() {
this.view = Selector("div.p-view-select", { timeout: 15000 });
this.camera = Selector("div.p-camera-select", { timeout: 15000 });
this.countries = Selector("div.p-countries-select", { timeout: 15000 });
this.time = Selector("div.p-time-select", { timeout: 15000 });
this.search1 = Selector("div.input-search input", { timeout: 15000 });
this.view = Selector("div.p-view-select");
this.camera = Selector("div.p-camera-select");
this.countries = Selector("div.p-countries-select");
this.time = Selector("div.p-time-select");
this.search1 = Selector("div.input-search input");
this.toolbarDescription = Selector(".v-card__text").nth(0);
this.toolbarTitle = Selector("div.v-toolbar__title");
}