Tests: Update page models

This commit is contained in:
theresa 2022-01-24 15:49:15 +01:00
parent 86f6cf0de9
commit 537f64cb9e
9 changed files with 43 additions and 98 deletions

View file

@ -59,8 +59,6 @@ export default class Page {
}
}
//favorite, select, share
//TODO rename share class
async triggerHoverAction(mode, uidOrNth, action) {
if (mode === "uid") {
await t.hover(Selector("a.uid-" + uidOrNth));

View file

@ -3,21 +3,17 @@ import { Selector, t } from "testcafe";
export default class Page {
constructor() {}
//open context menu -- context menu
async openContextMenu() {
if (!(await Selector(".action-clear").visible)) {
await t.click(Selector("button.action-menu"));
}
}
//check context menu count -- context menu
async checkContextMenuCount(count) {
const Count = await Selector("span.count-clipboard", { timeout: 5000 });
await t.expect(Count.textContent).eql(count);
}
//check context menu action availability (all)
//TODO Use foreach
async checkContextMenuActionAvailability(action, visible) {
await this.openContextMenu();
if (visible) {
@ -27,19 +23,19 @@ export default class Page {
}
}
//trigger context menu action (edit/delete/share/archive/restore.....)
async triggerContextMenuAction(action, albumName, albumType) {
async triggerContextMenuAction(action, albumName) {
await this.openContextMenu();
await t.click(Selector("#t-clipboard button.action-" + action));
if (action === "delete") {
await t.click(Selector("button.action-confirm"));
}
if ((action === "album") | (action === "clone")) {
await t.typeText(Selector(".input-album input"), albumName, { replace: true }).pressKey("enter");
await t
.typeText(Selector(".input-album input"), albumName, { replace: true })
.pressKey("enter");
}
}
//clear selection -- context menu
async clearSelection() {
await this.openContextMenu();
await t.click(Selector(".action-clear"));

View file

@ -33,7 +33,6 @@ export default class Page {
await t.click(Selector("a.is-label").withAttribute("data-uid", uid));
}
// favorite, select
async triggerHoverAction(mode, uidOrNth, action) {
if (mode === "uid") {
await t.hover(Selector("a.uid-" + uidOrNth));

View file

@ -1,42 +0,0 @@
import { Selector, t } from "testcafe";
import { RequestLogger } from "testcafe";
const logger = RequestLogger(/http:\/\/localhost:2343\/api\/v1\/*/, {
logResponseHeaders: true,
logResponseBody: true,
});
export default class Page {
constructor() {
this.view = Selector("div.p-view-select", { timeout: 15000 });
this.camera = Selector("div.p-camera-select", { timeout: 15000 });
this.countries = Selector("div.p-countries-select", { timeout: 15000 });
this.time = Selector("div.p-time-select", { timeout: 15000 });
this.search1 = Selector("div.input-search input", { timeout: 15000 });
}
//login Selectors
//review card actions
//open tab
//edit single fields / check disabled, selectors for single fields?
// check edit form values // get all current edit form values // set edit form values
//?dialogs?
//edit dialog disabled --funcionalities
// update album --functionalities
//selectors card view album location/ subject count / label count
//remove album type from trigger context menu action
//sharing
//update all tests with new selectors
//refactor admin/ member tests --> for each resource (photo, video, subject, label, albums , states) check context menu action/fullscreen actions/edit dialog/
}

View file

@ -36,18 +36,6 @@ export default class Page {
await t.click(Selector("div.nav-logout"));
}
async validateDownloadRequest(request, filename, extension) {
const downloadedFileName = request.headers["content-disposition"];
await t
.expect(request.statusCode === 200)
.ok()
.expect(downloadedFileName)
.contains(filename)
.expect(downloadedFileName)
.contains(extension);
await logger.clear();
}
async testCreateEditDeleteSharingLink(type) {
await menu.openPage(type);
const FirstAlbum = await album.getNthAlbumUid("all", 0);
@ -102,4 +90,16 @@ export default class Page {
await album.triggerHoverAction("uid", FirstAlbum, "share");
await t.click(sharedialog.expandLink).click(sharedialog.deleteLink);
}
async validateDownloadRequest(request, filename, extension) {
const downloadedFileName = request.headers["content-disposition"];
await t
.expect(request.statusCode === 200)
.ok()
.expect(downloadedFileName)
.contains(filename)
.expect(downloadedFileName)
.contains(extension);
await logger.clear();
}
}

View file

@ -31,6 +31,11 @@ export default class Page {
this.toggleExpandFile = Selector("li.v-expansion-panel__container", { timeout: 15000 });
}
//edit single fields / check disabled, selectors for single fields?
// check edit form values // get all current edit form values // set edit form values
//edit dialog disabled --funcionalities
async getFileCount() {
const FileCount = await Selector("li.v-expansion-panel__container", { timeout: 5000 }).count;
return FileCount;

View file

@ -76,7 +76,6 @@ export default class Page {
} else if (mode === "uid") {
await t.click(Selector(`td button.input-` + action).withAttribute("data-uid", uidOrnth));
}
}
async checkListViewActionAvailability(action, disabled) {

View file

@ -18,16 +18,16 @@ export default class Page {
return SubjectCount;
}
async getMarkerCount() {
const MarkerCount = await Selector("div.is-marker", { timeout: 5000 }).count;
return MarkerCount;
}
async getFaceCount() {
const FaceCount = await Selector("div.is-face", { timeout: 5000 }).count;
return FaceCount;
}
async getMarkerCount() {
const MarkerCount = await Selector("div.is-marker", { timeout: 5000 }).count;
return MarkerCount;
}
async selectSubjectFromUID(uid) {
await t
.hover(Selector("a.is-subject").withAttribute("data-uid", uid))
@ -76,11 +76,17 @@ export default class Page {
}
}
//hidden, favorite, select
async triggerToolbarAction(action) {
if (await Selector("form.p-faces-search button.action-" + action).visible) {
await t.click(Selector("form.p-faces-search button.action-" + action));
} else if (await Selector("form.p-people-search button.action-" + action).visible) {
await t.click(Selector("form.p-people-search button.action-" + action));
}
}
async triggerHoverAction(mode, uidOrNth, action) {
if (mode === "uid") {
await t.hover(Selector("a.uid-" + uidOrNth));
//Selector("a.uid-" + uidOrNth + " .input-" + action);
await t.click(Selector("a.uid-" + uidOrNth + " .input-" + action));
}
if (mode === "nth") {
@ -113,18 +119,6 @@ export default class Page {
}
}
async triggerToolbarAction(action) {
if (await Selector("form.p-faces-search button.action-" + action).visible) {
await t.click(Selector("form.p-faces-search button.action-" + action));
} else if (await Selector("form.p-people-search button.action-" + action).visible) {
await t.click(Selector("form.p-people-search button.action-" + action));
}
}
async openNthSubject(nth) {
await t.click(Selector("a.is-subject").nth(nth)).expect(Selector("div.is-photo").visible).ok();
}
async checkHoverActionState(mode, uidOrNth, action, set) {
if (mode === "uid") {
await t.hover(Selector("a").withAttribute("data-uid", uidOrNth));

View file

@ -11,11 +11,6 @@ export default class Page {
this.toolbarTitle = Selector("div.v-toolbar__title");
}
async toggleFilterBar() {
await t.click(Selector("nav.page-toolbar button.action-expand-search"));
}
//check availability
async checkToolbarActionAvailability(action, visible) {
if (visible) {
await t.expect(Selector("nav.page-toolbar button.action-" + action).visible).ok();
@ -24,12 +19,18 @@ export default class Page {
}
}
//click trigger action on toolbar -- toolbar --album (reload, switch view, upload, add album, hide/show,
async triggerToolbarAction(action, name) {
async triggerToolbarAction(action) {
await t.click(Selector("nav.page-toolbar button.action-" + action));
}
//TODO refactor selectors
async toggleFilterBar() {
await t.click(Selector("nav.page-toolbar button.action-expand-search"));
}
async search(term) {
await t.typeText(this.search1, term, { replace: true }).pressKey("enter");
}
async setFilter(filter, option) {
let filterSelector = "";
@ -63,9 +64,4 @@ export default class Page {
await t.click(Selector('div[role="listitem"]').nth(1), { timeout: 15000 });
}
}
//search --toolbar
async search(term) {
await t.typeText(this.search1, term, { replace: true }).pressKey("enter");
}
}