From 3dfd32a80dac8d3447eac3d1905eed8ae9fcce5e Mon Sep 17 00:00:00 2001 From: theresa Date: Mon, 18 Jan 2021 20:43:14 +0100 Subject: [PATCH] Tests: Update acceptance tests to run on mobile --- frontend/tests/acceptance/labels.js | 34 +++++++++++++++++---- frontend/tests/acceptance/library/import.js | 6 +++- frontend/tests/acceptance/library/index.js | 30 +++++++++++++----- 3 files changed, 56 insertions(+), 14 deletions(-) diff --git a/frontend/tests/acceptance/labels.js b/frontend/tests/acceptance/labels.js index 06f3625a4..f2e3c7ce0 100644 --- a/frontend/tests/acceptance/labels.js +++ b/frontend/tests/acceptance/labels.js @@ -7,6 +7,7 @@ fixture`Test labels`.page`${testcafeconfig.url}`; const page = new Page(); test.meta("testID", "labels-001")("Remove/Activate Add/Delete Label from photo", async (t) => { + await page.openNav(); await t.click(Selector(".nav-labels")); const countImportantLabels = await Selector("a.is-label").count; await t.click(Selector("button.action-show-all")); @@ -18,6 +19,7 @@ test.meta("testID", "labels-001")("Remove/Activate Add/Delete Label from photo", await page.search("beacon"); const LabelBeacon = await Selector("a.is-label").nth(0).getAttribute("data-uid"); await t.click(Selector("a.is-label").withAttribute("data-uid", LabelBeacon)); + await page.setFilter("view", "Cards"); const PhotoBeacon = await Selector("div.is-photo").nth(0).getAttribute("data-uid"); await t.click(Selector(".action-title-edit").withAttribute("data-uid", PhotoBeacon)); const PhotoKeywords = await Selector(".input-keywords textarea").value; @@ -35,7 +37,9 @@ test.meta("testID", "labels-001")("Remove/Activate Add/Delete Label from photo", .contains("test") .expect(PhotoKeywordsAfterEdit) .notContains("beacon") - .click(Selector(".action-close")) + .click(Selector(".action-close")); + await page.openNav(); + await t .click(Selector(".nav-labels")); await page.search("beacon"); await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); @@ -54,7 +58,9 @@ test.meta("testID", "labels-001")("Remove/Activate Add/Delete Label from photo", .contains("beacon") .expect(PhotoKeywordsAfterUndo) .notContains("test") - .click(Selector(".action-close")) + .click(Selector(".action-close")); + await page.openNav(); + await t .click(Selector(".nav-labels")); await page.search("test"); await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); @@ -63,6 +69,7 @@ test.meta("testID", "labels-001")("Remove/Activate Add/Delete Label from photo", }); test.meta("testID", "labels-002")("Rename Label", async (t) => { + await page.openNav(); await t.click(Selector(".nav-labels")); await page.search("zebra"); const LabelZebra = await Selector("a.is-label").nth(0).getAttribute("data-uid"); @@ -73,6 +80,7 @@ test.meta("testID", "labels-002")("Rename Label", async (t) => { const SecondPhotoZebra = await Selector("div.is-photo", { timeout: 5000 }) .nth(1) .getAttribute("data-uid"); + await page.setFilter("view", "Cards"); await t.click(Selector(".action-title-edit").withAttribute("data-uid", FirstPhotoZebra)); const FirstPhotoTitle = await Selector(".input-title input", { timeout: 5000 }).value; const FirstPhotoKeywords = await Selector(".input-keywords textarea", { timeout: 5000 }).value; @@ -96,7 +104,9 @@ test.meta("testID", "labels-002")("Rename Label", async (t) => { .contains("horse") .expect(FirstPhotoTitleAfterEdit) .notContains("Zebra") - .click(Selector(".action-close")) + .click(Selector(".action-close")); + await page.openNav(); + await t .click(Selector(".nav-labels")); await page.search("horse"); await t @@ -110,13 +120,16 @@ test.meta("testID", "labels-002")("Rename Label", async (t) => { .click(Selector("div.p-inline-edit")) .typeText(Selector(".input-rename input"), "Zebra", { replace: true }) .pressKey("enter") - .click(Selector(".action-close")) + .click(Selector(".action-close")); + await page.openNav(); + await t .click(Selector(".nav-labels")); await page.search("horse"); await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); }); test.meta("testID", "labels-003")("Add label to album", async (t) => { + await page.openNav(); await t .click(Selector(".nav-albums")) .typeText(Selector(".p-albums-search input"), "Christmas") @@ -124,6 +137,7 @@ test.meta("testID", "labels-003")("Add label to album", async (t) => { const AlbumUid = await Selector("a.is-album").nth(0).getAttribute("data-uid"); await t.click(Selector("a.is-album").withAttribute("data-uid", AlbumUid)); const PhotoCount = await Selector("div.is-photo").count; + await page.openNav(); await t.click(Selector(".nav-labels")); await page.search("landscape"); const LabelLandscape = await Selector("a.is-label").nth(1).getAttribute("data-uid"); @@ -131,12 +145,14 @@ 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"); + await page.openNav(); await t.click(".nav-labels"); await page.selectFromUID(LabelLandscape); const clipboardCount = await Selector("span.count-clipboard"); await t.expect(clipboardCount.textContent).eql("1"); await page.addSelectedToAlbum("Christmas"); + await page.openNav(); await t .click(Selector(".nav-albums")) .click(Selector("a.is-album").withAttribute("data-uid", AlbumUid)); @@ -152,6 +168,7 @@ test.meta("testID", "labels-003")("Add label to album", async (t) => { }); test.meta("testID", "labels-004")("Delete label", async (t) => { + await page.openNav(); await t.click(Selector(".nav-labels")); await page.search("dome"); const LabelDome = await Selector("a.is-label", { timeout: 5000 }).nth(0).getAttribute("data-uid"); @@ -159,6 +176,7 @@ test.meta("testID", "labels-004")("Delete label", async (t) => { const FirstPhotoDome = await Selector("div.is-photo", { timeout: 5000 }) .nth(0) .getAttribute("data-uid"); + await page.openNav(); await t.click(".nav-labels"); await page.selectFromUID(LabelDome); const clipboardCount = await Selector("span.count-clipboard", { timeout: 5000 }); @@ -167,8 +185,12 @@ test.meta("testID", "labels-004")("Delete label", async (t) => { await page.search("dome"); await t .expect(Selector("h3").withText("Couldn't find anything").visible) - .ok() - .click(".nav-browse") + .ok(); + await page.openNav(); + await t + .click(".nav-browse"); + await page.setFilter("view", "Cards"); + await t .click(Selector(".action-title-edit").withAttribute("data-uid", FirstPhotoDome)) .click(Selector("#tab-labels")) .expect(Selector("td").withText("No labels found").visible) diff --git a/frontend/tests/acceptance/library/import.js b/frontend/tests/acceptance/library/import.js index 77a25e2dc..e74fd645f 100644 --- a/frontend/tests/acceptance/library/import.js +++ b/frontend/tests/acceptance/library/import.js @@ -6,9 +6,11 @@ fixture`Import file from folder`.page`${testcafeconfig.url}`; const page = new Page(); test.meta("testID", "library-import-001")("Import files from folder using copy", async (t) => { + await page.openNav(); await t.click(Selector(".nav-labels")); await page.search("bakery"); await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); + await page.openNav(); await t .click(Selector(".nav-library")) .click(Selector("#tab-library-import")) @@ -16,7 +18,9 @@ test.meta("testID", "library-import-001")("Import files from folder using copy", .click(Selector("div.v-list__tile__title").withText("/Bäckerei")) .click(Selector(".action-import")) //TODO replace wait - .wait(60000) + .wait(60000); + await page.openNav(); + await t //.expect(Selector('span').withText('Done.').visible, {timeout: 60000}).ok() .click(Selector(".nav-labels")) .click(Selector(".action-reload")); diff --git a/frontend/tests/acceptance/library/index.js b/frontend/tests/acceptance/library/index.js index a8c7d507b..e2d24e25d 100644 --- a/frontend/tests/acceptance/library/index.js +++ b/frontend/tests/acceptance/library/index.js @@ -6,19 +6,26 @@ fixture`Test index`.page`${testcafeconfig.url}`; const page = new Page(); test.meta("testID", "library-index-001")("Index files from folder", async (t) => { + await page.openNav(); await t.click(Selector(".nav-labels")); await page.search("cheetah"); await t .expect(Selector("h3").withText("Couldn't find anything").visible) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-moments")) .expect(Selector("h3").withText("Couldn't find anything").visible) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-calendar")); await page.search("December 2013"); await t .expect(Selector("h3").withText("Couldn't find anything").visible) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-folders")); await page.search("Moment"); await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); @@ -33,6 +40,7 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) => .click(Selector(".is-folder").withText("moment")) .expect(Selector("h3").withText("Couldn't find anything").visible) .ok(); + await page.openNav(); await t .click(Selector(".nav-library")) .click(Selector("#tab-library-index")) @@ -42,23 +50,31 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) => //TODO replace wait .wait(50000) .expect(Selector("span").withText("Done.").visible, { timeout: 60000 }) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-labels")) .click(Selector(".action-reload")); await page.search("cheetah"); await t .expect(Selector(".is-label").visible) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-moments")) .click(Selector("a").withText("South Africa 2013")) .expect(Selector(".is-photo").visible) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-calendar")) .click(Selector(".action-reload")); await page.search("December 2013"); await t .expect(Selector(".is-album").visible) - .ok() + .ok(); + await page.openNav(); + await t .click(Selector(".nav-folders")) .click(Selector(".action-reload")); await page.search("Moment");