X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/b2d1e2a271b3f2157987908bb284be14732a747b..a1d2a5b19e7731811a55903593b44a02f34cfdab:/test/search.js diff --git a/test/search.js b/test/search.js index b398b0d..e87ed0e 100644 --- a/test/search.js +++ b/test/search.js @@ -82,13 +82,15 @@ describe('Search Page', function () { assert.strictEqual(current_url.searchParams.get('q'), 'Paris'); }); - it('should atleast one result', async function () { + it('should have at least one result', async function () { let results_count = await page.$$eval('#searchresults .result', elements => elements.length); assert.ok(results_count > 1); }); it('should have show more results button', async function () { - let [search_more_btn] = await page.$x("//a[contains(text(), 'Search for more results')]"); + let [search_more_btn] = await page.$$( + "xpath/.//a[contains(text(), 'Search for more results')]" + ); assert.ok(search_more_btn); }); @@ -143,4 +145,23 @@ describe('Search Page', function () { 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')); + }); + }); });