Tests: Refactor albums tests
This commit is contained in:
parent
9ea55e6cd9
commit
dd8a242710
1 changed files with 113 additions and 71 deletions
|
@ -30,24 +30,56 @@ test.meta("testID", "albums-001").meta({ type: "smoke" })(
|
|||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await toolbar.triggerToolbarAction("add", "");
|
||||
await toolbar.triggerToolbarAction("add");
|
||||
const countAlbumsAfterCreate = await album.getAlbumCount("all");
|
||||
const NewAlbum = await album.getNthAlbumUid("all", 0);
|
||||
const NewAlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
|
||||
await t.expect(countAlbumsAfterCreate).eql(countAlbums + 1);
|
||||
await album.selectAlbumFromUID(NewAlbum);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
|
||||
await album.selectAlbumFromUID(NewAlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbumsAfterCreate - 1);
|
||||
}
|
||||
);
|
||||
|
||||
test.meta("testID", "albums-002")("Update album", async (t) => {
|
||||
test.meta("testID", "albums-002").meta({ type: "smoke" })(
|
||||
"Create/delete album during add to album",
|
||||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("browse");
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhotoUid = await photo.getNthPhotoUid("image", 1);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("album", "NotYetExistingAlbum");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
|
||||
await toolbar.search("NotYetExistingAlbum");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
}
|
||||
);
|
||||
|
||||
test.meta("testID", "albums-003").meta({ type: "smoke" })("Update album details", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Holiday");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
|
||||
await t.expect(page.cardTitle.nth(0).innerText).contains("Holiday");
|
||||
|
||||
await t
|
||||
.expect(page.cardTitle.nth(0).innerText)
|
||||
.contains("Holiday")
|
||||
.click(page.cardTitle.nth(0))
|
||||
.typeText(Selector(".input-title input"), "Animals", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
|
@ -58,41 +90,11 @@ test.meta("testID", "albums-002")("Update album", async (t) => {
|
|||
.typeText(Selector(".input-category input"), "Pets")
|
||||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await album.openNthAlbum(0);
|
||||
const PhotoCount = await photo.getPhotoCount("all");
|
||||
await t.expect(toolbar.toolbarTitle.innerText).contains("Animals");
|
||||
await t.expect(toolbar.toolbarDescription.innerText).contains("All my animals");
|
||||
await menu.openPage("browse");
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhotoUid = await photo.getNthPhotoUid("image", 1);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photoviewer.openPhotoViewer("uid", FirstPhotoUid);
|
||||
await photoviewer.triggerPhotoViewerAction("select");
|
||||
await photoviewer.triggerPhotoViewerAction("close");
|
||||
await contextmenu.triggerContextMenuAction("album", "Animals", "album");
|
||||
await menu.openPage("albums");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await toolbar.search("category:Family");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Family");
|
||||
}
|
||||
await t.expect(page.cardTitle.nth(0).innerText).contains("Christmas");
|
||||
await menu.openPage("albums");
|
||||
await toolbar.triggerToolbarAction("reload", "");
|
||||
if (t.browser.platform === "mobile") {
|
||||
} else {
|
||||
await toolbar.setFilter("category", "All Categories");
|
||||
}
|
||||
|
||||
await t.expect(page.cardTitle.nth(0).innerText).contains("Animals");
|
||||
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 2);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("remove", "", "");
|
||||
const PhotoCountAfterDelete = await photo.getPhotoCount("all");
|
||||
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 2);
|
||||
await toolbar.triggerToolbarAction("edit", "");
|
||||
await toolbar.triggerToolbarAction("edit");
|
||||
await t
|
||||
.typeText(Selector(".input-title input"), "Holiday", { replace: true })
|
||||
.expect(Selector(".input-description textarea").value)
|
||||
|
@ -107,6 +109,7 @@ test.meta("testID", "albums-002")("Update album", async (t) => {
|
|||
.pressKey("enter")
|
||||
.click(".action-confirm");
|
||||
await menu.openPage("albums");
|
||||
|
||||
await t
|
||||
.expect(Selector("div").withText("Holiday").visible)
|
||||
.ok()
|
||||
|
@ -114,46 +117,78 @@ test.meta("testID", "albums-002")("Update album", async (t) => {
|
|||
.notOk();
|
||||
});
|
||||
|
||||
//TODO test that sharing link works as expected --> move to sharing.js
|
||||
test.meta("testID", "albums-006")("Create, Edit, delete sharing link", async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("albums");
|
||||
test.meta("testID", "albums-004").meta({ type: "smoke" })(
|
||||
"Add/Remove Photos to/from album",
|
||||
async (t) => {
|
||||
await menu.openPage("albums");
|
||||
await toolbar.search("Holiday");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCount = await photo.getPhotoCount("all");
|
||||
await menu.openPage("browse");
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhotoUid = await photo.getNthPhotoUid("image", 1);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photoviewer.openPhotoViewer("uid", FirstPhotoUid);
|
||||
await photoviewer.triggerPhotoViewerAction("select");
|
||||
await photoviewer.triggerPhotoViewerAction("close");
|
||||
await contextmenu.triggerContextMenuAction("album", "Holiday");
|
||||
await menu.openPage("albums");
|
||||
await album.openAlbumWithUid(AlbumUid);
|
||||
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 2);
|
||||
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("remove", "");
|
||||
const PhotoCountAfterDelete = await photo.getPhotoCount("all");
|
||||
|
||||
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 2);
|
||||
}
|
||||
);
|
||||
|
||||
test.meta("testID", "albums-005")("Use album search and filters", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
if (t.browser.platform === "mobile") {
|
||||
await toolbar.search("category:Family");
|
||||
} else {
|
||||
await toolbar.setFilter("category", "Family");
|
||||
}
|
||||
|
||||
await t.expect(page.cardTitle.nth(0).innerText).contains("Christmas");
|
||||
const AlbumCount = await album.getAlbumCount("all");
|
||||
await t.expect(AlbumCount).eql(1);
|
||||
|
||||
if (t.browser.platform === "mobile") {
|
||||
} else {
|
||||
await toolbar.setFilter("category", "All Categories");
|
||||
}
|
||||
|
||||
await toolbar.search("Holiday");
|
||||
|
||||
await t.expect(page.cardTitle.nth(0).innerText).contains("Holiday");
|
||||
const AlbumCount2 = await album.getAlbumCount("all");
|
||||
await t.expect(AlbumCount2).eql(1);
|
||||
});
|
||||
|
||||
test.meta("testID", "albums-007")("Create/delete album during add to album", async (t) => {
|
||||
await menu.openPage("albums");
|
||||
const countAlbums = await album.getAlbumCount("all");
|
||||
await menu.openPage("browse");
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
const SecondPhotoUid = await photo.getNthPhotoUid("image", 1);
|
||||
await photo.selectPhotoFromUID(SecondPhotoUid);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await contextmenu.triggerContextMenuAction("album", "NotYetExistingAlbum", "album");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterCreation = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
||||
await toolbar.search("NotYetExistingAlbum");
|
||||
const AlbumUid = await album.getNthAlbumUid("all", 0);
|
||||
await album.selectAlbumFromUID(AlbumUid);
|
||||
await contextmenu.triggerContextMenuAction("delete", "", "");
|
||||
await menu.openPage("albums");
|
||||
const countAlbumsAfterDelete = await album.getAlbumCount("all");
|
||||
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
||||
});
|
||||
|
||||
test.meta("testID", "albums-008")("Test album autocomplete", async (t) => {
|
||||
test.meta("testID", "albums-006")("Test album autocomplete", async (t) => {
|
||||
await toolbar.search("photo:true");
|
||||
const FirstPhotoUid = await photo.getNthPhotoUid("image", 0);
|
||||
await photo.selectPhotoFromUID(FirstPhotoUid);
|
||||
await contextmenu.openContextMenu();
|
||||
await t.click(Selector("button.action-album")).click(Selector(".input-album input"));
|
||||
|
||||
await t
|
||||
.click(Selector("button.action-album"))
|
||||
.click(Selector(".input-album input"))
|
||||
.expect(page.selectOption.withText("Holiday").visible)
|
||||
.ok()
|
||||
.expect(page.selectOption.withText("Christmas").visible)
|
||||
.ok()
|
||||
.typeText(Selector(".input-album input"), "C", { replace: true })
|
||||
.ok();
|
||||
|
||||
await t.typeText(Selector(".input-album input"), "C", { replace: true });
|
||||
|
||||
await t
|
||||
.expect(page.selectOption.withText("Holiday").visible)
|
||||
.notOk()
|
||||
.expect(page.selectOption.withText("Christmas").visible)
|
||||
|
@ -161,3 +196,10 @@ test.meta("testID", "albums-008")("Test album autocomplete", async (t) => {
|
|||
.expect(page.selectOption.withText("C").visible)
|
||||
.ok();
|
||||
});
|
||||
|
||||
test.meta("testID", "albums-007").meta({ type: "smoke" })(
|
||||
"Create, Edit, delete sharing link",
|
||||
async (t) => {
|
||||
await page.testCreateEditDeleteSharingLink("albums");
|
||||
}
|
||||
);
|
||||
|
|
Loading…
Add table
Reference in a new issue