Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions apps/server/tests/smoke/harness/smoke-l3-password-browser.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -1337,6 +1337,7 @@ class CdpPage {
href: location.href,
pathname: location.pathname,
text: document.body.innerText,
hasAuthenticatedConsole: document.querySelector('[data-smoke-authenticated-console]') !== null,
hasPlaceholderHref: document.querySelector('a[href="__link__"]') !== null,
badClass: Array.from(document.querySelectorAll('[class]')).some((node) => {
const value = node.getAttribute('class') || '';
Expand Down Expand Up @@ -1474,7 +1475,11 @@ async function verifyBrowserPasswordSignIn(page) {
await page.setVisibleInputValue('input[type="password"]', adminPassword)
await page.clickVisibleButton('Sign in')
await page.waitFor(() => location.pathname.startsWith('/console'), 15_000, 'console redirect')
await page.waitFor(() => document.body.innerText.includes('Sign out'), 15_000, 'signed in UI')
await page.waitFor(
() => document.querySelector('[data-smoke-authenticated-console]') !== null,
15_000,
'signed in UI',
)

const cookie = await page.sessionCookieHeader()
const me = await page.browserMe()
Expand All @@ -1492,7 +1497,9 @@ async function verifyBrowserPasswordSignIn(page) {
if (!snapshot.pathname.startsWith('/console')) {
throw new Error(`password default target mismatch: ${snapshot.href}`)
}
if (!snapshot.text.includes(adminEmail)) throw new Error('console missing signed in admin email')
if (snapshot.hasAuthenticatedConsole !== true) {
throw new Error('console missing authenticated smoke contract')
}
assertNoConsoleDeadState(snapshot, 'console')
if (snapshot.text.includes('Sign in')) throw new Error('console shows Sign in after login')
if (snapshot.hasPlaceholderHref) throw new Error('console has placeholder href')
Expand Down Expand Up @@ -1887,7 +1894,7 @@ async function verifyBrowserEnterpriseOidcSso(page, tenantId, providerState) {
}
try {
await page.waitFor(
() => document.body.innerText.includes('Sign out'),
() => document.querySelector('[data-smoke-authenticated-console]') !== null,
15_000,
'enterprise sso signed in',
)
Expand Down Expand Up @@ -2025,7 +2032,7 @@ async function verifyBrowserEnterpriseSamlSso(page, tenantId, providerState) {
}
try {
await page.waitFor(
() => document.body.innerText.includes('Sign out'),
() => document.querySelector('[data-smoke-authenticated-console]') !== null,
15_000,
'enterprise saml signed in',
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -563,6 +563,7 @@ class CdpPage {
href: location.href,
pathname: location.pathname,
text: document.body.innerText,
hasAuthenticatedConsole: document.querySelector('[data-smoke-authenticated-console]') !== null,
hasPlaceholderHref: document.querySelector('a[href="__link__"]') !== null,
badClass: Array.from(document.querySelectorAll('[class]')).some((node) => {
const value = node.getAttribute('class') || '';
Expand Down Expand Up @@ -705,7 +706,11 @@ async function verifyBrowserPasswordReset(page, token) {
)
}
try {
await page.waitFor(() => document.body.innerText.includes('Sign out'), 15_000, 'signed in UI')
await page.waitFor(
() => document.querySelector('[data-smoke-authenticated-console]') !== null,
15_000,
'signed in UI',
)
} catch (error) {
const snapshot = await page.snapshot()
const me = await page.browserMe()
Expand Down Expand Up @@ -738,7 +743,9 @@ async function verifyBrowserPasswordReset(page, token) {
throw new Error(`password reset default target mismatch: ${snapshot.href}`)
}
const snapshotText = snapshot.text.toLowerCase()
if (!snapshotText.includes(adminEmail)) throw new Error('console missing signed in admin email')
if (snapshot.hasAuthenticatedConsole !== true) {
throw new Error('console missing authenticated smoke contract')
}
if (!snapshotText.includes('default organization')) {
throw new Error('console missing default organization')
}
Expand Down