mirror of
https://github.com/photoprism/photoprism.git
synced 2025-09-26 21:01:58 +08:00
Tests: Improve acceptance tests
This commit is contained in:
@@ -291,13 +291,13 @@ test.meta("testID", "albums-004-duplicate").meta({ type: "short", mode: "public"
|
||||
|
||||
if (await holidayOption.visible) {
|
||||
await t.click(holidayOption);
|
||||
const afterDropdown = await Selector("v-chip").withText("Holiday").count;
|
||||
const afterDropdown = await Selector("span.v-chip").withText("Holiday").count;
|
||||
await t.expect(afterDropdown).eql(1, "Should have 1 chip after dropdown selection");
|
||||
|
||||
await t.click(Selector(".input-albums input"));
|
||||
await t.typeText(Selector(".input-albums input"), "Holiday", { replace: true }).pressKey("enter");
|
||||
|
||||
const afterTyping = await Selector("v-chip").withText("Holiday").count;
|
||||
const afterTyping = await Selector("span.v-chip").withText("Holiday").count;
|
||||
await t.expect(afterTyping).eql(1, "Should still have only 1 chip after typing duplicate");
|
||||
}
|
||||
|
||||
|
@@ -112,6 +112,10 @@ test.meta("testID", "calendar-004").meta({ type: "short", mode: "public" })(
|
||||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const AlbumCount = await album.getAlbumCount("all");
|
||||
await toolbar.search("Holiday");
|
||||
const HolidayAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
const InitialPhotoCountHoliday = await photo.getPhotoCount("all");
|
||||
await menu.openPage("calendar");
|
||||
const SecondCalendarUid = await album.getNthAlbumUid("all", 1);
|
||||
await album.openAlbumWithUid(SecondCalendarUid);
|
||||
@@ -150,8 +154,7 @@ test.meta("testID", "calendar-004").meta({ type: "short", mode: "public" })(
|
||||
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(AlbumCountAfterDelete).eql(AlbumCount);
|
||||
|
||||
await toolbar.search("Holiday");
|
||||
await album.openNthAlbum(0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photo.selectPhotoFromUID(ThirdPhotoUid);
|
||||
@@ -160,7 +163,7 @@ test.meta("testID", "calendar-004").meta({ type: "short", mode: "public" })(
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountHolidayAfterDelete = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(2);
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(InitialPhotoCountHoliday);
|
||||
|
||||
await menu.openPage("calendar");
|
||||
await album.openAlbumWithUid(SecondCalendarUid);
|
||||
|
@@ -127,6 +127,10 @@ test.meta("testID", "folders-004").meta({ mode: "public" })(
|
||||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const AlbumCount = await album.getAlbumCount("all");
|
||||
await toolbar.search("Holiday");
|
||||
const HolidayAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
const InitialPhotoCountHoliday = await photo.getPhotoCount("all");
|
||||
await menu.openPage("folders");
|
||||
const ThirdFolderUid = await album.getNthAlbumUid("all", 2);
|
||||
await album.openAlbumWithUid(ThirdFolderUid);
|
||||
@@ -155,13 +159,12 @@ test.meta("testID", "folders-004").meta({ mode: "public" })(
|
||||
|
||||
await t.expect(AlbumCountAfterDelete).eql(AlbumCount);
|
||||
|
||||
await toolbar.search("Holiday");
|
||||
await album.openNthAlbum(0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountHolidayAfterDelete = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(2);
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(InitialPhotoCountHoliday);
|
||||
|
||||
await menu.openPage("folders");
|
||||
await album.openAlbumWithUid(ThirdFolderUid);
|
||||
|
@@ -127,9 +127,14 @@ test.meta("testID", "labels-003").meta({ mode: "public" })("Common: Rename Label
|
||||
test.meta("testID", "labels-003").meta({ mode: "public" })("Common: Add label to albums", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Christmas");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCount = await photo.getPhotoCount("all");
|
||||
const ChristmasAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(ChristmasAlbumUid);
|
||||
const InitialPhotoCountChristmas = await photo.getPhotoCount("all");
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Holiday");
|
||||
const HolidayAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
const InitialPhotoCountHoliday = await photo.getPhotoCount("all");
|
||||
await menu.openPage("labels");
|
||||
await toolbar.search("sunglasses");
|
||||
const LabelSunglasses = await label.getNthLabeltUid(0);
|
||||
@@ -145,10 +150,10 @@ test.meta("testID", "labels-003").meta({ mode: "public" })("Common: Add label to
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.triggerContextMenuAction("album", ["Christmas", "Holiday"]);
|
||||
await menu.openPage("albums");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
||||
await album.openAlbumWithUid(ChristmasAlbumUid);
|
||||
const PhotoCountAfterAddChristmas = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 5);
|
||||
await t.expect(PhotoCountAfterAddChristmas).eql(InitialPhotoCountChristmas + 5);
|
||||
|
||||
await photo.triggerHoverAction("uid", FirstPhotoSunglasses, "select");
|
||||
await photo.triggerHoverAction("uid", SecondPhotoSunglasses, "select");
|
||||
@@ -157,12 +162,11 @@ test.meta("testID", "labels-003").meta({ mode: "public" })("Common: Add label to
|
||||
await photo.triggerHoverAction("uid", FifthPhotoSunglasses, "select");
|
||||
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountAfterDelete = await photo.getPhotoCount("all");
|
||||
const PhotoCountAfterDeleteChristmas = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 5);
|
||||
await t.expect(PhotoCountAfterDeleteChristmas).eql(PhotoCountAfterAddChristmas - 5);
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Holiday");
|
||||
await album.openNthAlbum(0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
await photo.triggerHoverAction("uid", FirstPhotoSunglasses, "select");
|
||||
await photo.triggerHoverAction("uid", SecondPhotoSunglasses, "select");
|
||||
await photo.triggerHoverAction("uid", ThirdPhotoSunglasses, "select");
|
||||
@@ -172,7 +176,7 @@ test.meta("testID", "labels-003").meta({ mode: "public" })("Common: Add label to
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountHolidayAfterDelete = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(2);
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(InitialPhotoCountHoliday);
|
||||
});
|
||||
|
||||
test.meta("testID", "labels-004").meta({ mode: "public" })("Common: Delete label", async (t) => {
|
||||
|
@@ -116,6 +116,10 @@ test.meta("testID", "moments-003").meta({ mode: "public" })(
|
||||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const AlbumCount = await album.getAlbumCount("all");
|
||||
await toolbar.search("Holiday");
|
||||
const HolidayAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
const InitialPhotoCountHoliday = await photo.getPhotoCount("all");
|
||||
await menu.openPage("moments");
|
||||
const SecondMomentUid = await album.getNthAlbumUid("all", 1);
|
||||
await album.openAlbumWithUid(SecondMomentUid);
|
||||
@@ -149,8 +153,7 @@ test.meta("testID", "moments-003").meta({ mode: "public" })(
|
||||
await contextmenu.triggerContextMenuAction("delete", "");
|
||||
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
||||
|
||||
await toolbar.search("Holiday");
|
||||
await album.openNthAlbum(0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photo.selectPhotoFromUID(ThirdPhotoUid);
|
||||
@@ -162,7 +165,7 @@ test.meta("testID", "moments-003").meta({ mode: "public" })(
|
||||
|
||||
const PhotoCountHolidayAfterDelete = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(2);
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(InitialPhotoCountHoliday);
|
||||
|
||||
await t.expect(AlbumCountAfterDelete).eql(AlbumCount);
|
||||
|
||||
|
@@ -114,6 +114,10 @@ test.meta("testID", "states-003").meta({ mode: "public" })(
|
||||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const AlbumCount = await album.getAlbumCount("all");
|
||||
await toolbar.search("Holiday");
|
||||
const HolidayAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
const InitialPhotoCountHoliday = await photo.getPhotoCount("all");
|
||||
await menu.openPage("states");
|
||||
await toolbar.search("Canada");
|
||||
const FirstStateUid = await album.getNthAlbumUid("all", 0);
|
||||
@@ -144,14 +148,13 @@ test.meta("testID", "states-003").meta({ mode: "public" })(
|
||||
const AlbumCountAfterDelete = await album.getAlbumCount("all");
|
||||
|
||||
await t.expect(AlbumCountAfterDelete).eql(AlbumCount);
|
||||
await toolbar.search("Holiday");
|
||||
await album.openNthAlbum(0);
|
||||
await album.openAlbumWithUid(HolidayAlbumUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountHolidayAfterDelete = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(2);
|
||||
await t.expect(PhotoCountHolidayAfterDelete).eql(InitialPhotoCountHoliday);
|
||||
|
||||
await menu.openPage("states");
|
||||
await album.openAlbumWithUid(FirstStateUid);
|
||||
|
@@ -39,7 +39,7 @@ export default class Page {
|
||||
if (action === "delete") {
|
||||
await t.click(Selector("button.action-confirm"));
|
||||
}
|
||||
if ((action === "album") | (action === "clone")) {
|
||||
if ((action === "album") || (action === "clone")) {
|
||||
await t.click(Selector(".input-albums"));
|
||||
|
||||
// Handle single album name or array of album names
|
||||
@@ -52,14 +52,10 @@ export default class Page {
|
||||
.click(Selector("div").withText(name).parent('div[role="option"]'))
|
||||
.click(Selector("div i.mdi-bookmark"));
|
||||
} else {
|
||||
// Type the new album name and press enter to create it
|
||||
await t.typeText(Selector(".input-albums input"), name).click(Selector("div i.mdi-bookmark"));
|
||||
}
|
||||
|
||||
// Wait a bit for the UI to update after selection
|
||||
await t.wait(500);
|
||||
await t.expect(Selector("span.v-chip").withText(name).visible).ok();
|
||||
}
|
||||
|
||||
await t.click(Selector("button.action-confirm"));
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user