Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@jtorreggiani
Last active March 1, 2019 22:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtorreggiani/e30043c94e44c52ca75ebd5417de9bfd to your computer and use it in GitHub Desktop.
Save jtorreggiani/e30043c94e44c52ca75ebd5417de9bfd to your computer and use it in GitHub Desktop.
Navigation tests
it('navigates to todos page on link click', async () => {
const link = await browser.$('=Todos')
await link.click()
const heading = await browser.$('h1')
await expect(browser.getUrl()).resolves.toEqual(`${baseUrl}/todos`)
await expect(heading.getText()).resolves.toEqual('Todos')
})
it('navigates to about page on link click', async () => {
const link = await browser.$('=About')
await link.click()
const heading = await browser.$('h1')
await expect(browser.getUrl()).resolves.toEqual(`${baseUrl}/about`)
await expect(heading.getText()).resolves.toEqual('About')
})
it('navigates back to home page on link click', async () => {
await browser.url('/todos')
const todoHeading = await browser.$('h1')
await expect(browser.getUrl()).resolves.toEqual(`${baseUrl}/todos`)
await expect(todoHeading.getText()).resolves.toEqual('Todos')
const link = await browser.$('=Home')
await link.click()
const homeHeading = await browser.$('h1')
await expect(homeHeading.getText()).resolves.toEqual('Home')
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment