Skip to content
Open
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
6 changes: 3 additions & 3 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ jobs:
- name: Install Playwright browsers
run: npx playwright install --with-deps chromium

- name: Build application
run: npm run build

- name: Run Playwright tests
run: npx playwright test --reporter=html,github
env:
CI: true
FINERACT_API_URL: https://demo.mifos.community
E2E_USERNAME: mifos
E2E_PASSWORD: password

- name: Upload Playwright report
uses: actions/upload-artifact@v7
Expand Down
9 changes: 3 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,10 @@
"@vendure/ngx-translate-extract": "^9.4.0",
"cypress": "^13.17.0",
"eslint": "^9.39.1",
"express": "^5.2.1",
"git-describe": "^4.1.1",
"htmlhint": "1.9.2",
"http-proxy-middleware": "^3.0.5",
"https-proxy-agent": "7.0.6",
"husky": "^9.1.7",
"jasmine-core": "^4.2.0",
Expand Down
9 changes: 4 additions & 5 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/**
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
Expand Down Expand Up @@ -88,12 +88,11 @@ export default defineConfig({
],

// Web server configuration
// In CI: builds production bundle (without base-href), then serves it with http-server
// In CI: builds production bundle, then serves it with e2e-server.js
// (Express + http-proxy-middleware for /fineract-provider/* proxy)
// Locally: reuses existing ng serve if running
webServer: {
command: process.env.CI
? 'npm run build && npx http-server ./dist/web-app/browser -p 4200 --silent'
: 'npm run start',
command: process.env.CI ? 'npm run build && node playwright/e2e-server.js' : 'npm run start',
url: 'http://localhost:4200',
reuseExistingServer: !process.env.CI,
timeout: 180000,
Expand Down
48 changes: 48 additions & 0 deletions playwright/e2e-server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

const express = require('express');
const { createProxyMiddleware } = require('http-proxy-middleware');
const path = require('path');
const fs = require('fs');

const FINERACT_API_URL = process.env.FINERACT_API_URL || 'https://demo.mifos.community';
const PORT = process.env.E2E_PORT || 4200;
const DIST_DIR = path.resolve(__dirname, '..', 'dist', 'web-app', 'browser');

if (!fs.existsSync(DIST_DIR)) {
console.error(`Build directory not found: ${DIST_DIR}`);
console.error('Run "npm run build" before starting the E2E server.');
process.exit(1);
}

const app = express();

// Proxy /fineract-provider/* to the Fineract backend
app.use(
'/fineract-provider',
createProxyMiddleware({
target: FINERACT_API_URL,
changeOrigin: true,
secure: true,
logger: console
})
);

// Serve static files from the Angular build
app.use(express.static(DIST_DIR));

// SPA fallback: serve index.html for all non-file routes (Angular hash routing)
app.get('{*path}', (_req, res) => {
res.sendFile(path.join(DIST_DIR, 'index.html'));
});

app.listen(PORT, () => {
console.log(`E2E server listening on http://localhost:${PORT}`);
console.log(`Proxying /fineract-provider/* → ${FINERACT_API_URL}`);
});
8 changes: 4 additions & 4 deletions playwright/tests/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,9 @@ test.describe('Login Page', () => {
await expect(loginPage.loginButton).toBeEnabled();
});

// Skip in CI - requires Fineract backend
test.skip(!!process.env.CI, 'Requires Fineract backend');
test('should successfully login with valid credentials', async () => {
test.skip(!!process.env.CI, 'Production build auth interceptor skips tenant header for absolute URLs');

// Perform login with valid credentials
// This uses the login() method which follows the exact codegen sequence
await loginPage.loginAndWaitForDashboard('mifos', 'password');
Expand Down Expand Up @@ -98,9 +98,9 @@ test.describe('Login Page', () => {
* Simple test that exactly mirrors the codegen script.
* This is the baseline test generated from codegen.
*/
// Skip in CI - requires Fineract backend
test.skip(!!process.env.CI, 'Requires Fineract backend');
test('codegen baseline: login with mifos credentials', async () => {
test.skip(!!process.env.CI, 'Production build auth interceptor skips tenant header for absolute URLs');

// This test uses the exact codegen interaction sequence
await loginPage.login('mifos', 'password');

Expand Down
Loading