Tests: Adapt tests to changes

This commit is contained in:
Theresa Gresch 2026-07-08 16:13:02 +02:00
parent 4acbfd3d1b
commit 543a7c4258
2 changed files with 11 additions and 7 deletions

View file

@ -8,6 +8,8 @@ import Photo from "../page-model/photo";
import PhotoViewer from "../page-model/photoviewer"; import PhotoViewer from "../page-model/photoviewer";
import Page from "../page-model/page"; import Page from "../page-model/page";
import PhotoEdit from "../page-model/photo-edit"; import PhotoEdit from "../page-model/photo-edit";
import Notify from "../page-model/notifications";
import { helperBeforeFixture, helperBeforeEach, helperAfterEach, logTime, logTimeEnd, logMessage } from "../page-model/helpers"; import { helperBeforeFixture, helperBeforeEach, helperAfterEach, logTime, logTimeEnd, logMessage } from "../page-model/helpers";
const scroll = ClientFunction((x, y) => window.scrollTo(x, y)); const scroll = ClientFunction((x, y) => window.scrollTo(x, y));
@ -32,6 +34,7 @@ const photo = new Photo();
const photoviewer = new PhotoViewer(); const photoviewer = new PhotoViewer();
const page = new Page(); const page = new Page();
const photoedit = new PhotoEdit(); const photoedit = new PhotoEdit();
const notify = new Notify();
test.meta("testID", "photos-001").meta({ mode: "public" })("Common: Scroll to top", async (t) => { test.meta("testID", "photos-001").meta({ mode: "public" })("Common: Scroll to top", async (t) => {
await t.click(toolbar.cardsViewAction); await t.click(toolbar.cardsViewAction);
@ -353,14 +356,13 @@ test.meta("testID", "photos-007").meta({ mode: "public" })("Common: Mark photos/
await photoedit.turnSwitchOff("scan"); await photoedit.turnSwitchOff("scan");
await photoedit.turnSwitchOff("panorama"); await photoedit.turnSwitchOff("panorama");
await t.click(photoedit.dialogClose); await t.click(photoedit.dialogClose);
await t.wait(9000); // ToDo: is there a better way than a flat wait?
if (t.browser.platform === "mobile") { if (t.browser.platform === "mobile") {
await t.eval(() => location.reload()); await t.eval(() => location.reload());
} else { } else {
await toolbar.triggerToolbarAction("refresh"); await toolbar.triggerToolbarAction("refresh");
} }
await notify.waitForPhotosToLoad(5000, true);
await photo.checkPhotoVisibility(FirstPhotoUid, false); await photo.checkPhotoVisibility(FirstPhotoUid, false);
await photo.checkPhotoVisibility(FirstVideoUid, false); await photo.checkPhotoVisibility(FirstVideoUid, false);
}); });
@ -419,8 +421,7 @@ test.meta("testID", "photos-010").meta({ mode: "public" })("Common: Set location
//search //search
await t await t
.typeText(photoedit.locationSearch, "Brandenburger Tor Berlin") .typeText(photoedit.locationSearch, "Brandenburger Tor Berlin")
.click(Selector('div.v-autocomplete__content').find('i.mdi-map-marker')); // Wait for the drop down to be populated, and select from it .click(Selector('div.v-autocomplete__content').find('i.mdi-map-marker'));
// .pressKey("enter"); // Was it important to test with the keyboard? Or is click above ok?
const Coordinates = await photoedit.locationInput.value; const Coordinates = await photoedit.locationInput.value;
await t.expect(Coordinates).eql("52.5162546, 13.3777166"); await t.expect(Coordinates).eql("52.5162546, 13.3777166");
await t.expect(photoedit.locationMarker.visible).ok(); await t.expect(photoedit.locationMarker.visible).ok();

View file

@ -1,7 +1,10 @@
import { Selector, t } from "testcafe"; import { Selector, t } from "testcafe";
export default class Page { export default class Page {
constructor() {} constructor() {
// Inert dialog title used to blur the album combobox while keeping focus in the dialog.
this.albumDialogTitle = Selector("div.p-photo-album-dialog div.v-toolbar-title", { timeout: 7000 });
}
async openContextMenu() { async openContextMenu() {
if (!(await Selector(".action-clear").visible)) { if (!(await Selector(".action-clear").visible)) {
@ -50,9 +53,9 @@ export default class Page {
// Click on the album option to select it // Click on the album option to select it
await t await t
.click(Selector("div").withText(name).parent('div[role="option"]')) .click(Selector("div").withText(name).parent('div[role="option"]'))
.click(Selector("div i.mdi-bookmark")); .click(this.albumDialogTitle);
} else { } else {
await t.typeText(Selector(".input-albums input"), name).click(Selector("div i.mdi-bookmark")); await t.typeText(Selector(".input-albums input"), name).click(this.albumDialogTitle);
} }
await t.expect(Selector("span.v-chip").withText(name).visible).ok(); await t.expect(Selector("span.v-chip").withText(name).visible).ok();
} }