mirror of
https://github.com/photoprism/photoprism.git
synced 2025-12-12 00:34:13 +01:00
Tests: Improve acceptance tests to be more stable
This commit is contained in:
@@ -55,7 +55,7 @@ test.meta("testID", "sharing-001").meta({ mode: "auth" })("Common: Create, view,
|
|||||||
.click(sharedialog.linkExpireInput)
|
.click(sharedialog.linkExpireInput)
|
||||||
.click(Selector("div").withText("After 1 day").parent('div[role="option"]'))
|
.click(Selector("div").withText("After 1 day").parent('div[role="option"]'))
|
||||||
.click(sharedialog.dialogSave)
|
.click(sharedialog.dialogSave)
|
||||||
.click(sharedialog.dialogSave);
|
.click(sharedialog.dialogClose);
|
||||||
await contextmenu.clearSelection();
|
await contextmenu.clearSelection();
|
||||||
await t.navigateTo(url);
|
await t.navigateTo(url);
|
||||||
|
|
||||||
@@ -136,9 +136,7 @@ test.meta("testID", "sharing-001").meta({ mode: "auth" })("Common: Create, view,
|
|||||||
.ok();
|
.ok();
|
||||||
});
|
});
|
||||||
|
|
||||||
test.meta("testID", "sharing-002").meta({ type: "short", mode: "auth" })(
|
test.meta("testID", "sharing-002").meta({ type: "short", mode: "auth" })("Multi-Window: Verify visitor role has limited permissions", async (t) => {
|
||||||
"Multi-Window: Verify visitor role has limited permissions",
|
|
||||||
async (t) => {
|
|
||||||
await t.navigateTo("http://localhost:2343/s/jxoux5ub1e/british-columbia-canada");
|
await t.navigateTo("http://localhost:2343/s/jxoux5ub1e/british-columbia-canada");
|
||||||
await t.expect(toolbar.toolbarSecondTitle.withText("British Columbia").visible).ok();
|
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 toolbar.triggerToolbarAction("view-list");
|
||||||
|
|
||||||
await t
|
await t.expect(Selector(`td button.input-private`).visible).notOk().expect(Selector(`td button.input-favorite`).visible).notOk();
|
||||||
.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-mosaic");
|
||||||
await toolbar.triggerToolbarAction("view-cards");
|
await toolbar.triggerToolbarAction("view-cards");
|
||||||
await t.click(page.cardLocation.nth(0));
|
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("edit", false);
|
||||||
await contextmenu.checkContextMenuActionAvailability("share", false);
|
await contextmenu.checkContextMenuActionAvailability("share", false);
|
||||||
await contextmenu.clearSelection();
|
await contextmenu.clearSelection();
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|||||||
@@ -24,9 +24,7 @@ const albumdialog = new AlbumDialog();
|
|||||||
const photoedit = new PhotoEdit();
|
const photoedit = new PhotoEdit();
|
||||||
const notifies = new Notifies();
|
const notifies = new Notifies();
|
||||||
|
|
||||||
test.meta("testID", "albums-001").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-001").meta({ type: "short", mode: "public" })("Common: Create/delete album on /albums", async (t) => {
|
||||||
"Common: Create/delete album on /albums",
|
|
||||||
async (t) => {
|
|
||||||
await menu.openPage("albums");
|
await menu.openPage("albums");
|
||||||
const AlbumCount = await album.getAlbumCount("all");
|
const AlbumCount = await album.getAlbumCount("all");
|
||||||
await toolbar.triggerToolbarAction("add");
|
await toolbar.triggerToolbarAction("add");
|
||||||
@@ -40,12 +38,9 @@ test.meta("testID", "albums-001").meta({ type: "short", mode: "public" })(
|
|||||||
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
||||||
|
|
||||||
await t.expect(AlbumCountAfterDelete).eql(AlbumCountAfterCreate - 1);
|
await t.expect(AlbumCountAfterDelete).eql(AlbumCountAfterCreate - 1);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })("Common: Create/delete album during add to album", async (t) => {
|
||||||
"Common: Create/delete album during add to album",
|
|
||||||
async (t) => {
|
|
||||||
await menu.openPage("albums");
|
await menu.openPage("albums");
|
||||||
const AlbumCount = await album.getAlbumCount("all");
|
const AlbumCount = await album.getAlbumCount("all");
|
||||||
await menu.openPage("browse");
|
await menu.openPage("browse");
|
||||||
@@ -87,6 +82,7 @@ test.meta("testID", "albums-002").meta({ type: "short", mode: "public" })(
|
|||||||
await album.openAlbumWithUid(AlbumUid);
|
await album.openAlbumWithUid(AlbumUid);
|
||||||
await toolbar.triggerToolbarAction("delete");
|
await toolbar.triggerToolbarAction("delete");
|
||||||
await t.navigateTo("/library/albums");
|
await t.navigateTo("/library/albums");
|
||||||
|
await notifies.waitForAlbumsToLoad(7000);
|
||||||
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
||||||
|
|
||||||
await t.expect(AlbumCountAfterDelete).eql(AlbumCount);
|
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)
|
.expect(Selector("td").withText("NotYetExistingAlbum").visible)
|
||||||
.notOk()
|
.notOk()
|
||||||
.click(photoedit.dialogClose);
|
.click(photoedit.dialogClose);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
test.meta("testID", "albums-003").meta({ type: "short", mode: "public" })("Common: Update album details", async (t) => {
|
test.meta("testID", "albums-003").meta({ type: "short", mode: "public" })("Common: Update album details", async (t) => {
|
||||||
await menu.openPage("albums");
|
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.expect(albumdialog.description.value).eql("").expect(albumdialog.category.value).eql("");
|
||||||
|
|
||||||
await t
|
await t.typeText(albumdialog.description, "All my animals").typeText(albumdialog.category, "Pets").pressKey("enter").click(albumdialog.dialogSave);
|
||||||
.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");
|
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.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.description).pressKey("ctrl+a delete");
|
||||||
await t
|
await t.click(albumdialog.category).click(albumdialog.category).pressKey("ctrl+a delete").click(Selector("form.form-album-edit i.mdi-bookmark"));
|
||||||
.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.expect(albumdialog.category.value).eql("");
|
||||||
await t.click(albumdialog.dialogSave);
|
await t.click(albumdialog.dialogSave);
|
||||||
await menu.openPage("albums");
|
await menu.openPage("albums");
|
||||||
|
|
||||||
await t
|
await t.expect(Selector("div").withText("Holiday").visible).ok().expect(Selector("div").withText("Animals").exists).notOk();
|
||||||
.expect(Selector("div").withText("Holiday").visible)
|
|
||||||
.ok()
|
|
||||||
.expect(Selector("div").withText("Animals").exists)
|
|
||||||
.notOk();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
test.meta("testID", "albums-004").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-004").meta({ type: "short", mode: "public" })("Common: Add/Remove Photos to/from multiple albums", async (t) => {
|
||||||
"Common: Add/Remove Photos to/from multiple albums",
|
|
||||||
async (t) => {
|
|
||||||
// Get initial counts for both Holiday and Christmas albums
|
// Get initial counts for both Holiday and Christmas albums
|
||||||
await menu.openPage("albums");
|
await menu.openPage("albums");
|
||||||
await notifies.waitForPhotosToLoad(2000);
|
await notifies.waitForPhotosToLoad(2000);
|
||||||
@@ -276,8 +257,7 @@ test.meta("testID", "albums-004").meta({ type: "short", mode: "public" })(
|
|||||||
.expect(Selector("td").withText("Christmas").visible)
|
.expect(Selector("td").withText("Christmas").visible)
|
||||||
.notOk()
|
.notOk()
|
||||||
.click(photoedit.dialogClose);
|
.click(photoedit.dialogClose);
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
test.meta("testID", "albums-004-duplicate").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-004-duplicate").meta({ type: "short", mode: "public" })(
|
||||||
"Common: Album duplication when selecting from dropdown then typing same name",
|
"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 contextmenu.openContextMenu();
|
||||||
await t.click(Selector("button.action-album")).click(Selector(".input-albums input"));
|
await t.click(Selector("button.action-album")).click(Selector(".input-albums input"));
|
||||||
|
|
||||||
await t
|
await t.expect(page.selectOption.withText("Holiday").visible).ok().expect(page.selectOption.withText("Christmas").visible).ok();
|
||||||
.expect(page.selectOption.withText("Holiday").visible)
|
|
||||||
.ok()
|
|
||||||
.expect(page.selectOption.withText("Christmas").visible)
|
|
||||||
.ok();
|
|
||||||
|
|
||||||
await t.typeText(Selector(".input-albums input"), "C", { replace: true });
|
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();
|
.ok();
|
||||||
});
|
});
|
||||||
|
|
||||||
test.meta("testID", "albums-007").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-007").meta({ type: "short", mode: "public" })("Common: Create, Edit, delete sharing link", async (t) => {
|
||||||
"Common: Create, Edit, delete sharing link",
|
|
||||||
async (t) => {
|
|
||||||
await page.testCreateEditDeleteSharingLink("albums");
|
await page.testCreateEditDeleteSharingLink("albums");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
test.meta("testID", "albums-008").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-008").meta({ type: "short", mode: "public" })("Common: Verify album sort options", async (t) => {
|
||||||
"Common: Verify album sort options",
|
|
||||||
async (t) => {
|
|
||||||
await menu.openPage("albums");
|
await menu.openPage("albums");
|
||||||
await album.checkSortOptions("album");
|
await album.checkSortOptions("album");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|
||||||
test.meta("testID", "albums-009").meta({ type: "short", mode: "public" })(
|
test.meta("testID", "albums-009").meta({ type: "short", mode: "public" })("Common: Set album cover from Albums Page", async (t) => {
|
||||||
"Common: Set album cover from Albums Page",
|
|
||||||
async (t) => {
|
|
||||||
await page.testSetAlbumCover("albums");
|
await page.testSetAlbumCover("albums");
|
||||||
}
|
});
|
||||||
);
|
|
||||||
|
|||||||
@@ -85,7 +85,6 @@ test.meta("testID", "folders-002").meta({ mode: "public" })("Common: Update fold
|
|||||||
|
|
||||||
await album.openAlbumWithUid(AlbumUid);
|
await album.openAlbumWithUid(AlbumUid);
|
||||||
await toolbar.triggerToolbarAction("edit");
|
await toolbar.triggerToolbarAction("edit");
|
||||||
await t.click(albumdialog.category).wait(3000);
|
|
||||||
|
|
||||||
await t
|
await t
|
||||||
.expect(albumdialog.description.value)
|
.expect(albumdialog.description.value)
|
||||||
|
|||||||
@@ -71,7 +71,6 @@ test.meta("testID", "moments-001").meta({ mode: "public" })("Common: Update mome
|
|||||||
|
|
||||||
await album.openAlbumWithUid(AlbumUid);
|
await album.openAlbumWithUid(AlbumUid);
|
||||||
await toolbar.triggerToolbarAction("edit");
|
await toolbar.triggerToolbarAction("edit");
|
||||||
await t.click(albumdialog.category).wait(3000);
|
|
||||||
|
|
||||||
await t
|
await t
|
||||||
.expect(albumdialog.description.value)
|
.expect(albumdialog.description.value)
|
||||||
|
|||||||
@@ -173,7 +173,6 @@ test.meta("testID", "people-004").meta({ mode: "public" })("Common: Test new fac
|
|||||||
await t
|
await t
|
||||||
.expect(Selector('div[role="option"]').nth(0).visible)
|
.expect(Selector('div[role="option"]').nth(0).visible)
|
||||||
.notOk()
|
.notOk()
|
||||||
.click(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"))
|
|
||||||
.typeText(Selector("div[data-id=" + FirstFaceID + "] div.input-name input"), "Otto");
|
.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();
|
await t.expect(Selector('div[role="option"]').nth(0).withText("Otto Visible").visible).ok();
|
||||||
|
|||||||
@@ -114,6 +114,12 @@ export default class Page {
|
|||||||
showLogs && console.timeEnd("waitForPhotosToLoad")
|
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){
|
async waitForSearchToFinish(delay, close = true){
|
||||||
showLogs && console.time("waitForSearchToFinish")
|
showLogs && console.time("waitForSearchToFinish")
|
||||||
await this.waitForSpecficEvent(/(found|contain|empty)/, delay, close);
|
await this.waitForSpecficEvent(/(found|contain|empty)/, delay, close);
|
||||||
|
|||||||
Reference in New Issue
Block a user