2021-01-15 17:02:39 +01:00
|
|
|
import { Selector } from "testcafe";
|
|
|
|
import testcafeconfig from "./testcafeconfig";
|
2022-04-15 15:46:25 +02:00
|
|
|
import Menu from "../page-model/menu";
|
|
|
|
import Album from "../page-model/album";
|
|
|
|
import Toolbar from "../page-model/toolbar";
|
|
|
|
import ContextMenu from "../page-model/context-menu";
|
|
|
|
import Photo from "../page-model/photo";
|
|
|
|
import Page from "../page-model/page";
|
|
|
|
import Label from "../page-model/label";
|
|
|
|
import PhotoEdit from "../page-model/photo-edit";
|
2020-06-02 13:07:18 +02:00
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
fixture`Test labels`.page`${testcafeconfig.url}`;
|
2020-06-02 13:07:18 +02:00
|
|
|
|
2022-04-15 15:46:25 +02:00
|
|
|
const menu = new Menu();
|
|
|
|
const album = new Album();
|
|
|
|
const toolbar = new Toolbar();
|
|
|
|
const contextmenu = new ContextMenu();
|
|
|
|
const photo = new Photo();
|
2020-06-02 13:07:18 +02:00
|
|
|
const page = new Page();
|
2022-04-15 15:46:25 +02:00
|
|
|
const label = new Label();
|
|
|
|
const photoedit = new PhotoEdit();
|
2020-06-02 13:07:18 +02:00
|
|
|
|
2022-04-15 15:46:25 +02:00
|
|
|
test.meta("testID", "labels-001").meta({ type: "smoke" })(
|
|
|
|
"Remove/Activate Add/Delete Label from photo",
|
|
|
|
async (t) => {
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("beacon");
|
|
|
|
const LabelBeaconUid = await label.getNthLabeltUid(0);
|
|
|
|
await label.openLabelWithUid(LabelBeaconUid);
|
|
|
|
await toolbar.setFilter("view", "Cards");
|
|
|
|
const PhotoBeaconUid = await photo.getNthPhotoUid("all", 0);
|
|
|
|
await t.click(page.cardTitle.withAttribute("data-uid", PhotoBeaconUid));
|
|
|
|
const PhotoKeywords = await photoedit.keywords.value;
|
|
|
|
|
|
|
|
await t.expect(PhotoKeywords).contains("beacon");
|
|
|
|
|
|
|
|
await t
|
|
|
|
.click(photoedit.labelsTab)
|
|
|
|
.click(photoedit.removeLabel)
|
|
|
|
.typeText(photoedit.inputLabelName, "Test")
|
|
|
|
.click(Selector(photoedit.addLabel))
|
|
|
|
.click(photoedit.detailsTab);
|
|
|
|
const PhotoKeywordsAfterEdit = await photoedit.keywords.value;
|
|
|
|
|
|
|
|
await t
|
|
|
|
.expect(PhotoKeywordsAfterEdit)
|
|
|
|
.contains("test")
|
|
|
|
.expect(PhotoKeywordsAfterEdit)
|
|
|
|
.notContains("beacon");
|
|
|
|
|
|
|
|
await t.click(photoedit.dialogClose);
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("beacon");
|
|
|
|
|
|
|
|
await t.expect(Selector("div.no-results").visible).ok();
|
|
|
|
|
|
|
|
await toolbar.search("test");
|
|
|
|
const LabelTest = await label.getNthLabeltUid(0);
|
|
|
|
await label.openLabelWithUid(LabelTest);
|
|
|
|
await t
|
|
|
|
.click(page.cardTitle.withAttribute("data-uid", PhotoBeaconUid))
|
|
|
|
.click(photoedit.labelsTab)
|
|
|
|
.click(photoedit.deleteLabel)
|
|
|
|
.click(photoedit.activateLabel)
|
|
|
|
.click(photoedit.detailsTab);
|
|
|
|
const PhotoKeywordsAfterUndo = await photoedit.keywords.value;
|
|
|
|
|
|
|
|
await t
|
|
|
|
.expect(PhotoKeywordsAfterUndo)
|
|
|
|
.contains("beacon")
|
|
|
|
.expect(PhotoKeywordsAfterUndo)
|
|
|
|
.notContains("test");
|
|
|
|
|
|
|
|
await t.click(photoedit.dialogClose);
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("test");
|
|
|
|
|
|
|
|
await t.expect(Selector("div.no-results").visible).ok();
|
|
|
|
|
|
|
|
await toolbar.search("beacon");
|
|
|
|
await album.checkAlbumVisibility(LabelBeaconUid, true);
|
|
|
|
}
|
|
|
|
);
|
|
|
|
|
|
|
|
test.meta("testID", "labels-002")("Toggle between important and all labels", async (t) => {
|
|
|
|
await menu.openPage("labels");
|
|
|
|
const ImportantLabelsCount = await label.getLabelCount();
|
|
|
|
await toolbar.triggerToolbarAction("show-all");
|
|
|
|
const AllLabelsCount = await label.getLabelCount();
|
|
|
|
|
|
|
|
await t.expect(AllLabelsCount).gt(ImportantLabelsCount);
|
|
|
|
|
|
|
|
await toolbar.triggerToolbarAction("show-important");
|
|
|
|
const ImportantLabelsCount2 = await label.getLabelCount();
|
|
|
|
|
|
|
|
await t.expect(ImportantLabelsCount).eql(ImportantLabelsCount2);
|
2020-06-02 13:07:18 +02:00
|
|
|
});
|
|
|
|
|
2022-04-15 15:46:25 +02:00
|
|
|
test.meta("testID", "labels-003")("Rename Label", async (t) => {
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("zebra");
|
|
|
|
const LabelZebraUid = await label.getNthLabeltUid(0);
|
|
|
|
await label.openNthLabel(0);
|
|
|
|
const FirstPhotoZebraUid = await photo.getNthPhotoUid("all", 0);
|
|
|
|
await toolbar.setFilter("view", "Cards");
|
|
|
|
await t.click(page.cardTitle.withAttribute("data-uid", FirstPhotoZebraUid));
|
|
|
|
const FirstPhotoTitle = await photoedit.title.value;
|
|
|
|
const FirstPhotoKeywords = await photoedit.keywords.value;
|
|
|
|
|
|
|
|
await t.expect(FirstPhotoTitle).contains("Zebra").expect(FirstPhotoKeywords).contains("zebra");
|
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
await t
|
2022-04-15 15:46:25 +02:00
|
|
|
.click(photoedit.labelsTab)
|
|
|
|
.click(photoedit.openInlineEdit)
|
|
|
|
.typeText(photoedit.inputLabelRename, "Horse", { replace: true })
|
2021-01-15 17:02:39 +01:00
|
|
|
.pressKey("enter")
|
2022-04-15 15:46:25 +02:00
|
|
|
.click(photoedit.detailsTab);
|
|
|
|
const FirstPhotoTitleAfterEdit = await photoedit.title.value;
|
|
|
|
const FirstPhotoKeywordsAfterEdit = await photoedit.keywords.value;
|
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
await t
|
|
|
|
.expect(FirstPhotoTitleAfterEdit)
|
|
|
|
.contains("Horse")
|
|
|
|
.expect(FirstPhotoKeywordsAfterEdit)
|
|
|
|
.contains("horse")
|
|
|
|
.expect(FirstPhotoTitleAfterEdit)
|
2022-04-15 15:46:25 +02:00
|
|
|
.notContains("Zebra");
|
|
|
|
|
|
|
|
await t.click(photoedit.dialogClose);
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("horse");
|
|
|
|
await album.checkAlbumVisibility(LabelZebraUid, true);
|
|
|
|
await label.openLabelWithUid(LabelZebraUid);
|
|
|
|
await photo.checkPhotoVisibility(FirstPhotoZebraUid, true);
|
2021-01-15 17:02:39 +01:00
|
|
|
await t
|
2022-04-15 15:46:25 +02:00
|
|
|
.click(page.cardTitle.withAttribute("data-uid", FirstPhotoZebraUid))
|
|
|
|
.click(photoedit.labelsTab)
|
|
|
|
.click(photoedit.openInlineEdit)
|
|
|
|
.typeText(photoedit.inputLabelRename, "Zebra", { replace: true })
|
2021-01-15 17:02:39 +01:00
|
|
|
.pressKey("enter")
|
2022-04-15 15:46:25 +02:00
|
|
|
.click(photoedit.dialogClose);
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("horse");
|
|
|
|
|
2021-09-24 10:59:26 +02:00
|
|
|
await t.expect(Selector("div.no-results").visible).ok();
|
2020-06-02 13:07:18 +02:00
|
|
|
});
|
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "labels-003")("Add label to album", async (t) => {
|
2022-04-15 15:46:25 +02:00
|
|
|
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");
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("landscape");
|
|
|
|
const LabelLandscape = await label.getNthLabeltUid(1);
|
|
|
|
await label.openLabelWithUid(LabelLandscape);
|
|
|
|
const FirstPhotoLandscape = await photo.getNthPhotoUid("all", 0);
|
|
|
|
const SecondPhotoLandscape = await photo.getNthPhotoUid("all", 1);
|
|
|
|
const ThirdPhotoLandscape = await photo.getNthPhotoUid("all", 2);
|
|
|
|
const FourthPhotoLandscape = await photo.getNthPhotoUid("all", 3);
|
|
|
|
const FifthPhotoLandscape = await photo.getNthPhotoUid("all", 4);
|
|
|
|
const SixthPhotoLandscape = await photo.getNthPhotoUid("all", 5);
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await label.triggerHoverAction("uid", LabelLandscape, "select");
|
|
|
|
await contextmenu.checkContextMenuCount("1");
|
|
|
|
await contextmenu.triggerContextMenuAction("album", "Christmas");
|
|
|
|
await menu.openPage("albums");
|
|
|
|
await album.openAlbumWithUid(AlbumUid);
|
|
|
|
const PhotoCountAfterAdd = await photo.getPhotoCount("all");
|
|
|
|
|
2021-01-30 18:49:52 +01:00
|
|
|
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 6);
|
2022-04-15 15:46:25 +02:00
|
|
|
|
|
|
|
await photo.triggerHoverAction("uid", FirstPhotoLandscape, "select");
|
|
|
|
await photo.triggerHoverAction("uid", SecondPhotoLandscape, "select");
|
|
|
|
await photo.triggerHoverAction("uid", ThirdPhotoLandscape, "select");
|
|
|
|
await photo.triggerHoverAction("uid", FourthPhotoLandscape, "select");
|
|
|
|
await photo.triggerHoverAction("uid", FifthPhotoLandscape, "select");
|
|
|
|
await photo.triggerHoverAction("uid", SixthPhotoLandscape, "select");
|
|
|
|
await contextmenu.triggerContextMenuAction("remove", "");
|
|
|
|
const PhotoCountAfterDelete = await photo.getPhotoCount("all");
|
|
|
|
|
2021-01-30 18:49:52 +01:00
|
|
|
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 6);
|
2020-06-03 08:42:56 +02:00
|
|
|
});
|
2020-05-28 10:00:09 +02:00
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "labels-004")("Delete label", async (t) => {
|
2022-04-15 15:46:25 +02:00
|
|
|
await menu.openPage("labels");
|
|
|
|
await toolbar.search("dome");
|
|
|
|
const LabelDomeUid = await label.getNthLabeltUid(0);
|
|
|
|
await label.openLabelWithUid(LabelDomeUid);
|
|
|
|
const FirstPhotoDomeUid = await photo.getNthPhotoUid("all", 0);
|
|
|
|
await menu.openPage("labels");
|
|
|
|
await label.triggerHoverAction("uid", LabelDomeUid, "select");
|
|
|
|
await contextmenu.checkContextMenuCount("1");
|
|
|
|
await contextmenu.triggerContextMenuAction("delete", "");
|
|
|
|
await toolbar.search("dome");
|
|
|
|
|
2021-09-24 10:59:26 +02:00
|
|
|
await t.expect(Selector("div.no-results").visible).ok();
|
2022-04-15 15:46:25 +02:00
|
|
|
|
|
|
|
await menu.openPage("browse");
|
|
|
|
await toolbar.setFilter("view", "Cards");
|
2021-01-18 20:43:14 +01:00
|
|
|
await t
|
2022-04-15 15:46:25 +02:00
|
|
|
.click(page.cardTitle.withAttribute("data-uid", FirstPhotoDomeUid))
|
|
|
|
.click(photoedit.labelsTab);
|
2021-10-05 09:40:16 +02:00
|
|
|
|
2022-04-15 15:46:25 +02:00
|
|
|
await t.expect(Selector("td").withText("No labels found").visible).ok();
|
|
|
|
|
|
|
|
await t.typeText(photoedit.inputLabelName, "Dome").click(photoedit.addLabel);
|
|
|
|
});
|