2019-05-21 17:00:46 +02:00
|
|
|
import { Selector } from 'testcafe';
|
|
|
|
import testcafeconfig from './testcafeconfig';
|
|
|
|
import Page from "./page-model";
|
|
|
|
|
2019-06-27 17:02:02 +02:00
|
|
|
fixture`Test clipboard`
|
2019-05-21 17:00:46 +02:00
|
|
|
.page`${testcafeconfig.url}`;
|
|
|
|
|
|
|
|
const page = new Page();
|
|
|
|
|
2019-06-27 17:02:02 +02:00
|
|
|
test('Test selecting photos and clear clipboard', 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-07-02 18:16:55 +02:00
|
|
|
await page.selectPhoto(0);
|
|
|
|
await page.selectPhoto(2);
|
2019-06-20 16:17:43 +02:00
|
|
|
|
2019-07-02 18:16:55 +02:00
|
|
|
const countSelectedAfterSelect = await Selector('div.p-photo-clipboard').innerText;
|
|
|
|
const countSelectedAfterSelectInt = (Number.isInteger(parseInt(countSelectedAfterSelect))) ? parseInt(countSelectedAfterSelect) : 0;
|
2019-06-20 16:17:43 +02:00
|
|
|
|
|
|
|
await t
|
2019-07-02 18:16:55 +02:00
|
|
|
.expect(countSelectedAfterSelectInt).eql(countSelectedInt + 2)
|
|
|
|
await page.unselectPhoto(0);
|
2019-06-20 16:17:43 +02:00
|
|
|
|
2019-07-02 18:16:55 +02:00
|
|
|
const countSelectedAfterUnselect = await Selector('div.p-photo-clipboard').innerText;
|
|
|
|
const countSelectedAfterUnselectInt = (Number.isInteger(parseInt(countSelectedAfterUnselect))) ? parseInt(countSelectedAfterUnselect) : 0;
|
2019-06-20 16:17:43 +02:00
|
|
|
|
|
|
|
await t
|
2019-07-02 18:16:55 +02:00
|
|
|
.expect(countSelectedAfterUnselectInt).eql(countSelectedAfterSelectInt -1);
|
2019-06-20 16:17:43 +02:00
|
|
|
|
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-07-02 18:16:55 +02:00
|
|
|
.expect(countSelectedAfterUnselectInt).eql(countSelectedAfterSelectInt -1)
|
2019-06-27 17:02:02 +02:00
|
|
|
.click(Selector('div.p-photo-clipboard'))
|
|
|
|
.click(Selector('.p-photo-clipboard-clear'), {timeout: 15000});
|
|
|
|
const countSelectedAfterClear = await Selector('div.p-photo-clipboard').innerText;
|
|
|
|
await t
|
|
|
|
.expect(countSelectedAfterClear).contains('menu');
|
2019-05-21 17:59:12 +02:00
|
|
|
});
|