Tests: Improve acceptance tests to be more stable

This commit is contained in:
graciousgrey
2025-11-28 10:32:00 +01:00
parent d19c70e8e7
commit 75515d3653
6 changed files with 245 additions and 282 deletions

View File

@@ -55,7 +55,7 @@ test.meta("testID", "sharing-001").meta({ mode: "auth" })("Common: Create, view,
.click(sharedialog.linkExpireInput)
.click(Selector("div").withText("After 1 day").parent('div[role="option"]'))
.click(sharedialog.dialogSave)
.click(sharedialog.dialogSave);
.click(sharedialog.dialogClose);
await contextmenu.clearSelection();
await t.navigateTo(url);
@@ -136,9 +136,7 @@ test.meta("testID", "sharing-001").meta({ mode: "auth" })("Common: Create, view,
.ok();
});
test.meta("testID", "sharing-002").meta({ type: "short", mode: "auth" })(
"Multi-Window: Verify visitor role has limited permissions",
async (t) => {
test.meta("testID", "sharing-002").meta({ type: "short", mode: "auth" })("Multi-Window: Verify visitor role has limited permissions", async (t) => {
await t.navigateTo("http://localhost:2343/s/jxoux5ub1e/british-columbia-canada");
await t.expect(toolbar.toolbarSecondTitle.withText("British Columbia").visible).ok();
@@ -176,11 +174,7 @@ test.meta("testID", "sharing-002").meta({ type: "short", mode: "auth" })(
await toolbar.triggerToolbarAction("view-list");
await t
.expect(Selector(`td button.input-private`).visible)
.notOk()
.expect(Selector(`td button.input-favorite`).visible)
.notOk();
await t.expect(Selector(`td button.input-private`).visible).notOk().expect(Selector(`td button.input-favorite`).visible).notOk();
await toolbar.triggerToolbarAction("view-mosaic");
await toolbar.triggerToolbarAction("view-cards");
await t.click(page.cardLocation.nth(0));
@@ -202,5 +196,4 @@ test.meta("testID", "sharing-002").meta({ type: "short", mode: "auth" })(
await contextmenu.checkContextMenuActionAvailability("edit", false);
await contextmenu.checkContextMenuActionAvailability("share", false);
await contextmenu.clearSelection();
}
);
});

View File

@@ -24,9 +24,7 @@ const albumdialog = new AlbumDialog();
const photoedit = new PhotoEdit();
const notifies = new Notifies();
test.meta("testID", "albums-001").meta({ type: "short", mode: "public" })(
"Common: Create/delete album on /albums",
async (t) => {
test.meta("testID", "albums-001").meta({ type: "short", mode: "public" })("Common: Create/delete album on /albums", async (t) => {
await menu.openPage("albums");
const AlbumCount = await album.getAlbumCount("all");
await toolbar.triggerToolbarAction("add");
@@ -40,12 +38,9 @@ test.meta("testID", "albums-001").meta({ type: "short", mode: "public" })(
const AlbumCountAfterDelete = await album.getAlbumCount("all");
await t.expect(AlbumCountAfterDelete).eql(AlbumCountAfterCreate - 1);
}
);
});
test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })(
"Common: Create/delete album during add to album",
async (t) => {
test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })("Common: Create/delete album during add to album", async (t) => {
await menu.openPage("albums");
const AlbumCount = await album.getAlbumCount("all");
await menu.openPage("browse");
@@ -87,6 +82,7 @@ test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })(
await album.openAlbumWithUid(AlbumUid);
await toolbar.triggerToolbarAction("delete");
await t.navigateTo("/library/albums");
await notifies.waitForAlbumsToLoad(7000);
const AlbumCountAfterDelete = await album.getAlbumCount("all");
await t.expect(AlbumCountAfterDelete).eql(AlbumCount);
@@ -102,8 +98,7 @@ test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })(
.expect(Selector("td").withText("NotYetExistingAlbum").visible)
.notOk()
.click(photoedit.dialogClose);
}
);
});
test.meta("testID", "albums-003").meta({ type: "short", mode: "public" })("Common: Update album details", async (t) => {
await menu.openPage("albums");
@@ -116,11 +111,7 @@ test.meta("testID", "albums-003").meta({ type: "short", mode: "public" })("Commo
await t.expect(albumdialog.description.value).eql("").expect(albumdialog.category.value).eql("");
await t
.typeText(albumdialog.description, "All my animals")
.typeText(albumdialog.category, "Pets")
.pressKey("enter")
.click(albumdialog.dialogSave);
await t.typeText(albumdialog.description, "All my animals").typeText(albumdialog.category, "Pets").pressKey("enter").click(albumdialog.dialogSave);
await t.expect(page.cardTitle.nth(0).innerText).contains("Animals");
@@ -131,25 +122,15 @@ test.meta("testID", "albums-003").meta({ type: "short", mode: "public" })("Commo
await t.expect(albumdialog.description.value).eql("All my animals").expect(albumdialog.category.value).eql("Pets");
await t.click(albumdialog.description).pressKey("ctrl+a delete");
await t
.click(albumdialog.category)
.click(albumdialog.category)
.pressKey("ctrl+a delete")
.click(Selector("form.form-album-edit i.mdi-bookmark"));
await t.click(albumdialog.category).click(albumdialog.category).pressKey("ctrl+a delete").click(Selector("form.form-album-edit i.mdi-bookmark"));
await t.expect(albumdialog.category.value).eql("");
await t.click(albumdialog.dialogSave);
await menu.openPage("albums");
await t
.expect(Selector("div").withText("Holiday").visible)
.ok()
.expect(Selector("div").withText("Animals").exists)
.notOk();
await t.expect(Selector("div").withText("Holiday").visible).ok().expect(Selector("div").withText("Animals").exists).notOk();
});
test.meta("testID", "albums-004").meta({ type: "short", mode: "public" })(
"Common: Add/Remove Photos to/from multiple albums",
async (t) => {
test.meta("testID", "albums-004").meta({ type: "short", mode: "public" })("Common: Add/Remove Photos to/from multiple albums", async (t) => {
// Get initial counts for both Holiday and Christmas albums
await menu.openPage("albums");
await notifies.waitForPhotosToLoad(2000);
@@ -276,8 +257,7 @@ test.meta("testID", "albums-004").meta({ type: "short", mode: "public" })(
.expect(Selector("td").withText("Christmas").visible)
.notOk()
.click(photoedit.dialogClose);
}
);
});
test.meta("testID", "albums-004-duplicate").meta({ type: "short", mode: "public" })(
"Common: Album duplication when selecting from dropdown then typing same name",
@@ -341,11 +321,7 @@ test.meta("testID", "albums-006").meta({ mode: "public" })("Common: Test album a
await contextmenu.openContextMenu();
await t.click(Selector("button.action-album")).click(Selector(".input-albums input"));
await t
.expect(page.selectOption.withText("Holiday").visible)
.ok()
.expect(page.selectOption.withText("Christmas").visible)
.ok();
await t.expect(page.selectOption.withText("Holiday").visible).ok().expect(page.selectOption.withText("Christmas").visible).ok();
await t.typeText(Selector(".input-albums input"), "C", { replace: true });
@@ -358,24 +334,15 @@ test.meta("testID", "albums-006").meta({ mode: "public" })("Common: Test album a
.ok();
});
test.meta("testID", "albums-007").meta({ type: "short", mode: "public" })(
"Common: Create, Edit, delete sharing link",
async (t) => {
test.meta("testID", "albums-007").meta({ type: "short", mode: "public" })("Common: Create, Edit, delete sharing link", async (t) => {
await page.testCreateEditDeleteSharingLink("albums");
}
);
});
test.meta("testID", "albums-008").meta({ type: "short", mode: "public" })(
"Common: Verify album sort options",
async (t) => {
test.meta("testID", "albums-008").meta({ type: "short", mode: "public" })("Common: Verify album sort options", async (t) => {
await menu.openPage("albums");
await album.checkSortOptions("album");
}
);
});
test.meta("testID", "albums-009").meta({ type: "short", mode: "public" })(
"Common: Set album cover from Albums Page",
async (t) => {
test.meta("testID", "albums-009").meta({ type: "short", mode: "public" })("Common: Set album cover from Albums Page", async (t) => {
await page.testSetAlbumCover("albums");
}
);
});

View File

@@ -85,7 +85,6 @@ test.meta("testID", "folders-002").meta({ mode: "public" })("Common: Update fold
await album.openAlbumWithUid(AlbumUid);
await toolbar.triggerToolbarAction("edit");
await t.click(albumdialog.category).wait(3000);
await t
.expect(albumdialog.description.value)

View File

@@ -71,7 +71,6 @@ test.meta("testID", "moments-001").meta({ mode: "public" })("Common: Update mome
await album.openAlbumWithUid(AlbumUid);
await toolbar.triggerToolbarAction("edit");
await t.click(albumdialog.category).wait(3000);
await t
.expect(albumdialog.description.value)

View File

@@ -173,7 +173,6 @@ test.meta("testID", "people-004").meta({ mode: "public" })("Common: Test new fac
await t
.expect(Selector('div[role="option"]').nth(0).visible)
.notOk()
.click(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"))
.typeText(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"), "Otto");
await t.expect(Selector('div[role="option"]').nth(0).withText("Otto Visible").visible).ok();

View File

@@ -114,6 +114,12 @@ export default class Page {
showLogs && console.timeEnd("waitForPhotosToLoad")
}
async waitForAlbumsToLoad(delay, close = true){
showLogs && console.time("waitForAlbumsToLoad")
await this.waitForSpecficEvent(/(album|albums) found/, delay, close);
showLogs && console.timeEnd("waitForAlbumsToLoad")
}
async waitForSearchToFinish(delay, close = true){
showLogs && console.time("waitForSearchToFinish")
await this.waitForSpecficEvent(/(found|contain|empty)/, delay, close);