mirror of
https://github.com/coder/code-server.git
synced 2026-06-18 07:57:10 +02:00
fix: re-enable skipped Heart tests and make non-asserting checks assert (#7845)
This commit is contained in:
committed by
GitHub
parent
72086edbdb
commit
7dfd68589a
@@ -24,8 +24,8 @@ describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () =>
|
||||
// Skip entering password
|
||||
// Click the submit button and login
|
||||
await codeServerPage.page.click(".submit")
|
||||
await codeServerPage.page.waitForLoadState("networkidle")
|
||||
expect(await codeServerPage.page.isVisible("text=Missing password"))
|
||||
// The required input blocks empty submits, so the server-side error can't render.
|
||||
await expect(codeServerPage.page.locator("input.password:invalid")).toBeVisible()
|
||||
})
|
||||
|
||||
test("should see an error message for incorrect password", async ({ codeServerPage }) => {
|
||||
@@ -34,28 +34,29 @@ describe("login", ["--disable-workspace-trust", "--auth", "password"], {}, () =>
|
||||
// Click the submit button and login
|
||||
await codeServerPage.page.click(".submit")
|
||||
await codeServerPage.page.waitForLoadState("networkidle")
|
||||
expect(await codeServerPage.page.isVisible("text=Incorrect password"))
|
||||
await expect(codeServerPage.page.locator("text=Incorrect password")).toBeVisible()
|
||||
})
|
||||
|
||||
test("should hit the rate limiter for too many unsuccessful logins", async ({ codeServerPage }) => {
|
||||
// Type in password
|
||||
await codeServerPage.page.fill(".password", "password123")
|
||||
test.slow()
|
||||
// Click the submit button and login
|
||||
// The current RateLimiter allows 2 logins per minute plus
|
||||
// 12 logins per hour for a total of 14
|
||||
// See: src/node/routes/login.ts
|
||||
for (let i = 1; i <= 14; i++) {
|
||||
await codeServerPage.page.fill(".password", "password123")
|
||||
await codeServerPage.page.click(".submit")
|
||||
await codeServerPage.page.waitForLoadState("networkidle")
|
||||
// We double-check that the correct error message shows
|
||||
// which should be for incorrect password
|
||||
expect(await codeServerPage.page.isVisible("text=Incorrect password"))
|
||||
await expect(codeServerPage.page.locator("text=Incorrect password")).toBeVisible()
|
||||
}
|
||||
|
||||
// The 15th should fail for a different reason:
|
||||
// login rate
|
||||
await codeServerPage.page.fill(".password", "password123")
|
||||
await codeServerPage.page.click(".submit")
|
||||
await codeServerPage.page.waitForLoadState("networkidle")
|
||||
expect(await codeServerPage.page.isVisible("text=Login rate limited!"))
|
||||
await expect(codeServerPage.page.locator("text=Login rate limited!")).toBeVisible()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user