refactor: check errorMessage in login e2e test

This commit is contained in:
Joe Previte 2021-04-19 11:11:52 -07:00
parent a3f18d6158
commit 958f01262b
No known key found for this signature in database
GPG Key ID: 2C91590C6B742C24
1 changed files with 6 additions and 2 deletions

View File

@ -54,12 +54,16 @@ test.describe("login", () => {
// The current RateLimiter allows 2 logins per minute plus // The current RateLimiter allows 2 logins per minute plus
// 12 logins per hour for a total of 14 // 12 logins per hour for a total of 14
// See: src/node/routes/login.ts // See: src/node/routes/login.ts
for (let i = 1; i <= 14; i++) { for (let i = 1; i <= 13; i++) {
await page.click(".submit") await page.click(".submit")
await page.waitForLoadState("networkidle") await page.waitForLoadState("networkidle")
// We double-check that the correct error message shows
// which should be for incorrect password
expect(await page.isVisible("text=Incorrect password"))
} }
// The 15th should fail // The 15th should fail for a different reason:
// login rate
await page.click(".submit") await page.click(".submit")
await page.waitForLoadState("networkidle") await page.waitForLoadState("networkidle")
expect(await page.isVisible("text=Login rate limited!")) expect(await page.isVisible("text=Login rate limited!"))