2019-05-21 17:00:46 +02:00
|
|
|
import { Selector } from 'testcafe';
|
|
|
|
import testcafeconfig from './testcafeconfig';
|
|
|
|
import Page from "./page-model";
|
|
|
|
|
|
|
|
fixture`Test photos page`
|
|
|
|
.page`${testcafeconfig.url}`;
|
|
|
|
|
|
|
|
const page = new Page();
|
|
|
|
|
|
|
|
test('Select photos', async t => {
|
2019-06-20 16:17:43 +02:00
|
|
|
const countSelected = await Selector('div.p-photo-clipboard').innerText;
|
|
|
|
const countSelectedInt = (Number.isInteger(parseInt(countSelected))) ? parseInt(countSelected) : 0;
|
|
|
|
|
2019-05-21 17:00:46 +02:00
|
|
|
await t
|
|
|
|
.hover(Selector('div[class="v-image__image v-image__image--cover"]').nth(0))
|
|
|
|
.click(Selector('button.p-photo-select'))
|
|
|
|
.hover(Selector('div[class="v-image__image v-image__image--cover"]').nth(2))
|
2019-06-20 16:17:43 +02:00
|
|
|
.click(Selector('button.p-photo-select').nth(1));
|
|
|
|
|
|
|
|
const countSelectedAfterLike = await Selector('div.p-photo-clipboard').innerText;
|
|
|
|
const countSelectedAfterLikeInt = (Number.isInteger(parseInt(countSelectedAfterLike))) ? parseInt(countSelectedAfterLike) : 0;
|
|
|
|
|
|
|
|
await t
|
|
|
|
.expect(countSelectedAfterLikeInt).eql(countSelectedInt + 2)
|
|
|
|
.hover(Selector('div[class="v-image__image v-image__image--cover"]').nth(0))
|
|
|
|
.click(Selector('button.p-photo-select'))
|
|
|
|
|
|
|
|
const countSelectedAfterDislike = await Selector('div.p-photo-clipboard').innerText;
|
|
|
|
const countSelectedAfterDislikeInt = (Number.isInteger(parseInt(countSelectedAfterDislike))) ? parseInt(countSelectedAfterDislike) : 0;
|
|
|
|
|
|
|
|
await t
|
|
|
|
.expect(countSelectedAfterDislikeInt).eql(countSelectedAfterLikeInt -1);
|
|
|
|
|
2019-05-21 17:00:46 +02:00
|
|
|
await page.openNav();
|
|
|
|
await t
|
2019-05-28 03:49:44 +02:00
|
|
|
.click('a[href="/labels"]')
|
2019-06-09 04:37:02 +02:00
|
|
|
.expect(Selector('main .p-page-labels').exists, {timeout: 5000}).ok();
|
2019-05-21 17:00:46 +02:00
|
|
|
await page.openNav();
|
|
|
|
await t
|
|
|
|
.click('a[href="/photos"]')
|
2019-06-20 16:17:43 +02:00
|
|
|
.expect(countSelectedAfterDislikeInt).eql(countSelectedAfterLikeInt -1);
|
2019-05-21 17:59:12 +02:00
|
|
|
});
|