1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Add some test cases for nested pages with next export.

This commit is contained in:
Arunoda Susiripala 2017-05-11 09:09:31 -07:00
parent 4be25270c6
commit d7048e13fa
4 changed files with 54 additions and 0 deletions

View file

@ -39,6 +39,12 @@ export default () => (
>
<a id='dynamic-2'>Dynamic 2</a>
</Link>
<Link href='/level1'>
<a id='level1-home-page'>Level1 home page</a>
</Link>
<Link href='/level1/about'>
<a id='level1-about-page'>Level1 about page</a>
</Link>
</div>
<p>This is the home page</p>
<style jsx>{`

View file

@ -0,0 +1,12 @@
import Link from 'next/link'
export default () => (
<div id='level1-about-page'>
<div>
<Link href='/'>
<a>Go Back</a>
</Link>
</div>
<p>This is the Level1 about page</p>
</div>
)

View file

@ -0,0 +1,12 @@
import Link from 'next/link'
export default () => (
<div id='level1-home-page'>
<div>
<Link href='/'>
<a>Go Back</a>
</Link>
</div>
<p>This is the Level1 home page</p>
</div>
)

View file

@ -92,5 +92,29 @@ export default function (context) {
browser.close()
})
describe('pages in the nested level: level1', () => {
it('should render the home page', async () => {
const browser = await webdriver(context.port, '/')
const text = await browser
.elementByCss('#level1-home-page').click()
.waitForElementByCss('#level1-home-page')
.elementByCss('#level1-home-page p').text()
expect(text).toBe('This is the Level1 home page')
browser.close()
})
it('should render the about page', async () => {
const browser = await webdriver(context.port, '/')
const text = await browser
.elementByCss('#level1-about-page').click()
.waitForElementByCss('#level1-about-page')
.elementByCss('#level1-about-page p').text()
expect(text).toBe('This is the Level1 about page')
browser.close()
})
})
})
}