photoprism/frontend/tests/acceptance/settings/general.js

138 lines
6.4 KiB
JavaScript
Raw Normal View History

2020-06-04 11:11:26 +02:00
import { Selector } from 'testcafe';
import testcafeconfig from '../testcafeconfig';
import Page from "../page-model";
2020-06-04 11:11:26 +02:00
fixture `Test settings`
2020-06-04 18:25:29 +02:00
.page`${testcafeconfig.url}`;
2020-06-04 11:11:26 +02:00
const page = new Page();
2020-06-04 11:11:26 +02:00
//TODO test convert to jpeg, group files, places style
2020-06-04 18:25:29 +02:00
//TODO check download also disabled for albums/files/review/private
2020-06-04 11:11:26 +02:00
test('#1 Settings', async t => {
await page.openNav();
await t
.expect(Selector('.action-upload').exists, {timeout: 5000}).ok()
.expect(Selector('.nav-photos').innerText).contains('Photos');
2020-06-04 11:11:26 +02:00
await page.selectNthPhoto(0);
await t
2020-06-23 13:06:55 +02:00
.click(Selector('button.action-menu'))
.expect(Selector('button.action-download').visible).ok()
.expect(Selector('button.action-share').visible).ok()
.expect(Selector('button.action-edit').visible).ok()
.expect(Selector('button.action-private').visible).ok();
2020-06-04 11:11:26 +02:00
await page.unselectPhoto(0);
await t
.click(Selector('div.p-photo').nth(0));
await t
.expect(Selector('#p-photo-viewer').visible).ok()
.expect(Selector('.action-download').exists).ok()
.click(Selector('.action-close'))
.expect(Selector('button.action-location').visible).ok()
.click(Selector('button.action-title-edit').nth(0))
.expect(Selector('.input-title input').hasAttribute('disabled')).notOk()
2020-06-23 13:06:55 +02:00
.click(Selector('#tab-labels'))
2020-06-04 11:11:26 +02:00
.expect(Selector('button.p-photo-label-add').visible).ok()
2020-06-23 13:06:55 +02:00
.click(Selector('#tab-details'))
2020-06-04 11:11:26 +02:00
.click(Selector('button.action-close'))
.click(Selector('.nav-library'))
2020-06-04 11:11:26 +02:00
.expect(Selector('#tab-import a').visible).ok()
.expect(Selector('#tab-logs a').visible).ok()
.click(Selector('div.nav-photos + div'))
.expect(Selector('.nav-archive').visible).ok()
.expect(Selector('.nav-review').visible).ok()
.click(Selector('div.nav-library + div'))
.expect(Selector('.nav-originals').visible).ok()
.click(Selector('div.nav-albums + div'))
.expect(Selector('.nav-folders').visible).ok()
.expect(Selector('.nav-moments').visible).ok()
.expect(Selector('.nav-labels').visible).ok()
.expect(Selector('.nav-places').visible).ok()
.expect(Selector('.nav-private').visible).ok()
2020-06-04 11:11:26 +02:00
.click(Selector('.nav-settings'))
2020-06-04 11:11:26 +02:00
.click(Selector('.input-language input'))
.hover(Selector('div').withText('German').parent('div[role="listitem"]'))
.click(Selector('div').withText('German').parent('div[role="listitem"]'))
.click(Selector('.nav-settings'))
2020-06-04 11:11:26 +02:00
.click(Selector('.input-upload input'))
.click(Selector('.input-download input'))
.click(Selector('.input-import input'))
.click(Selector('.input-archive input'))
.click(Selector('.input-edit input'))
.click(Selector('.input-files input'))
.click(Selector('.input-moments input'))
.click(Selector('.input-labels input'))
.click(Selector('.input-logs input'))
.click(Selector('.input-share input'))
.click(Selector('.input-places input'))
.click(Selector('.input-private input'))
2020-06-05 15:22:16 +02:00
.click(Selector('.input-review input'))
.click(Selector('.nav-photos'));
2020-06-04 11:11:26 +02:00
await t.eval(() => location.reload());
await page.openNav();
await t
.expect(Selector('button.action-upload').exists).notOk()
.expect(Selector('.nav-photos').innerText).contains('Fotos');
2020-06-04 11:11:26 +02:00
await page.selectNthPhoto(0);
await t
2020-06-23 13:06:55 +02:00
.click(Selector('button.action-menu'))
.expect(Selector('button.action-download').exists).notOk()
.expect(Selector('button.action-share').exists).notOk()
.expect(Selector('button.action-edit').visible).notOk()
.expect(Selector('button.action-private').exists).notOk();
2020-06-04 11:11:26 +02:00
await page.unselectPhoto(0);
await t
.click(Selector('div.p-photo').nth(0));
await t
.expect(Selector('#p-photo-viewer').visible).ok()
.expect(Selector('.action-download').exists).notOk()
.click(Selector('.action-close'))
.expect(Selector('button.action-location').exists).notOk()
.click(Selector('button.action-title-edit').nth(0))
.expect(Selector('.input-title input').hasAttribute('disabled')).ok()
.expect(Selector('.input-latitude input').hasAttribute('disabled')).ok()
.expect(Selector('.input-timezone input').hasAttribute('disabled')).ok()
.expect(Selector('.input-country input').hasAttribute('disabled')).ok()
.expect(Selector('.input-description textarea').hasAttribute('disabled')).ok()
.expect(Selector('.input-keywords textarea').hasAttribute('disabled')).ok()
2020-06-23 13:06:55 +02:00
.click(Selector('#tab-labels'))
2020-06-04 11:11:26 +02:00
.expect(Selector('button.p-photo-label-add').exists).notOk()
2020-06-23 13:06:55 +02:00
.click(Selector('#tab-details'))
2020-06-04 11:11:26 +02:00
.click(Selector('button.action-close'))
.click(Selector('.nav-library'))
2020-06-04 11:11:26 +02:00
.expect(Selector('#tab-import a').exists).notOk()
.expect(Selector('#tab-logs a').exists).notOk()
.click(Selector('div.nav-photos + div'))
.expect(Selector('.nav-archive').visible).notOk()
.expect(Selector('.nav-review').exists).notOk()
.click(Selector('div.nav-library + div'))
.expect(Selector('.nav-originals').visible).notOk()
.click(Selector('div.nav-albums + div'))
.expect(Selector('.nav-moments').visible).notOk()
.expect(Selector('.nav-labels').visible).notOk()
.expect(Selector('.nav-places').visible).notOk()
.expect(Selector('.nav-private').visible).notOk()
2020-06-04 11:11:26 +02:00
.click(Selector('.nav-settings'))
2020-06-04 11:11:26 +02:00
.click(Selector('.input-language input'))
.hover(Selector('div').withText('Englisch').parent('div[role="listitem"]'))
.click(Selector('div').withText('Englisch').parent('div[role="listitem"]'))
.click(Selector('.nav-settings'))
2020-06-04 11:11:26 +02:00
.click(Selector('.input-upload input'))
.click(Selector('.input-download input'))
.click(Selector('.input-import input'))
.click(Selector('.input-archive input'))
.click(Selector('.input-edit input'))
.click(Selector('.input-files input'))
.click(Selector('.input-moments input'))
.click(Selector('.input-labels input'))
.click(Selector('.input-logs input'))
.click(Selector('.input-share input'))
.click(Selector('.input-places input'))
.click(Selector('.input-private input'))
.click(Selector('.input-review input'));
2020-06-04 18:25:29 +02:00
});