photoprism/frontend/tests/acceptance/components.js

61 lines
1.8 KiB
JavaScript
Raw Normal View History

2020-06-04 18:25:29 +02:00
import { Selector } from 'testcafe';
import testcafeconfig from './testcafeconfig';
import Page from './page-model';
2020-06-04 18:25:29 +02:00
fixture`Test components`
.page`${testcafeconfig.url}`;
2020-06-04 18:25:29 +02:00
const page = new Page();
2021-01-14 17:57:38 +01:00
test
.meta('testID', 'components-001')
('Test filter options', async t => {
2020-06-04 18:25:29 +02:00
await t
2020-06-05 15:22:16 +02:00
.click('button.p-expand-search')
.expect(Selector('body').withText('object Object').exists).notOk();
});
2020-06-04 18:25:29 +02:00
2021-01-14 17:57:38 +01:00
test
.meta('testID', 'components-002')
('Fullscreen mode', async t => {
2020-06-04 18:25:29 +02:00
await t
.click(Selector('div.v-image__image').nth(0))
.expect(Selector('#p-photo-viewer').visible).ok()
.expect(Selector('img.pswp__img').visible).ok();
});
2021-01-14 17:57:38 +01:00
test
.meta('testID', 'components-003')
('Mosaic view', async t => {
2020-06-04 18:25:29 +02:00
await t
.click('button.p-expand-search');
await page.setFilter('view', 'Mosaic');
await t
.expect(Selector('div.v-image__image').visible).ok()
.expect(Selector('div.p-photo-mosaic').visible).ok()
.expect(Selector('div.is-photo div.caption').exists).notOk()
2020-06-04 18:25:29 +02:00
.expect(Selector('#p-photo-viewer').visible).notOk();
});
2021-01-14 17:57:38 +01:00
test
.meta('testID', 'components-004')
('List view', async t => {
2020-06-04 18:25:29 +02:00
await t
.click('button.p-expand-search');
await page.setFilter('view', 'List');
await t
.expect(Selector('table.v-datatable').visible).ok()
.expect(Selector('div.list-view').visible).ok();
2020-06-04 18:25:29 +02:00
});
2021-01-14 17:57:38 +01:00
test
.meta('testID', 'components-005')
('#Card view', async t => {
2020-06-04 18:25:29 +02:00
await t
.click('button.p-expand-search');
await page.setFilter('view', 'Cards');
await t
.expect(Selector('div.v-image__image').visible).ok()
.expect(Selector('div.is-photo div.caption').visible).ok()
2020-06-04 18:25:29 +02:00
.expect(Selector('#p-photo-viewer').visible).notOk();
});