X-Git-Url: https://git.openstreetmap.org./nominatim-ui.git/blobdiff_plain/23d68e84c00ba741a29e4e088ef12aa7b23e045c..3fdeee714c2075bbc5ba5f091ec3436def62c035:/test/reverse.js?ds=sidebyside diff --git a/test/reverse.js b/test/reverse.js index 8e02b23..8685668 100644 --- a/test/reverse.js +++ b/test/reverse.js @@ -33,4 +33,41 @@ describe('Reverse Page', function () { assert.equal(await lon_handle.evaluate(node => node.value), 5); }); }); + + describe('With search', function () { + before(async function () { + page = await browser.newPage(); + await page.goto('http://localhost:9999/reverse.html'); + await page.type('input[name=lat]', '27.1750090510034'); + await page.type('input[name=lon]', '78.04209025'); + await page.click('button[type=submit]'); + await page.waitForSelector('#searchresults'); + }); + + after(async function () { + await page.close(); + }); + + it('should return single result', async function () { + let results_count = await page.$$eval('#searchresults .result', elements => elements.length); + + assert.deepStrictEqual(results_count, 1); + }); + + it('should display a map', async function () { + await page.waitForSelector('#map'); + assert.equal((await page.$$('#map')).length, 1); + }); + + it('should redirect to details page on clicking details button', async function () { + let current_url; + 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'); + }); + }); });