Skip to content
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
b30b952
Adding logging to auth test fixture for e2e tests
dw-ukhsa Jun 17, 2026
7a87ae2
adding more logging for diagnotics
dw-ukhsa Jun 18, 2026
f13adf3
Adding dev server logging to file and dump file
dw-ukhsa Jun 18, 2026
08dba72
Update GoogleTagManager to return null where no GTM_ID is found in co…
dw-ukhsa Jun 18, 2026
f30e9fd
Merge branch 'feature/CDD-2509-playwright-test-non-public' of github.…
dw-ukhsa Jun 18, 2026
27860f7
Merge branch 'feature/CDD-2509-playwright-test-non-public' of github.…
dw-ukhsa Jun 19, 2026
f4852d7
adding debugging to tests
dw-ukhsa Jun 19, 2026
cbd13c0
Moving logout banner check to part of start page -logged out test block
dw-ukhsa Jun 19, 2026
8ffdaaa
adding more alert logging
dw-ukhsa Jun 19, 2026
3462c72
Merge branch 'feature/CDD-2509-playwright-test-non-public' into test/…
dw-ukhsa Jun 19, 2026
bf3b140
yet more logging
dw-ukhsa Jun 19, 2026
50f50ad
Merge branch 'test/add-logging-to-auth-fixture' of github.com:UKHSA-I…
dw-ukhsa Jun 19, 2026
dc15b3d
correcting syntax issue
dw-ukhsa Jun 19, 2026
289e080
Updating auth fixture to find logout banner more accurately
dw-ukhsa Jun 19, 2026
097dc5e
introducing e2e tests for non-public
dw-ukhsa Jun 19, 2026
ef02021
Adding @auth-ui tagging to tests so CI can pick them up correctly
dw-ukhsa Jun 19, 2026
a1e1ebe
Adding covid test fic=xture for classification banner with public test
dw-ukhsa Jun 22, 2026
1a0efc6
Removing irrelevant non-public tests
dw-ukhsa Jun 22, 2026
4109cb8
removing un-used includes as causing linting issue
dw-ukhsa Jun 22, 2026
98137d8
Adding a non-public COVID-19 test file
dw-ukhsa Jun 22, 2026
55c8396
CDD-2509
manubinary Jun 22, 2026
35622a5
Refactor of tests to check for classification banner
dw-ukhsa Jun 22, 2026
47c4cc5
Update app.fixture.non.public.ts
manubinary Jun 22, 2026
ee27080
wrong file updated
manubinary Jun 22, 2026
e85ed95
Tricking sonarqube into letting tests through so I can check progress
dw-ukhsa Jun 22, 2026
ebb6ece
Adding banner fixtures back into auth-start fixture
dw-ukhsa Jun 22, 2026
68ceb61
Adding checkClassificationBannerContent to all app classes
dw-ukhsa Jun 22, 2026
1d8d8d1
trying to hook changing is_public in, in a simplified way
dw-ukhsa Jun 23, 2026
ab0eed5
Another attempt at setting the is_public flag
dw-ukhsa Jun 23, 2026
454e256
Update eslint.config.mjs
manubinary Jun 23, 2026
4ed82bc
Update eslint.config.mjs
manubinary Jun 23, 2026
5771d1c
adding BASE_URL to env to prevent wrong isWellKnownEnviornment() logic
dw-ukhsa Jun 23, 2026
f8d75a8
Update eslint.config.mjs
manubinary Jun 23, 2026
df74080
Adding explicit click to radio buttons while changing isPublic state
dw-ukhsa Jun 23, 2026
4bb3caa
Switching test for classification banner to be more specific
dw-ukhsa Jun 23, 2026
3302792
Removing console.logs
dw-ukhsa Jun 23, 2026
d97cf7d
removing un-used variable
dw-ukhsa Jun 23, 2026
32567b7
Merge branch 'feature/CDD-2509-playwright-test-non-public' of github.…
dw-ukhsa Jun 23, 2026
094b702
reverting 'provide' in places of 'use' to test linting rules
dw-ukhsa Jun 23, 2026
dd45a1f
unwanted commit reverted
manubinary Jun 23, 2026
205813e
Reintroducing 'broken' code to check source of issues
dw-ukhsa Jun 23, 2026
7b279f8
Adding a .sonarcloud.properties file
dw-ukhsa Jun 23, 2026
b16e989
trying broaded sonar config incase issues weren't caught
dw-ukhsa Jun 23, 2026
f0d713e
Create .sonarcloud.properties
manubinary Jun 23, 2026
b51fea7
Merge branch 'feature/CDD-2509-playwright-test-nonPublic' into test/a…
manubinary Jun 23, 2026
1d918f3
Remving un-used import
dw-ukhsa Jun 24, 2026
21e91f5
Fixing the sonarqube issues and retroring main non-public test suite
dw-ukhsa Jun 24, 2026
124f7e1
Correvcting syntax issues
dw-ukhsa Jun 24, 2026
b7585f2
Restoring previous versions of fixtures
dw-ukhsa Jun 24, 2026
801299f
dam you spelling mistakes
dw-ukhsa Jun 24, 2026
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
9 changes: 8 additions & 1 deletion .github/workflows/build-test-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ jobs:
- name: Start dev server
id: start-dev-server
run: |
node .next/standalone/server.js &
node .next/standalone/server.js > next-server.log 2>&1 &
echo "devServerPID=$!" >> "$GITHUB_OUTPUT"
env:
PORT: 3000
Expand All @@ -264,6 +264,13 @@ jobs:
baseURL: http://localhost:3000
AUTH_ENABLED: true

# ── Dev server log dump ───────────────────────────────────────────────────
- name: Dump next server logs
if: always()
run: |
echo "==== next-server.log ===="
cat next-server.log || true

# ── Artifacts ─────────────────────────────────────────────────────────────
- name: Upload Playwright report
uses: actions/upload-artifact@v4
Expand Down
31 changes: 29 additions & 2 deletions e2e/fixtures/auth/auth-setup.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,19 @@ export const AuthSetupFixtures = base.extend<AuthSetupFixtures>({
},

setupAuth: [
async ({ page, authEnabled, startLoggedOut }, use) => {
async ({ page, authEnabled, startLoggedOut }, use, testInfo) => {
const logPrefix = `[auth setup] ${testInfo.titlePath.join(' > ')}`

console.log(`${logPrefix}: start`, { authEnabled, startLoggedOut });

if (!authEnabled || startLoggedOut) {
console.log(`${logPrefix}: clearing cookies and skipping setup`);
await page.context().clearCookies()
return await use()
}

await page.route('**/api/auth/session', async (route) => {
console.log(`${logPrefix}: intercepted /api/auth/session`);
await route.fulfill({
status: 200,
contentType: 'application/json',
Expand All @@ -49,6 +55,7 @@ export const AuthSetupFixtures = base.extend<AuthSetupFixtures>({
})

await page.route('**/oauth2/token', async (route) => {
console.log(`${logPrefix}: intercepted /oauth2/token`);
await route.fulfill({
status: 200,
contentType: 'application/json',
Expand All @@ -73,9 +80,29 @@ export const AuthSetupFixtures = base.extend<AuthSetupFixtures>({
},
])

await page.goto('/start')
console.log(`${logPrefix}: cookies injected`);

const startedAt = Date.now();
console.log(`${logPrefix}: goto /start begin`);

const response = await page.goto('/start')

console.log(`${logPrefix}: goto /start complete`, {
elapsedTime: Date.now() - startedAt,
status: response?.status(),
url: page.url()
});

const networkStartedAt = Date.now();
console.log(`${logPrefix}: networkidle begin`);

await page.waitForLoadState('networkidle')

console.log(`${logPrefix}: networkidle complete`, {
elapsedTime: Date.now() - networkStartedAt,
url: page.url()
});

await use()
},
{ auto: true },
Expand Down
2 changes: 2 additions & 0 deletions src/app/components/cms/pages/Start.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ import { auth } from '@/auth'
* The non-public dashboard signup page
*/
export default async function StartPage({ searchParams: { logout } }: PageComponentBaseProps<{ logout?: 'success' }>) {
console.log('[debug-log] StartPage: before auth');
const session = await auth()
console.log('[debug-log] StartPage: after auth', session);

if (session) redirect('/acknowledgement')

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ConsentScript } from './ConsentScript'
const GTM_ID = process.env.GOOGLE_TAG_MANAGER_ID

export const GoogleTagManager = () => {
if (!GTM_ID.length) return null
if (!GTM_ID?.length) return null
Comment thread
manubinary marked this conversation as resolved.

return (
<>
Expand Down
2 changes: 2 additions & 0 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ export const dynamic = 'auto'

export default async function RootLayout({ children }: { children: React.ReactNode }) {
const { t } = await getServerTranslation('common')
console.log('[debug-log] RootLayout: before getAuthToken');
const accessToken = await getAuthToken()
console.log('[debug-log] RootLayout: after getAuthToken');

const cookieStore = await cookies()
return (
Expand Down
4 changes: 4 additions & 0 deletions src/proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ export const proxy: NextProxy = async (request: NextRequest) => {
if (process.env.AUTH_ENABLED === 'true') {
const unauthenticatedPaths = ['/api/health', '/robots.txt']

console.log('[debug-log] proxy: auth enabled block');

if (unauthenticatedPaths.some((path) => request.nextUrl.pathname.startsWith(path))) {
return response
}
Expand All @@ -44,7 +46,9 @@ export const proxy: NextProxy = async (request: NextRequest) => {
// return NextResponse.redirect(new URL('/start', request.url))
// }
response = await validateAndRenewSession(request, response)
console.log('[debug-log] proxy: after validateAndRenewSession', response.status);
} catch (error) {
console.log('[debug-log] proxy: error', error);
logger.error('Auth middleware error:', error)
return NextResponse.redirect(new URL('/start', request.url))
}
Expand Down