Tests: Refactored library tests

This commit is contained in:
theresa 2022-01-21 17:51:54 +01:00
parent e5b70a5fb2
commit 65e4ba4eea
2 changed files with 139 additions and 0 deletions

View file

@ -0,0 +1,31 @@
import { Selector } from "testcafe";
import testcafeconfig from "../testcafeconfig";
import Menu from "../../page-model/menu";
import Toolbar from "../../page-model/toolbar";
import NewPage from "../../page-model/page";
import Library from "../../page-model/library";
fixture`Import file from folder`.page`${testcafeconfig.url}`;
const menu = new Menu();
const toolbar = new Toolbar();
const newpage = new NewPage();
const library = new Library();
test.meta("testID", "library-import-001")("Import files from folder using copy", async (t) => {
await menu.openPage("labels");
await toolbar.search("bakery");
await t.expect(Selector("div.no-results").visible).ok();
await menu.openPage("library");
await t
.click(Selector("#tab-library-import"))
.typeText(library.openImportFolderSelect, "/B", { replace: true })
.click(newpage.selectOption.nth(0))
.click(library.import)
//TODO replace wait
.wait(60000);
await menu.openPage("labels");
await toolbar.triggerToolbarAction("reload", "");
await toolbar.search("bakery");
await t.expect(Selector(".is-label").visible).ok();
});

View file

@ -0,0 +1,108 @@
import { Selector } from "testcafe";
import testcafeconfig from "../testcafeconfig";
import Menu from "../../page-model/menu";
import Toolbar from "../../page-model/toolbar";
import Photo from "../../page-model/photo";
import NewPage from "../../page-model/page";
import Library from "../../page-model/library";
import Album from "../../page-model/album";
fixture`Test index`.page`${testcafeconfig.url}`;
const menu = new Menu();
const toolbar = new Toolbar();
const photo = new Photo();
const newpage = new NewPage();
const library = new Library();
const album = new Album();
test.meta("testID", "library-index-001")("Index files from folder", async (t) => {
await menu.openPage("labels");
await toolbar.search("cheetah");
await t.expect(Selector("div.no-results").visible).ok();
await menu.openPage("moments");
const MomentCount = await album.getAlbumCount("all");
await menu.openPage("calendar");
if (t.browser.platform === "mobile") {
await t.navigateTo("/calendar?q=December%202013");
} else {
await toolbar.search("December 2013");
}
await t.expect(Selector("div.no-results").visible).ok();
await menu.openPage("folders");
if (t.browser.platform === "mobile") {
await t.navigateTo("/folders?q=moment");
} else {
await toolbar.search("Moment");
}
await t.expect(Selector("div.no-results").visible).ok();
await menu.openPage("states");
if (t.browser.platform === "mobile") {
console.log(t.browser.platform);
await t.navigateTo("/states?q=KwaZulu");
} else {
await toolbar.search("KwaZulu");
}
await t.expect(Selector("div.no-results").visible).ok();
await menu.openPage("originals");
await t
.click(Selector(".is-folder").withText("moment"))
.expect(Selector("div.no-results").visible)
.ok();
await menu.openPage("monochrome");
const MonochromeCount = await photo.getPhotoCount("all");
await menu.openPage("library");
await t
.click(Selector("#tab-library-index"))
.click(library.indexFolderSelect)
.click(newpage.selectOption.withText("/moment"))
.click(library.index)
//TODO replace wait
.wait(50000)
.expect(Selector("span").withText("Done.").visible, { timeout: 60000 })
.ok();
await menu.openPage("labels");
await toolbar.triggerToolbarAction("reload", "");
await toolbar.search("cheetah");
await t.expect(Selector(".is-label").visible).ok();
await menu.openPage("moments");
const MomentCountAfterIndex = await album.getAlbumCount("all");
await t
.expect(MomentCountAfterIndex)
.gt(MomentCount)
.click(Selector("a").withText("South Africa 2013"))
.expect(Selector(".is-photo").visible)
.ok();
await menu.openPage("calendar");
await toolbar.triggerToolbarAction("reload", "");
if (t.browser.platform === "mobile") {
console.log(t.browser.platform);
await t.navigateTo("/calendar?q=December%202013");
} else {
await toolbar.search("December 2013");
}
await t.expect(Selector(".is-album").visible).ok();
await menu.openPage("folders");
await toolbar.triggerToolbarAction("reload", "");
if (t.browser.platform === "mobile") {
console.log(t.browser.platform);
await t.navigateTo("/folders?q=moment");
} else {
await toolbar.search("Moment");
}
await t.expect(Selector(".is-album", { timeout: 15000 }).visible).ok();
await menu.openPage("states");
if (t.browser.platform === "mobile") {
console.log(t.browser.platform);
await t.navigateTo("/states?q=KwaZulu");
} else {
await toolbar.search("KwaZulu");
}
await t.expect(Selector(".is-album").visible).ok();
await menu.openPage("originals");
await t.expect(Selector(".is-folder").withText("moment").visible, { timeout: 60000 }).ok();
await menu.openPage("monochrome");
const MonochromeCountAfterIndex = await photo.getPhotoCount("all");
await t.expect(MonochromeCountAfterIndex).gt(MonochromeCount);
});