Tests: Adapt tests to changes

This commit is contained in:
theresa 2021-01-25 14:58:21 +01:00
parent 295e050ae5
commit c816266578
3 changed files with 16 additions and 12 deletions

View file

@ -146,6 +146,8 @@ test.meta("testID", "labels-003")("Add label to album", async (t) => {
const FirstPhotoLandscape = await Selector("div.is-photo").nth(0).getAttribute("data-uid");
const SecondPhotoLandscape = await Selector("div.is-photo").nth(1).getAttribute("data-uid");
const ThirdPhotoLandscape = await Selector("div.is-photo").nth(2).getAttribute("data-uid");
const FourthPhotoLandscape = await Selector("div.is-photo").nth(3).getAttribute("data-uid");
const FifthPhotoLandscape = await Selector("div.is-photo").nth(4).getAttribute("data-uid");
await page.openNav();
await t.click(".nav-labels");
await page.selectFromUID(LabelLandscape);
@ -158,13 +160,15 @@ test.meta("testID", "labels-003")("Add label to album", async (t) => {
.click(Selector(".nav-albums"))
.click(Selector("a.is-album").withAttribute("data-uid", AlbumUid));
const PhotoCountAfterAdd = await Selector("div.is-photo", { timeout: 5000 }).count;
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 3);
await t.expect(PhotoCountAfterAdd).eql(PhotoCount + 5);
await page.selectPhotoFromUID(FirstPhotoLandscape);
await page.selectPhotoFromUID(SecondPhotoLandscape);
await page.selectPhotoFromUID(ThirdPhotoLandscape);
await page.selectPhotoFromUID(FourthPhotoLandscape);
await page.selectPhotoFromUID(FifthPhotoLandscape);
await page.removeSelected();
const PhotoCountAfterDelete = await Selector("div.is-photo", { timeout: 5000 }).count;
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 3);
await t.expect(PhotoCountAfterDelete).eql(PhotoCountAfterAdd - 5);
});
test.meta("testID", "labels-004")("Delete label", async (t) => {

View file

@ -12,9 +12,8 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) =>
await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok();
await page.openNav();
await t
.click(Selector(".nav-moments"))
.expect(Selector("h3").withText("Couldn't find anything").visible)
.ok();
.click(Selector(".nav-moments"));
const MomentCount = await Selector("a.is-album").count;
await page.openNav();
await t.click(Selector(".nav-calendar"));
if (t.browser.platform === "mobile") {
@ -52,9 +51,8 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) =>
await page.openNav();
await t
.click(Selector(".nav-browse + div"))
.click(Selector(".nav-monochrome"))
.expect(Selector("h3").withText("Couldn't find anything").visible)
.ok();
.click(Selector(".nav-monochrome"));
const MonochromeCount = await Selector("a.is-album").count;
await page.openNav();
await t
.click(Selector(".nav-library"))
@ -71,8 +69,10 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) =>
await page.search("cheetah");
await t.expect(Selector(".is-label").visible).ok();
await page.openNav();
await t.click(Selector(".nav-moments"));
const MomentCountAfterIndex = await Selector("a.is-album").count;
await t
.click(Selector(".nav-moments"))
.expect(MomentCountAfterIndex).gt(MomentCount)
.click(Selector("a").withText("South Africa 2013"))
.expect(Selector(".is-photo").visible)
.ok();
@ -115,6 +115,6 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) =>
.ok();
await page.openNav();
await t.click(Selector(".nav-browse + div")).click(Selector(".nav-monochrome"));
const PhotoCount = await Selector(".is-photo.type-image", { timeout: 5000 }).count;
await t.expect(PhotoCount).gt(0);
const MonochromeCountAfterIndex = await Selector(".is-photo.type-image", { timeout: 5000 }).count;
await t.expect(MonochromeCountAfterIndex).gt(MonochromeCount);
});

View file

@ -10,7 +10,7 @@ test.meta("testID", "about-001")("About page is displayed with all links", async
await t
.click(Selector(".nav-settings + div"))
.click(Selector(".nav-about"))
.expect(Selector("h2").withText("Funding").visible)
.expect(Selector("h2").withText("Trademarks").visible)
.ok()
.expect(Selector('a[href="https://github.com/sponsors/photoprism"]').visible)
.ok()