describe('Search Page', function () {
let page;
+ // eslint-disable-next-line mocha/no-setup-in-describe
+ if (process.env.REVERSE_ONLY) return;
+
describe('No search', function () {
before(async function () {
page = await browser.newPage();
});
});
- describe('Search for City of London', function () {
+ describe('Search for Paris', function () {
before(async function () {
page = await browser.newPage();
await page.goto('http://localhost:9999/search.html');
- await page.type('input[name=q]', 'City of London');
+ await page.type('input[name=q]', 'Paris');
await page.click('button[type=submit]');
await page.waitForSelector('#searchresults');
// await page.screenshot({ path: "./screen.png", fullPage: true });
});
it('should have a HTML page title', async function () {
- assert.equal(await page.title(), 'Result for City of London | Nominatim Demo');
+ assert.equal(await page.title(), 'Result for Paris | Nominatim Demo');
});
it('should have added search params', async function () {
let current_url = new URL(await page.url());
- assert.strictEqual(current_url.searchParams.get('q'), 'City of London');
+ assert.strictEqual(current_url.searchParams.get('q'), 'Paris');
});
it('should atleast one result', async function () {
assert.deepEqual(link_titles, ['API request', 'debug output']);
});
+ it('should not have polygon params in API request and debug URL', async function () {
+ let links_href = await page.$$eval('#api-request a', links => links.map(l => l.href));
+ let api_request_url = new URL(links_href[0]);
+ let debug_url = new URL(links_href[1]);
+
+ assert.deepStrictEqual(api_request_url.searchParams.has('polygon_geojson'), false);
+ assert.deepStrictEqual(debug_url.searchParams.has('polygon_geojson'), false);
+ });
+
it('should display a map', async function () {
await page.waitForSelector('#map');
assert.equal((await page.$$('#map')).length, 1);
let results = await page.$$('#searchresults .result a');
await results[0].click();
- await page.waitForNavigation();
+ await page.waitForSelector('table#address');
current_url = new URL(await page.url());
assert.deepStrictEqual(current_url.pathname, '/details.html');
await page.waitForSelector('.container h1');
page_header = await page.$eval('.container h1', el => el.textContent);
- assert.ok(page_header.includes('City of London'));
+ assert.ok(page_header.includes('Paris'));
});
});
});