From c816266578e5aab73958c06a81da1283db664ba5 Mon Sep 17 00:00:00 2001 From: theresa Date: Mon, 25 Jan 2021 14:58:21 +0100 Subject: [PATCH] Tests: Adapt tests to changes --- frontend/tests/acceptance/labels.js | 8 ++++++-- frontend/tests/acceptance/library/index.js | 18 +++++++++--------- frontend/tests/acceptance/settings/about.js | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/frontend/tests/acceptance/labels.js b/frontend/tests/acceptance/labels.js index 75a5ba78a..492c6e72c 100644 --- a/frontend/tests/acceptance/labels.js +++ b/frontend/tests/acceptance/labels.js @@ -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) => { diff --git a/frontend/tests/acceptance/library/index.js b/frontend/tests/acceptance/library/index.js index ae6f4b82b..6a336161d 100644 --- a/frontend/tests/acceptance/library/index.js +++ b/frontend/tests/acceptance/library/index.js @@ -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); }); diff --git a/frontend/tests/acceptance/settings/about.js b/frontend/tests/acceptance/settings/about.js index 8fd0dc63c..32cbd2b00 100644 --- a/frontend/tests/acceptance/settings/about.js +++ b/frontend/tests/acceptance/settings/about.js @@ -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()