+
+ it('should default to dedupe=1', async function () {
+ const checkbox_checked = await page.$eval('#option_dedupe', el => el.checked);
+ assert.equal(checkbox_checked, true);
+
+ const 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('dedupe'), false);
+ assert.deepStrictEqual(debug_url.searchParams.has('dedupe'), false);
+ });
+
+ it('should have polygon and marker in map and minimap', async function () {
+ assert.strictEqual((await page.$$('#map .leaflet-overlay-pane path')).length, 4);
+ });
+
+ it('should redirect to details page on clicking details button', async function () {
+ let current_url;
+ let page_header;
+ let results = await page.$$('#searchresults .result a');
+
+ await results[0].click();
+ 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('Paris'));
+ });
+ });
+
+ describe('Search for OSM URL', function () {
+ before(async function () {
+ page = await browser.newPage();
+ await page.goto('http://localhost:9999/search.html');
+ await page.type('input[name=q]', 'https://www.openstreetmap.org/relation/3459013#map=11/41.2388/-8.3867');
+ await page.click('button[type=submit]');
+ await page.waitForSelector('table#address');
+ });
+
+ after(async function () {
+ await page.close();
+ });
+
+ it('should redirect to detail page search', async function () {
+ assert.equal(await page.title(), 'Details for R3459013 | Nominatim Demo');
+ assert.ok((await page.$eval('.container h1', el => el.textContent)).includes('Porto'));
+ });