Skip to content
Closed
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
4 changes: 4 additions & 0 deletions frontend/tests/shared/Dockerfile.backend
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ RUN go mod download
# Copy source code
COPY . .

# Disable Go workspace — the go.work file may reference sibling dirs that
# don't exist in the Docker build context. go.mod has the proper versioned deps.
ENV GOWORK=off

# Build the binary (works for both OSS and Enterprise structure)
# OSS: cmd/api/main.go, Enterprise: cmd/main.go
RUN if [ -d "/app/cmd/api" ]; then \
Expand Down
14 changes: 8 additions & 6 deletions frontend/tests/shared/global-setup.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -418,15 +418,17 @@ async function buildBackendImage(isEnterprise) {
const dockerfilePath = resolve(__dirname, 'Dockerfile.backend');
const tempDockerfile = join(backendDir, '.dockerfile.e2e.tmp');

console.log('Building Docker image with testcontainers...');
console.log('Building Docker image...');
await execAsync(`cp "${dockerfilePath}" "${tempDockerfile}"`);

try {
await GenericContainer.fromDockerfile(backendDir, '.dockerfile.e2e.tmp')
.withBuildArgs({
BUILDKIT_INLINE_CACHE: '1',
})
.build(imageTag, { deleteOnExit: false });
const { stdout: buildOutput, stderr: buildStderr } = await execAsync(
`docker build --build-arg BUILDKIT_INLINE_CACHE=1 -t "${imageTag}" -f "${tempDockerfile}" "${backendDir}" 2>&1`
).catch((err) => {
// execAsync throws on non-zero exit; capture stdout/stderr from error
throw new Error(`Docker build failed:\n${err.stdout ?? ''}\n${err.stderr ?? ''}\n${err.message}`);
});
console.log(buildOutput || buildStderr || '');
console.log('✓ Backend image built');
} finally {
// Clean up temporary Dockerfile
Expand Down
27 changes: 26 additions & 1 deletion frontend/tests/test-variant-console-enterprise/auth.setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,33 @@ async function dismissErrorModalIfPresent(page: Page): Promise<void> {
}
}

/**
* Navigates to the login page and waits for the username input to be visible.
* Retries with page reload if the form doesn't appear (backend may not be fully ready yet).
*/
async function navigateToLoginPage(page: Page): Promise<void> {
// Navigate directly to /login to avoid redirect timing issues from /
await page.goto('/login', { waitUntil: 'domcontentloaded' });

// Wait for login form with reload retry (backend auth system may need a moment)
const usernameInput = page.getByTestId('auth-username-input');
const maxAttempts = 5;

for (let attempt = 1; attempt <= maxAttempts; attempt++) {
const isVisible = await usernameInput.isVisible({ timeout: 8000 }).catch(() => false);
if (isVisible) {
return;
}

if (attempt < maxAttempts) {
// Reload the page and try again — the backend auth system may still be initializing
await page.reload({ waitUntil: 'domcontentloaded' });
}
}
}

setup('authenticate', async ({ page }) => {
await page.goto('/', { waitUntil: 'networkidle' });
await navigateToLoginPage(page);

// Wait for login form to be visible
await page.getByTestId('auth-username-input').waitFor({ state: 'visible', timeout: 30_000 });
Expand Down
Loading