Tests: Update subject page-model
This commit is contained in:
parent
3dff2efbb0
commit
3dc390f8cb
1 changed files with 75 additions and 0 deletions
|
@ -30,4 +30,79 @@ export default class Page {
|
|||
.hover(Selector("a.is-subject", { timeout: 4000 }).nth(nth))
|
||||
.click(Selector("a.is-subject .input-select").nth(nth));
|
||||
}
|
||||
|
||||
//hidden, favorite, select
|
||||
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") {
|
||||
await t.hover(Selector("a.is-subject").nth(uidOrNth));
|
||||
await t.click(Selector(`.input-` + action));
|
||||
}
|
||||
}
|
||||
|
||||
async checkHoverActionAvailability(mode, uidOrNth, action, visible) {
|
||||
if (mode === "uid") {
|
||||
await t.hover(Selector("a.is-subject").withAttribute("data-uid", uidOrNth));
|
||||
if (visible) {
|
||||
await t.expect(Selector(`.uid-${uidOrNth} .input-` + action).visible).ok();
|
||||
} else {
|
||||
await t.expect(Selector(`.uid-${uidOrNth} .input-` + action).visible).notOk();
|
||||
}
|
||||
}
|
||||
if (mode === "nth") {
|
||||
await t.hover(Selector("a.is-subject div.v-card__title").nth(uidOrNth));
|
||||
if (visible) {
|
||||
await t.expect(Selector(`.input-` + action).visible).ok();
|
||||
} else {
|
||||
await t.expect(Selector(`.input-` + action).visible).notOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async checkSubjectVisibility(name, visible) {
|
||||
if (visible) {
|
||||
await t.expect(Selector("a div.v-card__title").withText(name).visible).ok();
|
||||
} else {
|
||||
await t.expect(Selector("a div.v-card__title").withText(name).visible).notOk();
|
||||
}
|
||||
}
|
||||
|
||||
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));
|
||||
if (set) {
|
||||
await t.expect(Selector(`a.uid-${uidOrNth}`).hasClass("is-" + action)).ok();
|
||||
} else {
|
||||
await t.expect(Selector(`a.uid-${uidOrNth}`).hasClass("is-" + action)).notOk();
|
||||
}
|
||||
}
|
||||
if (mode === "nth") {
|
||||
await t.hover(Selector("a.is-subject").nth(uidOrNth));
|
||||
if (set) {
|
||||
await t
|
||||
.expect(
|
||||
Selector("a.is-subject")
|
||||
.nth(uidOrNth)
|
||||
.hasClass("is-" + action)
|
||||
)
|
||||
.ok();
|
||||
} else {
|
||||
await t
|
||||
.expect(
|
||||
Selector("a.is-subject")
|
||||
.nth(uidOrNth)
|
||||
.hasClass("is-" + action)
|
||||
)
|
||||
.notOk();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue