Tests: Update page-models
This commit is contained in:
parent
e61a8af05c
commit
2c0fdf89d6
12 changed files with 222 additions and 38 deletions
|
@ -44,7 +44,7 @@ export default class Page {
|
|||
}
|
||||
|
||||
async openNthAlbum(nth) {
|
||||
await t.click(Selector("a.is-album").nth(nth)).expect(Selector("div.is-photo").visible).ok();
|
||||
await t.click(Selector("a.is-album").nth(nth));
|
||||
}
|
||||
|
||||
async openAlbumWithUid(uid) {
|
||||
|
@ -64,7 +64,6 @@ export default class Page {
|
|||
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") {
|
||||
|
|
14
frontend/tests/page-model/dialog-share.js
Normal file
14
frontend/tests/page-model/dialog-share.js
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { Selector, t } from "testcafe";
|
||||
|
||||
export default class Page {
|
||||
constructor() {
|
||||
this.dialogClose = Selector("button.action-close", { timeout: 15000 });
|
||||
this.dialogSave = Selector("button.action-save", { timeout: 15000 });
|
||||
this.addLink = Selector(".action-add-link", { timeout: 15000 });
|
||||
this.deleteLink = Selector(".action-delete", { timeout: 15000 });
|
||||
this.expandLink = Selector("div.v-expansion-panel__header__icon", { timeout: 15000 });
|
||||
this.linkUrl = Selector("div.input-url input", { timeout: 15000 });
|
||||
this.linkSecretInput = Selector(".input-secret input", { timeout: 15000 });
|
||||
this.linkExpireInput = Selector(".input-expires input", { timeout: 15000 });
|
||||
}
|
||||
}
|
10
frontend/tests/page-model/library.js
Normal file
10
frontend/tests/page-model/library.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
import { Selector, t } from "testcafe";
|
||||
|
||||
export default class Page {
|
||||
constructor() {
|
||||
this.openImportFolderSelect = Selector(".input-import-folder input", { timeout: 15000 });
|
||||
this.import = Selector(".action-import");
|
||||
this.indexFolderSelect = Selector(".input-index-folder input", { timeout: 15000 });
|
||||
this.index = Selector(".action-index");
|
||||
}
|
||||
}
|
|
@ -21,7 +21,9 @@ export default class Page {
|
|||
(page === "review") |
|
||||
(page === "archive")
|
||||
) {
|
||||
await t.click(Selector("div.nav-browse + div"));
|
||||
if (!(await Selector("div.v-list__group--active div.nav-browse").visible)) {
|
||||
await t.click(Selector("div.nav-browse + div"));
|
||||
}
|
||||
} else if (page === "live") {
|
||||
if (!(await Selector("div.v-list__group--active div.nav-video").visible)) {
|
||||
await t.click(Selector("div.nav-video + div"));
|
||||
|
@ -34,7 +36,7 @@ export default class Page {
|
|||
if (!(await Selector("div.v-list__group--active div.nav-library").visible)) {
|
||||
await t.click(Selector("div.nav-library + div"));
|
||||
}
|
||||
} else if ((page === "abouts") | (page === "feedback") | (page === "license")) {
|
||||
} else if ((page === "about") | (page === "feedback") | (page === "license")) {
|
||||
if (!(await Selector("div.v-list__group--active div.nav-settings").visible)) {
|
||||
await t.click(Selector("div.nav-settings + div"));
|
||||
}
|
||||
|
@ -52,7 +54,9 @@ export default class Page {
|
|||
(page === "review") |
|
||||
(page === "archive")
|
||||
) {
|
||||
await t.click(Selector("div.nav-browse + div"));
|
||||
if (!(await Selector("div.v-list__group--active div.nav-browse").visible)) {
|
||||
await t.click(Selector("div.nav-browse + div"));
|
||||
}
|
||||
} else if (page === "live") {
|
||||
if (await Selector(".nav-video").visible) {
|
||||
if (!(await Selector("div.v-list__group--active div.nav-video").visible)) {
|
||||
|
|
|
@ -15,33 +15,28 @@ export default class Page {
|
|||
this.search1 = Selector("div.input-search input", { timeout: 15000 });
|
||||
}
|
||||
|
||||
//login
|
||||
|
||||
//logout
|
||||
//login Selectors
|
||||
|
||||
//review card actions
|
||||
|
||||
//open tab
|
||||
|
||||
// album with uid visible
|
||||
|
||||
// open album with uid
|
||||
//edit single fields / check disabled, selectors for single fields?
|
||||
// check edit form values // get all current edit form values // set edit form values
|
||||
|
||||
//?dialogs?
|
||||
|
||||
//checkboxen settings ?
|
||||
|
||||
// selectors for index/import/logs/ ? input folder edit dialog
|
||||
|
||||
//edit dialog disabled --funcionalities
|
||||
//edit dialog close, next, previous
|
||||
// edit dialog clear, reject face etc
|
||||
// update album --functionalities
|
||||
|
||||
//selectors card view album location/ subject count / label count
|
||||
|
||||
//remove album type from trigger context menu action
|
||||
//selectors edit dialogs label etc
|
||||
|
||||
//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/
|
||||
|
||||
}
|
||||
|
|
|
@ -23,6 +23,11 @@ export default class Page {
|
|||
return FolderCount;
|
||||
}
|
||||
|
||||
async getFileCount() {
|
||||
const FileCount = await Selector("div.is-file", { timeout: 5000 }).count;
|
||||
return FileCount;
|
||||
}
|
||||
|
||||
async selectFolderFromUID(uid) {
|
||||
await t
|
||||
.hover(Selector("div.is-folder").withAttribute("data-uid", uid))
|
||||
|
|
|
@ -1,14 +1,112 @@
|
|||
import { Selector, t } from "testcafe";
|
||||
import { RequestLogger } from "testcafe";
|
||||
import Menu from "./menu";
|
||||
import Album from "./album";
|
||||
import Toolbar from "./toolbar";
|
||||
import ContextMenu from "./context-menu";
|
||||
import Photo from "./photo";
|
||||
import PhotoViewer from "./photoviewer";
|
||||
import ShareDialog from "./dialog-share";
|
||||
|
||||
const logger = RequestLogger(/http:\/\/localhost:2343\/api\/v1\/*/, {
|
||||
logResponseHeaders: true,
|
||||
logResponseBody: true,
|
||||
});
|
||||
|
||||
const menu = new Menu();
|
||||
const album = new Album();
|
||||
const toolbar = new Toolbar();
|
||||
const contextmenu = new ContextMenu();
|
||||
const photo = new Photo();
|
||||
const photoviewer = new PhotoViewer();
|
||||
const sharedialog = new ShareDialog();
|
||||
|
||||
export default class Page {
|
||||
constructor() {
|
||||
this.selectOption = Selector("div.v-list__tile__title", { timeout: 15000 });
|
||||
this.cardTitle = Selector("button.action-title-edit");
|
||||
this.cardDescription = Selector('div[title="Description"]');
|
||||
this.cardLocation = Selector("button.action-location");
|
||||
}
|
||||
|
||||
async login(username, password) {
|
||||
await t
|
||||
.typeText(Selector(".input-name input"), username, { replace: true, timeout: 5000 })
|
||||
.typeText(Selector(".input-password input"), password, { replace: true })
|
||||
.click(Selector(".action-confirm"));
|
||||
}
|
||||
|
||||
//album location
|
||||
//photo title button.action-title-edit
|
||||
// photo decsription
|
||||
async logout() {
|
||||
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);
|
||||
await album.triggerHoverAction("uid", FirstAlbum, "select");
|
||||
//await this.selectFromUID(FirstAlbum);
|
||||
await contextmenu.checkContextMenuCount("1");
|
||||
await contextmenu.triggerContextMenuAction("share", "", "");
|
||||
await t.click(sharedialog.expandLink.nth(0));
|
||||
const InitialUrl = await sharedialog.linkUrl.innerText;
|
||||
const InitialSecret = await sharedialog.linkSecretInput.value;
|
||||
//const InitialUrl = await Selector(".action-url").innerText;
|
||||
// const InitialSecret = await Selector(".input-secret input").value;
|
||||
const InitialExpire = await Selector("div.v-select__selections").innerText;
|
||||
await t
|
||||
.expect(InitialUrl)
|
||||
.notContains("secretfortesting")
|
||||
.expect(InitialExpire)
|
||||
.contains("Never")
|
||||
.typeText(sharedialog.linkSecretInput, "secretForTesting", { replace: true })
|
||||
.click(sharedialog.linkExpireInput)
|
||||
.click(Selector("div").withText("After 1 day").parent('div[role="listitem"]'))
|
||||
.click(sharedialog.dialogSave)
|
||||
.click(sharedialog.dialogClose);
|
||||
await contextmenu.clearSelection();
|
||||
await album.openAlbumWithUid(FirstAlbum);
|
||||
await toolbar.triggerToolbarAction("share", "");
|
||||
await t.click(sharedialog.expandLink.nth(0));
|
||||
const UrlAfterChange = await sharedialog.linkUrl.innerText;
|
||||
const ExpireAfterChange = await Selector("div.v-select__selections").innerText;
|
||||
await t
|
||||
.expect(UrlAfterChange)
|
||||
.contains("secretfortesting")
|
||||
.expect(ExpireAfterChange)
|
||||
.contains("After 1 day")
|
||||
.typeText(sharedialog.linkSecretInput, InitialSecret, { replace: true })
|
||||
.click(sharedialog.linkExpireInput)
|
||||
.click(Selector("div").withText("Never").parent('div[role="listitem"]'))
|
||||
.click(sharedialog.dialogSave)
|
||||
.click(sharedialog.expandLink);
|
||||
const LinkCount = await Selector(".action-url").count;
|
||||
await t.click(sharedialog.addLink);
|
||||
const LinkCountAfterAdd = await Selector(".action-url").count;
|
||||
await t
|
||||
.expect(LinkCountAfterAdd)
|
||||
.eql(LinkCount + 1)
|
||||
.click(sharedialog.expandLink)
|
||||
.click(sharedialog.deleteLink);
|
||||
const LinkCountAfterDelete = await Selector(".action-url").count;
|
||||
await t
|
||||
.expect(LinkCountAfterDelete)
|
||||
.eql(LinkCountAfterAdd - 1)
|
||||
.click(sharedialog.dialogClose);
|
||||
await menu.openPage(type);
|
||||
await toolbar.triggerToolbarAction("reload", "");
|
||||
await album.triggerHoverAction("uid", FirstAlbum, "share");
|
||||
await t.click(sharedialog.expandLink).click(sharedialog.deleteLink);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,41 @@
|
|||
import { Selector, t } from "testcafe";
|
||||
|
||||
export default class Page {
|
||||
constructor() {}
|
||||
constructor() {
|
||||
this.dialogClose = Selector("div.v-dialog button.action-close", { timeout: 15000 });
|
||||
this.dialogNext = Selector("div.v-dialog button.action-next", { timeout: 15000 });
|
||||
this.dialogPrevious = Selector("div.v-dialog button.action-previous", { timeout: 15000 });
|
||||
|
||||
this.detailsDone = Selector(".p-form-photo-details-meta button.action-done", { timeout: 15000 });
|
||||
this.detailsApprove = Selector(".p-form-photo-details-meta button.action-approve", { timeout: 15000 });
|
||||
this.detailsClose = Selector(".p-form-photo-details-meta button.action-close", { timeout: 15000 });
|
||||
this.detailsApply = Selector(".p-form-photo-details-meta button.action-apply", { timeout: 15000 });
|
||||
|
||||
this.rejectName = Selector("div.input-name div.v-input__icon--clear", { timeout: 15000 });
|
||||
this.removeMarker = Selector("button.input-reject", { timeout: 15000 });
|
||||
this.undoRemoveMarker = Selector("button.action-undo", { timeout: 15000 });
|
||||
this.inputName = Selector("div.input-name input", { timeout: 15000 });
|
||||
|
||||
this.addLabel = Selector("button.p-photo-label-add", { timeout: 15000 });
|
||||
this.removeLabel = Selector("button.action-remove", { timeout: 15000 })
|
||||
this.activateLabel = Selector(".action-on", { timeout: 15000 });
|
||||
this.deleteLabel = Selector(".action-delete", { timeout: 15000 });
|
||||
this.inputLabelName = Selector(".input-label input", { timeout: 15000 });
|
||||
this.openInlineEdit = Selector("div.p-inline-edit", { timeout: 15000 });
|
||||
this.inputLabelRename = Selector(".input-rename input", { timeout: 15000 });
|
||||
|
||||
this.downloadFile = Selector("button.action-download", { timeout: 15000 });
|
||||
this.unstackFile = Selector(".action-unstack", { timeout: 15000 });
|
||||
this.deleteFile = Selector(".action-delete", { timeout: 15000 });
|
||||
this.makeFilePrimary = Selector(".action-primary", { timeout: 15000 });
|
||||
this.toggleExpandFile = Selector("li.v-expansion-panel__container", { timeout: 15000 });
|
||||
}
|
||||
|
||||
async getFileCount() {
|
||||
const FileCount = await Selector("li.v-expansion-panel__container", { timeout: 5000 }).count;
|
||||
return FileCount;
|
||||
}
|
||||
|
||||
// turn switch of --photo --edit
|
||||
async turnSwitchOff(type) {
|
||||
await t
|
||||
.click("#tab-info")
|
||||
|
@ -51,7 +83,6 @@ export default class Page {
|
|||
month,
|
||||
year,
|
||||
localTime,
|
||||
utcTime,
|
||||
timezone,
|
||||
country,
|
||||
altitude,
|
||||
|
@ -89,9 +120,6 @@ export default class Page {
|
|||
if (localTime !== "") {
|
||||
await t.expect(Selector(".input-local-time input").value).eql(localTime);
|
||||
}
|
||||
if (utcTime !== "") {
|
||||
await t.expect(Selector(".input-utc-time input").value).eql(utcTime);
|
||||
}
|
||||
if (altitude !== "") {
|
||||
await t.expect(Selector(".input-altitude input").value).eql(altitude);
|
||||
}
|
||||
|
|
|
@ -70,8 +70,13 @@ export default class Page {
|
|||
}
|
||||
}
|
||||
|
||||
async triggerListViewActions(nth, action) {
|
||||
await t.click(Selector(`td button.input-` + action).nth(nth));
|
||||
async triggerListViewActions(mode, uidOrnth, action) {
|
||||
if (mode === "nth") {
|
||||
await t.click(Selector(`td button.input-` + action).nth(uidOrnth));
|
||||
} else if (mode === "uid") {
|
||||
await t.click(Selector(`td button.input-` + action).withAttribute("data-uid", uidOrnth));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async checkListViewActionAvailability(action, disabled) {
|
||||
|
|
|
@ -17,10 +17,10 @@ export default class Page {
|
|||
|
||||
async getPhotoCount(type) {
|
||||
if (type === "all") {
|
||||
const PhotoCount = await Selector("div.is-photo", { timeout: 5000 }).count;
|
||||
const PhotoCount = await Selector("div.is-photo", { timeout: 2000 }).count;
|
||||
return PhotoCount;
|
||||
} else {
|
||||
const PhotoCount = await Selector("div.type-" + type, { timeout: 5000 }).count;
|
||||
const PhotoCount = await Selector("div.type-" + type, { timeout: 2000 }).count;
|
||||
return PhotoCount;
|
||||
}
|
||||
}
|
||||
|
@ -45,9 +45,9 @@ export default class Page {
|
|||
|
||||
async checkPhotoVisibility(uid, visible) {
|
||||
if (visible) {
|
||||
await t.expect(Selector("div.is-photo").withAttribute("data-uid", uid).visible).ok();
|
||||
await t.expect(Selector("div.is-photo").withAttribute("data-uid", uid).exists).ok();
|
||||
} else {
|
||||
await t.expect(Selector("div.is-photo").withAttribute("data-uid", uid).visible).notOk();
|
||||
await t.expect(Selector("div.is-photo").withAttribute("data-uid", uid).exists).notOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -30,15 +30,18 @@ export default class Page {
|
|||
|
||||
async checkPhotoViewerActionAvailability(action, visible) {
|
||||
if (visible) {
|
||||
await t.expect(Selector("div.pswp__top-bar button.action-" + action).visible).ok();
|
||||
await t.expect(Selector("button.pswp__button.action-" + action).visible).ok();
|
||||
} else {
|
||||
await t.expect(Selector("div.pswp__top-bar button.action-" + action).visible).notOk();
|
||||
await t.expect(Selector("button.pswp__button.action-" + action).visible).notOk();
|
||||
}
|
||||
}
|
||||
|
||||
//trigger fullscreen menu action (edit/like/close) --fullscreen
|
||||
async triggerPhotoViewerAction(action) {
|
||||
await t.click(Selector("div.pswp__top-bar button.action-" + action));
|
||||
await t.click(Selector("button.pswp__button.action-" + action));
|
||||
if (action === "close") {
|
||||
if (await Selector("button.pswp__button.action-" + action).visible) {
|
||||
await t.click(Selector("button.pswp__button.action-" + action));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
23
frontend/tests/page-model/settings.js
Normal file
23
frontend/tests/page-model/settings.js
Normal file
|
@ -0,0 +1,23 @@
|
|||
import { Selector, t } from "testcafe";
|
||||
|
||||
export default class Page {
|
||||
constructor() {
|
||||
this.languageInput = Selector(".input-language input", { timeout: 5000 });
|
||||
this.uploadCheckbox = Selector(".input-upload input", { timeout: 5000 });
|
||||
this.downloadCheckbox = Selector(".input-download input", { timeout: 5000 });
|
||||
this.importCheckbox = Selector(".input-import input", { timeout: 5000 });
|
||||
this.archiveCheckbox = Selector(".input-archive input", { timeout: 5000 });
|
||||
this.editCheckbox = Selector(".input-edit input", { timeout: 5000 });
|
||||
this.filesCheckbox = Selector(".input-files input", { timeout: 5000 });
|
||||
this.momentsCheckbox = Selector(".input-moments input", { timeout: 5000 });
|
||||
this.labelsCheckbox = Selector(".input-labels input", { timeout: 5000 });
|
||||
this.logsCheckbox = Selector(".input-logs input", { timeout: 5000 });
|
||||
this.shareCheckbox = Selector(".input-share input", { timeout: 5000 });
|
||||
this.placesCheckbox = Selector(".input-places input", { timeout: 5000 });
|
||||
this.privateCheckbox = Selector(".input-private input", { timeout: 5000 });
|
||||
this.peopleCheckbox = Selector(".input-people input", { timeout: 5000 });
|
||||
this.deleteCheckbox = Selector(".input-delete input", { timeout: 5000 });
|
||||
|
||||
this.reviewCheckbox = Selector(".input-review input", { timeout: 5000 });
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue