mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Tests: Improve acceptance tests
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
"quarantineMode": false,
|
"quarantineMode": false,
|
||||||
"selectorTimeout": 5000,
|
"selectorTimeout": 5000,
|
||||||
"hostname": "localhost",
|
"hostname": "localhost",
|
||||||
|
"disableNativeAutomation": "true",
|
||||||
"screenshots": {
|
"screenshots": {
|
||||||
"path": "tests/acceptance/screenshots",
|
"path": "tests/acceptance/screenshots",
|
||||||
"takeOnFails": true
|
"takeOnFails": true
|
||||||
|
|||||||
@@ -30,14 +30,14 @@ test.meta("testID", "settings-general-001").meta({ type: "short", mode: "auth" }
|
|||||||
"Common: Disable delete",
|
"Common: Disable delete",
|
||||||
async (t) => {
|
async (t) => {
|
||||||
await menu.openPage("archive");
|
await menu.openPage("archive");
|
||||||
await toolbar.checkToolbarActionAvailability("sweep", true);
|
await toolbar.checkToolbarActionAvailability("delete-all", true);
|
||||||
await photo.triggerHoverAction("nth", 0, "select");
|
await photo.triggerHoverAction("nth", 0, "select");
|
||||||
await contextmenu.checkContextMenuActionAvailability("delete", true);
|
await contextmenu.checkContextMenuActionAvailability("delete", true);
|
||||||
await contextmenu.clearSelection();
|
await contextmenu.clearSelection();
|
||||||
await menu.openPage("settings");
|
await menu.openPage("settings");
|
||||||
await t.click(settings.deleteCheckbox);
|
await t.click(settings.deleteCheckbox);
|
||||||
await menu.openPage("archive");
|
await menu.openPage("archive");
|
||||||
await toolbar.checkToolbarActionAvailability("sweep", false);
|
await toolbar.checkToolbarActionAvailability("delete-all", false);
|
||||||
|
|
||||||
await photo.triggerHoverAction("nth", 0, "select");
|
await photo.triggerHoverAction("nth", 0, "select");
|
||||||
|
|
||||||
@@ -304,7 +304,7 @@ test.meta("testID", "settings-general-005").meta({ type: "short", mode: "auth" }
|
|||||||
await photo.checkPhotoVisibility("pqnah1k2frui6p63", false);
|
await photo.checkPhotoVisibility("pqnah1k2frui6p63", false);
|
||||||
|
|
||||||
await t.navigateTo("/library/archive");
|
await t.navigateTo("/library/archive");
|
||||||
await toolbar.checkToolbarActionAvailability("sweep", true);
|
await toolbar.checkToolbarActionAvailability("delete-all", true);
|
||||||
|
|
||||||
await menu.openPage("settings");
|
await menu.openPage("settings");
|
||||||
await t
|
await t
|
||||||
@@ -345,7 +345,7 @@ test.meta("testID", "settings-general-005").meta({ type: "short", mode: "auth" }
|
|||||||
await photo.checkPhotoVisibility("pqnah1k2frui6p63", true);
|
await photo.checkPhotoVisibility("pqnah1k2frui6p63", true);
|
||||||
|
|
||||||
await t.navigateTo("/library/archive");
|
await t.navigateTo("/library/archive");
|
||||||
await toolbar.checkToolbarActionAvailability("sweep", false);
|
await toolbar.checkToolbarActionAvailability("delete-all", false);
|
||||||
|
|
||||||
await menu.openPage("settings");
|
await menu.openPage("settings");
|
||||||
await t
|
await t
|
||||||
|
|||||||
@@ -538,7 +538,7 @@ test.meta("testID", "photos-archive-private-005").meta({ type: "short", mode: "p
|
|||||||
"Common: Check delete all dialog",
|
"Common: Check delete all dialog",
|
||||||
async (t) => {
|
async (t) => {
|
||||||
await menu.openPage("archive");
|
await menu.openPage("archive");
|
||||||
await toolbar.triggerToolbarAction("sweep");
|
await toolbar.triggerToolbarAction("delete-all");
|
||||||
await t
|
await t
|
||||||
.expect(
|
.expect(
|
||||||
Selector("div").withText("Are you sure you want to delete all archived pictures?").visible
|
Selector("div").withText("Are you sure you want to delete all archived pictures?").visible
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import testcafeconfig from "../../testcafeconfig.json";
|
|||||||
import Menu from "../page-model/menu";
|
import Menu from "../page-model/menu";
|
||||||
import Places from "../page-model/places";
|
import Places from "../page-model/places";
|
||||||
import Photo from "../page-model/photo";
|
import Photo from "../page-model/photo";
|
||||||
|
import Toolbar from "../page-model/toolbar";
|
||||||
|
|
||||||
const getLocation = ClientFunction(() => document.location.href);
|
const getLocation = ClientFunction(() => document.location.href);
|
||||||
|
|
||||||
@@ -12,6 +13,7 @@ fixture`Search and open photo from places`.page`${testcafeconfig.url}`;
|
|||||||
const menu = new Menu();
|
const menu = new Menu();
|
||||||
const places = new Places();
|
const places = new Places();
|
||||||
const photo = new Photo();
|
const photo = new Photo();
|
||||||
|
const toolbar = new Toolbar();
|
||||||
|
|
||||||
test.meta("testID", "places-001").meta({ mode: "public" })("Common: Test places", async (t) => {
|
test.meta("testID", "places-001").meta({ mode: "public" })("Common: Test places", async (t) => {
|
||||||
await menu.openPage("places");
|
await menu.openPage("places");
|
||||||
@@ -39,11 +41,12 @@ test.meta("testID", "places-001").meta({ mode: "public" })("Common: Test places"
|
|||||||
const clusterCountAll = await Selector("div.cluster-marker").count;
|
const clusterCountAll = await Selector("div.cluster-marker").count;
|
||||||
|
|
||||||
await places.search("canada");
|
await places.search("canada");
|
||||||
await t.wait(8000);
|
|
||||||
await t.click(Selector("button.maplibregl-ctrl-zoom-out"));
|
await t
|
||||||
await t.click(Selector("button.maplibregl-ctrl-zoom-out"));
|
.click(places.zoomOut)
|
||||||
await t.click(Selector("button.maplibregl-ctrl-zoom-out"));
|
.click(places.zoomOut)
|
||||||
await t.wait(8000);
|
.click(places.zoomOut)
|
||||||
|
.click(places.zoomOut);
|
||||||
|
|
||||||
const clusterCountCanada = await Selector("div.cluster-marker").count;
|
const clusterCountCanada = await Selector("div.cluster-marker").count;
|
||||||
|
|
||||||
@@ -54,7 +57,13 @@ test.meta("testID", "places-001").meta({ mode: "public" })("Common: Test places"
|
|||||||
await t.expect(await photo.getPhotoCount("all")).eql(2);
|
await t.expect(await photo.getPhotoCount("all")).eql(2);
|
||||||
await t.expect(Selector('div[title="Cape / Bowen Island / 2019"]').visible).ok();
|
await t.expect(Selector('div[title="Cape / Bowen Island / 2019"]').visible).ok();
|
||||||
|
|
||||||
await t.click(Selector('div[title="Cape / Bowen Island / 2019"]'));
|
await t.click(places.openClusterInSearch);
|
||||||
|
|
||||||
await t.expect(Selector("#photo-viewer").visible).ok();
|
await t.expect(Selector('div[title="Cape / Bowen Island / 2019"]').visible).ok();
|
||||||
|
await t.expect(await photo.getPhotoCount("all")).eql(2);
|
||||||
|
await t.expect(toolbar.search1.value).eql("canada");
|
||||||
|
|
||||||
|
await t.click(places.clearLocation);
|
||||||
|
await t.expect(await photo.getPhotoCount("all")).gte(2);
|
||||||
|
await t.expect(toolbar.search1.value).eql("");
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -3,6 +3,9 @@ import { Selector, t } from "testcafe";
|
|||||||
export default class Page {
|
export default class Page {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.placesSearch = Selector('input[aria-label="Search"]');
|
this.placesSearch = Selector('input[aria-label="Search"]');
|
||||||
|
this.openClusterInSearch = Selector("button.action-browse");
|
||||||
|
this.clearLocation = Selector("button.action-clear-location");
|
||||||
|
this.zoomOut = Selector("button.maplibregl-ctrl-zoom-out");
|
||||||
}
|
}
|
||||||
|
|
||||||
async search(term) {
|
async search(term) {
|
||||||
|
|||||||
Reference in New Issue
Block a user