photoprism/frontend/tests/acceptance/places.js

33 lines
1.1 KiB
JavaScript
Raw Normal View History

2019-05-21 17:00:46 +02:00
import { Selector } from 'testcafe';
import testcafeconfig from './testcafeconfig';
import Page from "./page-model";
2019-06-22 15:14:32 +02:00
import { RequestLogger } from 'testcafe';
const logger = RequestLogger( /http:\/\/localhost:2342\/api\/v1\/photos*/ , {
logResponseHeaders: true,
logResponseBody: true
});
2019-05-21 17:00:46 +02:00
fixture`Test places page`
2019-06-22 15:14:32 +02:00
.page `localhost:2342/places`
.requestHooks(logger);
2019-05-21 17:00:46 +02:00
const page = new Page();
test('Test places', async t => {
await t
2019-06-22 15:14:32 +02:00
.expect(Selector('div.leaflet-map-pane').exists, {timeout: 15000}).ok()
2019-05-21 17:00:46 +02:00
.expect(Selector('img.leaflet-marker-icon').visible).ok()
2019-06-22 15:14:32 +02:00
const request = await logger.requests[0];
await t
.expect(logger.requests[0].response.statusCode).eql(200)
logger.clear();
await t
2019-05-21 17:00:46 +02:00
.typeText(Selector('input[aria-label="Search"]'), 'Berlin')
2019-06-22 15:14:32 +02:00
.pressKey('enter');
const request2 = await logger.requests[0];
await t
.expect(Selector('img.leaflet-marker-icon').visible).ok()
.expect(logger.requests[0].response.statusCode).eql(200, 'status code equals 200')
.expect(logger.requests[0].request.url).contains('q=Berlin');
2019-05-21 17:00:46 +02:00
});