Tests: Improve acceptance tests

This commit is contained in:
graciousgrey 2023-09-21 20:00:33 +02:00
parent 3788a82d91
commit 4ece10b5af
5 changed files with 25 additions and 12 deletions

View file

@ -3,6 +3,7 @@
"quarantineMode": false,
"selectorTimeout": 5000,
"hostname": "localhost",
"disableNativeAutomation": "true",
"screenshots": {
"path": "tests/acceptance/screenshots",
"takeOnFails": true

View file

@ -30,14 +30,14 @@ test.meta("testID", "settings-general-001").meta({ type: "short", mode: "auth" }
"Common: Disable delete",
async (t) => {
await menu.openPage("archive");
await toolbar.checkToolbarActionAvailability("sweep", true);
await toolbar.checkToolbarActionAvailability("delete-all", true);
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 toolbar.checkToolbarActionAvailability("sweep", false);
await toolbar.checkToolbarActionAvailability("delete-all", false);
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 t.navigateTo("/library/archive");
await toolbar.checkToolbarActionAvailability("sweep", true);
await toolbar.checkToolbarActionAvailability("delete-all", true);
await menu.openPage("settings");
await t
@ -345,7 +345,7 @@ test.meta("testID", "settings-general-005").meta({ type: "short", mode: "auth" }
await photo.checkPhotoVisibility("pqnah1k2frui6p63", true);
await t.navigateTo("/library/archive");
await toolbar.checkToolbarActionAvailability("sweep", false);
await toolbar.checkToolbarActionAvailability("delete-all", false);
await menu.openPage("settings");
await t

View file

@ -538,7 +538,7 @@ test.meta("testID", "photos-archive-private-005").meta({ type: "short", mode: "p
"Common: Check delete all dialog",
async (t) => {
await menu.openPage("archive");
await toolbar.triggerToolbarAction("sweep");
await toolbar.triggerToolbarAction("delete-all");
await t
.expect(
Selector("div").withText("Are you sure you want to delete all archived pictures?").visible

View file

@ -4,6 +4,7 @@ import testcafeconfig from "../../testcafeconfig.json";
import Menu from "../page-model/menu";
import Places from "../page-model/places";
import Photo from "../page-model/photo";
import Toolbar from "../page-model/toolbar";
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 places = new Places();
const photo = new Photo();
const toolbar = new Toolbar();
test.meta("testID", "places-001").meta({ mode: "public" })("Common: Test places", async (t) => {
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;
await places.search("canada");
await t.wait(8000);
await t.click(Selector("button.maplibregl-ctrl-zoom-out"));
await t.click(Selector("button.maplibregl-ctrl-zoom-out"));
await t.click(Selector("button.maplibregl-ctrl-zoom-out"));
await t.wait(8000);
await t
.click(places.zoomOut)
.click(places.zoomOut)
.click(places.zoomOut)
.click(places.zoomOut);
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(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("");
});

View file

@ -3,6 +3,9 @@ import { Selector, t } from "testcafe";
export default class Page {
constructor() {
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) {