2021-01-13 11:05:11 +01:00
|
|
|
import { Selector } from "testcafe";
|
|
|
|
import testcafeconfig from "./testcafeconfig";
|
2020-06-01 17:04:47 +02:00
|
|
|
import Page from "./page-model";
|
|
|
|
|
2021-01-13 11:05:11 +01:00
|
|
|
fixture`Test albums`.page`${testcafeconfig.url}`;
|
2020-06-01 17:04:47 +02:00
|
|
|
|
|
|
|
const page = new Page();
|
|
|
|
|
2021-08-13 21:35:43 +02:00
|
|
|
test.meta("testID", "authentication-000")(
|
|
|
|
"Time to start instance (will be marked as unstable)",
|
|
|
|
async (t) => {
|
|
|
|
await t.wait(5000);
|
|
|
|
}
|
|
|
|
);
|
2021-08-13 21:19:19 +02:00
|
|
|
|
2021-01-20 12:09:14 +01:00
|
|
|
test.meta("testID", "albums-001")("Create/delete album on /albums", async (t) => {
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
2021-01-13 11:05:11 +01:00
|
|
|
await t.click(Selector(".nav-albums"));
|
|
|
|
const countAlbums = await Selector("a.is-album").count;
|
|
|
|
await t.click(Selector("button.action-add"));
|
|
|
|
const countAlbumsAfterCreate = await Selector("a.is-album").count;
|
|
|
|
const NewAlbum = await Selector("a.is-album").nth(0).getAttribute("data-uid");
|
|
|
|
await t.expect(countAlbumsAfterCreate).eql(countAlbums + 1);
|
|
|
|
await page.selectFromUID(NewAlbum);
|
|
|
|
await page.deleteSelected();
|
|
|
|
const countAlbumsAfterDelete = await Selector("a.is-album").count;
|
|
|
|
await t.expect(countAlbumsAfterDelete).eql(countAlbumsAfterCreate - 1);
|
2020-06-01 17:04:47 +02:00
|
|
|
});
|
2020-06-01 09:45:24 +02:00
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "albums-002")("Update album", async (t) => {
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
2021-01-20 12:09:14 +01:00
|
|
|
await t.click(Selector(".nav-albums"));
|
2021-01-26 16:36:39 +01:00
|
|
|
await page.search("Holiday");
|
2021-09-20 20:10:37 +02:00
|
|
|
const AlbumUid = await Selector("a.is-album", { timeout: 55000 }).nth(0).getAttribute("data-uid");
|
2021-01-13 11:05:11 +01:00
|
|
|
await t
|
|
|
|
.expect(Selector("button.action-title-edit").nth(0).innerText)
|
|
|
|
.contains("Holiday")
|
|
|
|
.click(Selector(".action-title-edit").nth(0))
|
|
|
|
.typeText(Selector(".input-title input"), "Animals", { replace: true })
|
|
|
|
.expect(Selector(".input-description textarea").value)
|
|
|
|
.eql("")
|
|
|
|
.expect(Selector(".input-category input").value)
|
|
|
|
.eql("")
|
|
|
|
.typeText(Selector(".input-description textarea"), "All my animals")
|
|
|
|
.typeText(Selector(".input-category input"), "Pets")
|
|
|
|
.pressKey("enter")
|
|
|
|
.click(".action-confirm")
|
|
|
|
.click(Selector("a.is-album").nth(0));
|
|
|
|
const PhotoCount = await Selector("div.is-photo").count;
|
|
|
|
await t
|
|
|
|
.expect(Selector(".v-card__text").nth(0).innerText)
|
|
|
|
.contains("All my animals")
|
|
|
|
.expect(Selector("div").withText("Animals").exists)
|
2021-01-18 20:43:01 +01:00
|
|
|
.ok();
|
|
|
|
await page.openNav();
|
2021-01-20 12:09:14 +01:00
|
|
|
await t.click(Selector(".nav-browse"));
|
2021-01-13 11:05:11 +01:00
|
|
|
await page.search("photo:true");
|
|
|
|
const FirstPhotoUid = await Selector("div.is-photo.type-image").nth(0).getAttribute("data-uid");
|
|
|
|
const SecondPhotoUid = await Selector("div.is-photo.type-image").nth(1).getAttribute("data-uid");
|
|
|
|
await page.selectPhotoFromUID(SecondPhotoUid);
|
2021-01-19 16:02:22 +01:00
|
|
|
await page.selectFromUIDInFullscreen(FirstPhotoUid);
|
2021-01-27 10:14:18 +01:00
|
|
|
await page.addSelectedToAlbum("Animals", "album");
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
2021-01-13 11:05:11 +01:00
|
|
|
await t.click(Selector(".nav-albums"));
|
2021-01-26 16:36:39 +01:00
|
|
|
if (t.browser.platform === "mobile") {
|
|
|
|
await page.search("category:Family");
|
|
|
|
} else {
|
|
|
|
await t
|
2021-09-20 20:10:37 +02:00
|
|
|
.click(Selector(".input-category"))
|
2021-01-26 16:36:39 +01:00
|
|
|
.click(Selector('div[role="listitem"]').withText("Family"));
|
|
|
|
}
|
2021-01-20 12:09:14 +01:00
|
|
|
await t.expect(Selector("button.action-title-edit").nth(0).innerText).contains("Christmas");
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
2021-04-22 11:17:37 +02:00
|
|
|
await t.click(Selector(".nav-albums")).click(".action-reload");
|
2021-01-26 16:36:39 +01:00
|
|
|
if (t.browser.platform === "mobile") {
|
|
|
|
} else {
|
|
|
|
await t
|
2021-09-20 20:10:37 +02:00
|
|
|
.click(Selector(".input-category"))
|
2021-04-22 11:17:37 +02:00
|
|
|
.click(Selector('div[role="listitem"]').withText("All Categories"), { timeout: 55000 });
|
2021-01-26 16:36:39 +01:00
|
|
|
}
|
2021-01-13 11:05:11 +01:00
|
|
|
await t.click(Selector("a.is-album").withAttribute("data-uid", AlbumUid));
|
|
|
|
const PhotoCountAfterAdd = await Selector("div.is-photo").count;
|
|
|
|
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 2);
|
|
|
|
await page.selectPhotoFromUID(FirstPhotoUid);
|
|
|
|
await page.selectPhotoFromUID(SecondPhotoUid);
|
|
|
|
await page.removeSelected();
|
|
|
|
const PhotoCountAfterDelete = await Selector("div.is-photo").count;
|
|
|
|
await t
|
|
|
|
.expect(PhotoCountAfterDelete)
|
|
|
|
.eql(PhotoCountAfterAdd - 2)
|
|
|
|
.click(Selector(".action-edit"))
|
|
|
|
.typeText(Selector(".input-title input"), "Holiday", { replace: true })
|
|
|
|
.expect(Selector(".input-description textarea").value)
|
|
|
|
.eql("All my animals")
|
|
|
|
.expect(Selector(".input-category input").value)
|
|
|
|
.eql("Pets")
|
|
|
|
.click(Selector(".input-description textarea"))
|
|
|
|
.pressKey("ctrl+a delete")
|
|
|
|
.pressKey("enter")
|
|
|
|
.click(Selector(".input-category input"))
|
|
|
|
.pressKey("ctrl+a delete")
|
|
|
|
.pressKey("enter")
|
2021-01-19 16:02:22 +01:00
|
|
|
.click(".action-confirm");
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
|
|
|
await t
|
2021-01-13 11:05:11 +01:00
|
|
|
.click(Selector(".nav-albums"))
|
|
|
|
.expect(Selector("div").withText("Holiday").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("div").withText("Animals").exists)
|
|
|
|
.notOk();
|
2020-06-01 17:04:47 +02:00
|
|
|
});
|
2020-05-28 10:00:09 +02:00
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "albums-003")("Download album", async (t) => {
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
2021-01-13 11:05:11 +01:00
|
|
|
await t.click(Selector(".nav-albums"));
|
2021-01-28 08:26:21 +01:00
|
|
|
await page.checkButtonVisibility("download", true, true);
|
2020-06-04 15:38:46 +02:00
|
|
|
});
|
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "albums-004")("View folders", async (t) => {
|
2021-01-13 11:05:11 +01:00
|
|
|
await page.openNav();
|
|
|
|
await t
|
|
|
|
.click(Selector(".nav-folders"))
|
|
|
|
.expect(Selector("a").withText("BotanicalGarden").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("a").withText("Kanada").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("a").withText("KorsikaAdventure").visible)
|
|
|
|
.ok();
|
2020-06-04 15:38:46 +02:00
|
|
|
});
|
|
|
|
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "albums-005")("View calendar", async (t) => {
|
2021-01-18 20:43:01 +01:00
|
|
|
await page.openNav();
|
2021-01-13 11:05:11 +01:00
|
|
|
await t
|
|
|
|
.click(Selector(".nav-calendar"))
|
|
|
|
.expect(Selector("a").withText("May 2019").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("a").withText("October 2019").visible)
|
|
|
|
.ok();
|
2020-06-26 16:35:21 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
//TODO test that sharing link works as expected
|
2021-01-15 17:02:39 +01:00
|
|
|
test.meta("testID", "albums-006")("Create, Edit, delete sharing link", async (t) => {
|
2021-01-28 08:26:21 +01:00
|
|
|
await page.testCreateEditDeleteSharingLink("albums");
|
2021-01-13 11:05:11 +01:00
|
|
|
});
|
2021-01-20 12:09:14 +01:00
|
|
|
|
|
|
|
test.meta("testID", "albums-007")("Create/delete album during add to album", async (t) => {
|
|
|
|
await page.openNav();
|
|
|
|
await t.click(Selector(".nav-albums"));
|
|
|
|
const countAlbums = await Selector("a.is-album").count;
|
|
|
|
await page.openNav();
|
|
|
|
await t.click(Selector(".nav-browse"));
|
|
|
|
await page.search("photo:true");
|
|
|
|
const FirstPhotoUid = await Selector("div.is-photo.type-image").nth(0).getAttribute("data-uid");
|
|
|
|
const SecondPhotoUid = await Selector("div.is-photo.type-image").nth(1).getAttribute("data-uid");
|
|
|
|
await page.selectPhotoFromUID(SecondPhotoUid);
|
|
|
|
await page.selectFromUIDInFullscreen(FirstPhotoUid);
|
2021-01-27 10:14:18 +01:00
|
|
|
await page.addSelectedToAlbum("NotYetExistingAlbum", "album");
|
2021-01-20 12:09:14 +01:00
|
|
|
await page.openNav();
|
|
|
|
await t.click(Selector(".nav-albums"));
|
|
|
|
const countAlbumsAfterCreation = await Selector("a.is-album").count;
|
|
|
|
await t.expect(countAlbumsAfterCreation).eql(countAlbums + 1);
|
2021-01-26 16:36:39 +01:00
|
|
|
await page.search("NotYetExistingAlbum");
|
2021-01-20 12:09:14 +01:00
|
|
|
const AlbumUid = await Selector("a.is-album").nth(0).getAttribute("data-uid");
|
|
|
|
await page.selectFromUID(AlbumUid);
|
|
|
|
await page.deleteSelected();
|
|
|
|
await page.openNav();
|
|
|
|
await t.click(Selector(".nav-albums"));
|
|
|
|
const countAlbumsAfterDelete = await Selector("a.is-album").count;
|
|
|
|
await t.expect(countAlbumsAfterDelete).eql(countAlbums);
|
|
|
|
});
|
2021-04-22 11:17:37 +02:00
|
|
|
|
|
|
|
test.meta("testID", "albums-008")("Test album autocomplete", async (t) => {
|
|
|
|
await page.openNav();
|
|
|
|
await t.click(Selector(".nav-browse"));
|
|
|
|
await page.search("photo:true");
|
|
|
|
const FirstPhotoUid = await Selector("div.is-photo.type-image").nth(0).getAttribute("data-uid");
|
|
|
|
await page.selectPhotoFromUID(FirstPhotoUid);
|
|
|
|
await t
|
|
|
|
.click(Selector("button.action-menu"))
|
|
|
|
.click(Selector("button.action-album"))
|
|
|
|
.click(Selector(".input-album input"))
|
|
|
|
.expect(Selector("div.v-list__tile__title").withText("Holiday").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("div.v-list__tile__title").withText("Christmas").visible)
|
|
|
|
.ok()
|
|
|
|
.typeText(Selector(".input-album input"), "C", { replace: true })
|
|
|
|
.expect(Selector("div.v-list__tile__title").withText("Christmas").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("div.v-list__tile__title").withText("C").visible)
|
|
|
|
.ok()
|
|
|
|
.expect(Selector("div.v-list__tile__title").withText("Holiday").visible)
|
|
|
|
.notOk();
|
|
|
|
});
|