diff --git a/test/integration/basic/pages/nav/querystring.js b/test/integration/basic/pages/nav/querystring.js new file mode 100644 index 00000000..740a4acf --- /dev/null +++ b/test/integration/basic/pages/nav/querystring.js @@ -0,0 +1,22 @@ +import React from 'react' +import Link from 'next/link' + +export default class AsyncProps extends React.Component { + static async getInitialProps ({ query: { id = 0 } }) { + return { id } + } + + render () { + return ( +
+ + Click here + + + Click here + +

{this.props.id}

+
+ ) + } +} diff --git a/test/integration/basic/test/client-navigation.js b/test/integration/basic/test/client-navigation.js index 75922377..c14bd340 100644 --- a/test/integration/basic/test/client-navigation.js +++ b/test/integration/basic/test/client-navigation.js @@ -59,5 +59,29 @@ export default (context) => { await browser.close() }) }) + + describe('with the same page but different querystring', () => { + it('should navigate the page', async () => { + const browser = await webdriver(context.appPort, '/nav/querystring?id=1') + const text = await browser + .elementByCss('#next-id-link').click() + .waitForElementByCss('.nav-id-2') + .elementByCss('p').text() + + expect(text).toBe('2') + await browser.close() + }) + + it('should remove querystring', async () => { + const browser = await webdriver(context.appPort, '/nav/querystring?id=1') + const text = await browser + .elementByCss('#main-page').click() + .waitForElementByCss('.nav-id-0') + .elementByCss('p').text() + + expect(text).toBe('0') + await browser.close() + }) + }) }) }