photoprism/frontend/tests/acceptance/favorites.js
2019-06-20 14:38:22 +02:00

37 lines
1.2 KiB
JavaScript

import { Selector } from 'testcafe';
import testcafeconfig from './testcafeconfig';
import Page from "./page-model";
fixture`Test favorites page`
.page `localhost:2342/favorites`;
const page = new Page();
test('Like photo', async t => {
const FavoritesCount = await Selector('button.p-photo-like').count;
await t
.navigateTo("../photos")
.hover(Selector('div[class="v-image__image v-image__image--cover"]').nth(5))
.click(Selector('button.p-photo-like'))
.navigateTo("../favorites");
const FavoritesCountAfterLike = await Selector('button.p-photo-like').count;
await t
.expect(FavoritesCountAfterLike).eql(FavoritesCount + 1)
.expect(Selector('div.v-image__image').visible).ok();
}),
test('Dislike photo', async t => {
const FavoritesCount = await Selector('button.p-photo-like').count;
await t
.hover(Selector('div[class="v-image__image v-image__image--cover"]').nth(0))
.click(Selector('button.p-photo-like'))
.navigateTo("../favorites");
const FavoritesCountAfterDislike = await Selector('button.p-photo-like').count;
await t
.expect(FavoritesCountAfterDislike).eql(FavoritesCount - 1);
});