Skip to content

Commit

Permalink
Merge pull request #671 from LD4P/amcollie_test_1
Browse files Browse the repository at this point in the history
Simple integration test for unauthenticated users
  • Loading branch information
jgreben committed Jun 11, 2019
2 parents 3b8779a + a9b16d1 commit df62e7d
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions __tests__/integration/unauthenticatedNavigation.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2019 Stanford University see LICENSE for license
import expect from 'expect-puppeteer'
import 'isomorphic-fetch'

describe('When an unauthenticated user tries to access resource templates', () => {
beforeAll(async () => {
jest.setTimeout(60000) // this seems to take around 10s in practice, but be generous, just in case
await page.goto('http://127.0.0.1:8888/templates')

/*
* Attempt to logout
* This try block is necessary to avoid failing after logout
*/
try {
await page.waitForSelector('button.signout-btn')
await page.click('button.signout-btn')
} catch (error) {
console.info(error)
}
})

it('displays the login form', async () => {
await page.waitForSelector('form.login-form')
})

it('does not display "Available Resource Templates in Sinopia"', async () => {
await expect(page).not.toMatch('Available Resource Templates in Sinopia')
})
})

0 comments on commit df62e7d

Please sign in to comment.