From 20fe4b032d34e4105770811edbd3f2bc95ac3b4a Mon Sep 17 00:00:00 2001 From: theresa Date: Tue, 19 Jan 2021 16:02:22 +0100 Subject: [PATCH] Tests: Update acceptance tests to run on mobile --- frontend/tests/acceptance/albums.js | 19 ++++++------ frontend/tests/acceptance/library/index.js | 30 +++++++++++++++---- frontend/tests/acceptance/settings/general.js | 10 +++++-- 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/frontend/tests/acceptance/albums.js b/frontend/tests/acceptance/albums.js index efa8a4a01..71bae70ec 100644 --- a/frontend/tests/acceptance/albums.js +++ b/frontend/tests/acceptance/albums.js @@ -23,9 +23,12 @@ test.meta("testID", "albums-001")("Create/delete album", async (t) => { test.meta("testID", "albums-002")("Update album", async (t) => { await page.openNav(); await t - .click(Selector(".nav-albums")) - .typeText(Selector(".p-albums-search input"), "Holiday") - .pressKey("enter"); + .click(Selector(".nav-albums")); + if (t.browser.platform === "mobile") { + await t.navigateTo("/albums?q=Holiday"); + } else { await page.search("Holiday");} + //.typeText(Selector(".p-albums-search input"), "Holiday") + //.pressKey("enter"); const AlbumUid = await Selector("a.is-album").nth(0).getAttribute("data-uid"); await t .expect(Selector("button.action-title-edit").nth(0).innerText) @@ -53,8 +56,8 @@ test.meta("testID", "albums-002")("Update album", async (t) => { 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.selectFromUIDInFullscreen(FirstPhotoUid); await page.selectPhotoFromUID(SecondPhotoUid); + await page.selectFromUIDInFullscreen(FirstPhotoUid); await page.addSelectedToAlbum("Animals"); await page.openNav(); await t.click(Selector(".nav-albums")); @@ -76,7 +79,6 @@ test.meta("testID", "albums-002")("Update album", async (t) => { await page.selectPhotoFromUID(FirstPhotoUid); await page.selectPhotoFromUID(SecondPhotoUid); await page.removeSelected(); - await t.click(".action-reload"); const PhotoCountAfterDelete = await Selector("div.is-photo").count; await t .expect(PhotoCountAfterDelete) @@ -93,8 +95,7 @@ test.meta("testID", "albums-002")("Update album", async (t) => { .click(Selector(".input-category input")) .pressKey("ctrl+a delete") .pressKey("enter") - .click(".action-confirm") - .click(".action-reload"); + .click(".action-confirm"); await page.openNav(); await t .click(Selector(".nav-albums")) @@ -160,7 +161,7 @@ test.meta("testID", "albums-006")("Create, Edit, delete sharing link", async (t) .expect(InitialUrl) .notContains("secretfortesting") .expect(InitialExpire) - .eql("Never") + .contains("Never") .typeText(Selector(".input-secret input"), "secretForTesting", { replace: true }) .click(Selector(".input-expires input")) .click(Selector("div").withText("After 1 day").parent('div[role="listitem"]')) @@ -174,7 +175,7 @@ test.meta("testID", "albums-006")("Create, Edit, delete sharing link", async (t) .expect(UrlAfterChange) .contains("secretfortesting") .expect(ExpireAfterChange) - .eql("After 1 day") + .contains("After 1 day") .typeText(Selector(".input-secret input"), InitialSecret, { replace: true }) .click(Selector(".input-expires input")) .click(Selector("div").withText("Never").parent('div[role="listitem"]')) diff --git a/frontend/tests/acceptance/library/index.js b/frontend/tests/acceptance/library/index.js index e2d24e25d..276079631 100644 --- a/frontend/tests/acceptance/library/index.js +++ b/frontend/tests/acceptance/library/index.js @@ -20,18 +20,27 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) => await page.openNav(); await t .click(Selector(".nav-calendar")); - await page.search("December 2013"); + if (t.browser.platform === "mobile") { + console.log(t.browser.platform); + await t.navigateTo("/calendar?q=December%202013"); + } else { await page.search("December 2013");} await t .expect(Selector("h3").withText("Couldn't find anything").visible) .ok(); await page.openNav(); await t .click(Selector(".nav-folders")); - await page.search("Moment"); + if (t.browser.platform === "mobile") { + console.log(t.browser.platform); + await t.navigateTo("/folders?q=moment"); + } else { await page.search("Moment");} await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); await page.openNav(); await t.click(Selector(".nav-places + div > i")).click(Selector(".nav-states")); - await page.search("KwaZulu"); + if (t.browser.platform === "mobile") { + console.log(t.browser.platform); + await t.navigateTo("/states?q=KwaZulu"); + } else { await page.search("KwaZulu");} await t.expect(Selector("h3").withText("Couldn't find anything").visible).ok(); await page.openNav(); await t @@ -69,7 +78,10 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) => await t .click(Selector(".nav-calendar")) .click(Selector(".action-reload")); - await page.search("December 2013"); + if (t.browser.platform === "mobile") { + console.log(t.browser.platform); + await t.navigateTo("/calendar?q=December%202013"); + } else { await page.search("December 2013");} await t .expect(Selector(".is-album").visible) .ok(); @@ -77,14 +89,20 @@ test.meta("testID", "library-index-001")("Index files from folder", async (t) => await t .click(Selector(".nav-folders")) .click(Selector(".action-reload")); - await page.search("Moment"); + if (t.browser.platform === "mobile") { + console.log(t.browser.platform); + await t.navigateTo("/folders?q=moment"); + } else { await page.search("Moment");} await t.expect(Selector(".is-album").visible).ok(); await page.openNav(); await t .click(Selector(".nav-places+div>i")) .click(Selector(".nav-states")) .click(Selector(".action-reload")); - await page.search("KwaZulu"); + if (t.browser.platform === "mobile") { + console.log(t.browser.platform); + await t.navigateTo("/states?q=KwaZulu"); + } else { await page.search("KwaZulu");} await t.expect(Selector(".is-album").visible).ok(); await page.openNav(); await t diff --git a/frontend/tests/acceptance/settings/general.js b/frontend/tests/acceptance/settings/general.js index 187d76209..fd369e53a 100644 --- a/frontend/tests/acceptance/settings/general.js +++ b/frontend/tests/acceptance/settings/general.js @@ -113,15 +113,19 @@ test.meta("testID", "settings-general-001")("General Settings", async (t) => { .notOk() .expect(Selector("button.action-private").exists) .notOk(); - await page.toggleSelectNthPhoto(0); - await t.click(Selector("div.is-photo").nth(0)); + // await t - .expect(Selector("#p-photo-viewer").visible) + .hover(Selector(".is-photo.type-image").nth(0)) + .click(Selector(".is-photo.type-image .action-fullscreen").nth(0)); + await t + .expect(Selector("#p-photo-viewer", { timeout: 5000 }).visible) .ok() .expect(Selector(".action-download").exists) .notOk() .click(Selector(".action-close")) .click(Selector(".action-close")) + await page.toggleSelectNthPhoto(0); + await t .expect(Selector("button.action-location").exists) .notOk() .click(Selector("button.action-title-edit").nth(0))