Skip to content

Commit

Permalink
test: improve stability of refresh test (#4037)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Aug 13, 2024
1 parent 4d1954a commit 68693a4
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 12 deletions.
15 changes: 9 additions & 6 deletions test/e2e/playwright/models/elements/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,16 +143,19 @@ export class LoginPage {
}

async submit(method: string, opts?: SubmitOptions) {
const nav = opts?.waitForURL
? this.page.waitForURL(opts.waitForURL)
: Promise.resolve()
const waitFor = [
opts?.waitForURL
? this.page.waitForURL(opts.waitForURL)
: Promise.resolve(),
]

if (opts?.submitWithKeyboard) {
await this.page.keyboard.press("Enter")
waitFor.push(this.page.keyboard.press("Enter"))
} else {
await this.submitMethod(method).click()
waitFor.push(this.submitMethod(method).click())
}

await nav
await Promise.all(waitFor)
}

//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { test } from "../../../fixtures"
import { extractCode, toConfig } from "../../../lib/helper"
import { LoginPage } from "../../../models/elements/login"

test.describe.parallel("account enumeration protection off", () => {
test.describe("account enumeration protection off", () => {
test.use({
configOverride: toConfig({
style: "identifier_first",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,19 @@ test.describe("account enumeration protection off", () => {
configOverride: toConfig({
style: "identifier_first",
mitigateEnumeration: false,
selfservice: {
methods: {
password: {
enabled: true,
},
code: {
passwordless_enabled: false,
},
},
},
}),
})

test.describe.configure({ mode: "parallel" })

test("login fails because user does not exist", async ({ page, config }) => {
const login = new LoginPage(page, config)
await login.open()
Expand Down Expand Up @@ -118,10 +126,19 @@ test.describe("account enumeration protection on", () => {
configOverride: toConfig({
style: "identifier_first",
mitigateEnumeration: true,
selfservice: {
methods: {
password: {
enabled: true,
},
code: {
passwordless_enabled: false,
},
},
},
}),
})

test.describe.configure({ mode: "parallel" })
test("login fails because user does not exist", async ({ page, config }) => {
const login = new LoginPage(page, config)
await login.open()
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/playwright/tests/mobile/app_login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
import { expect, Page } from "@playwright/test"
import { test } from "../../fixtures"

test.describe.configure({ mode: "parallel" })

async function performOidcLogin(popup: Page, username: string) {
await popup.waitForLoadState()

Expand Down

0 comments on commit 68693a4

Please sign in to comment.