Skip to content

Commit b5a8a41

Browse files
committed
tests fix
1 parent 01f2f61 commit b5a8a41

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

.github/workflows/playwright.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
-e SESSION_SECRET=dummy \
5757
api:test "@org"
5858
- uses: actions/upload-artifact@v4
59-
if: ${{ !cancelled() }}
59+
if: always()
6060
with:
6161
name: playwright-report-docker-org
6262
path: test-results-docker-org/
@@ -89,7 +89,7 @@ jobs:
8989
-e SESSION_SECRET=dummy \
9090
api:test "@ent"
9191
- uses: actions/upload-artifact@v4
92-
if: ${{ !cancelled() }}
92+
if: always()
9393
with:
9494
name: playwright-report-docker-ent
9595
path: test-results-docker-ent/

api/server.mjs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ const MemoryStore = MemoryStoreFactory(session);
1717
const limiter = RateLimit({
1818
windowMs: 15 * 60 * 1000, // 15 minutes
1919
max: 100, // max 100 requests per windowMs
20+
skip: (req) => {
21+
// Skip rate limiting for localhost
22+
return isLocalhost(req);
23+
}
2024
});
2125

2226
if (DOTENV_CONFIG_PATH) {
@@ -27,8 +31,13 @@ if (DOTENV_CONFIG_PATH) {
2731
}
2832

2933
const app = express();
34+
console.log('ENVIRONMENT: ', app.get('env'));
35+
36+
// Disable rate limiter and secure cookies for localhost
37+
const isLocalhost = (req) => {
38+
return req.hostname === 'localhost' || req.hostname === '127.0.0.1';
39+
};
3040

31-
// apply rate limiter to all requests
3241
app.use(limiter);
3342

3443
app.use(session({
@@ -38,7 +47,8 @@ app.use(session({
3847
store: new MemoryStore({
3948
checkPeriod: 86400000 // prune expired entries every 24h
4049
}),
41-
cookie: { secure: process.env.IS_PROD ? true : false, maxAge: 86400000 }
50+
// may need to use secure: false if using http during local development
51+
cookie: { secure: app.get('env') === 'production', maxAge: 86400000 }
4252
}));
4353

4454
// Middleware to add Authorization header

playwright.docker.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import baseConfig from './playwright.config';
33

44
export default defineConfig({
55
...baseConfig,
6+
timeout: 5 * 1000,
67
reporter: [
78
['list'],
89
['html', { open: 'never', outputFolder: '/test-results/html' }],

0 commit comments

Comments
 (0)