-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #671 from LD4P/amcollie_test_1
Simple integration test for unauthenticated users
- Loading branch information
Showing
1 changed file
with
29 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) | ||
}) |