Skip to content

Commit 65e96fb

Browse files
committed
update tests
1 parent 1a0daf2 commit 65e96fb

File tree

4 files changed

+20
-71
lines changed

4 files changed

+20
-71
lines changed

.github/actions/node-setup/action.yml

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -35,25 +35,11 @@ runs:
3535
run: pnpm install --frozen-lockfile --prefer-offline --ignore-scripts
3636
shell: bash
3737

38-
- name: 🏷️ Generate cache key
39-
run: |
40-
# Create a reliable branch name for caching
41-
if [ "${{ github.event_name }}" = "pull_request" ]; then
42-
BRANCH_NAME="${{ github.head_ref }}"
43-
else
44-
BRANCH_NAME="${{ github.ref_name }}"
45-
fi
46-
# Clean branch name for cache key (remove special characters)
47-
CLEAN_BRANCH=$(echo "$BRANCH_NAME" | sed 's/[^a-zA-Z0-9-]/-/g')
48-
echo "TURBO_CACHE_KEY=$CLEAN_BRANCH" >> $GITHUB_ENV
49-
echo "Using cache key: $CLEAN_BRANCH"
50-
shell: bash
51-
5238
- name: 💾 Cache turbo build setup
5339
uses: actions/cache@v4
5440
with:
5541
path: .turbo
56-
key: ${{ runner.os }}-turbo-${{ env.TURBO_CACHE_KEY }}-${{ github.sha }}
42+
key: ${{ runner.os }}-turbo-${{ github.head_ref || github.ref_name }}-${{ github.sha }}
5743
restore-keys: |
58-
${{ runner.os }}-turbo-${{ env.TURBO_CACHE_KEY }}-
44+
${{ runner.os }}-turbo-${{ github.head_ref || github.ref_name }}-
5945
${{ runner.os }}-turbo-

.github/workflows/playwright.yml

Lines changed: 12 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,13 @@ jobs:
2525
- name: 💻 Node setup
2626
uses: ./.github/actions/node-setup
2727

28-
- name: ♻️ Restore Turbo Cache
28+
- name: 💾 Cache Playwright browsers
2929
uses: actions/cache@v4
3030
with:
31-
path: .turbo
32-
key: turbo-${{ github.ref }}-${{ github.sha }}
31+
path: ~/.cache/ms-playwright
32+
key: ${{ runner.os }}-playwright-${{ hashFiles('**/pnpm-lock.yaml') }}
3333
restore-keys: |
34-
turbo-${{ github.ref }}-
35-
turbo-
34+
${{ runner.os }}-playwright-
3635
3736
- name: 🎭 E2E Setup
3837
uses: ./.github/actions/e2e-setup
@@ -43,28 +42,6 @@ jobs:
4342
run: pnpm --filter @infinum/frontend build
4443
shell: bash
4544

46-
- name: 🔍 Debug Build Output
47-
run: |
48-
echo "📂 Current working directory:"
49-
pwd
50-
echo ""
51-
echo "📁 Contents of apps/frontend:"
52-
ls -la apps/frontend/ | head -10
53-
echo ""
54-
echo "🏗️ Contents of apps/frontend/.next:"
55-
ls -la apps/frontend/.next/ || echo "❌ No .next directory found"
56-
echo ""
57-
echo "📦 Checking for standalone server:"
58-
if [ -f "apps/frontend/.next/standalone/apps/frontend/server.js" ]; then
59-
echo "✅ Found: apps/frontend/.next/standalone/apps/frontend/server.js"
60-
else
61-
echo "❌ NOT found: apps/frontend/.next/standalone/apps/frontend/server.js"
62-
fi
63-
echo ""
64-
echo "🔎 Looking for any server.js files:"
65-
find apps/frontend/.next -name "server.js" -type f 2>/dev/null || echo "❌ No server.js files found"
66-
shell: bash
67-
6845
- name: 🚀 Start Frontend App (Background)
6946
run: |
7047
node apps/frontend/.next/standalone/apps/frontend/server.js &
@@ -79,7 +56,7 @@ jobs:
7956
- name: ⏳ Wait for Frontend to be Ready
8057
run: |
8158
echo "Waiting for frontend to start on http://localhost:3000..."
82-
timeout 60s bash -c 'until curl -f http://localhost:3000 > /dev/null 2>&1; do
59+
timeout 20s bash -c 'until curl -f http://localhost:3000 > /dev/null 2>&1; do
8360
echo "Waiting for frontend..."
8461
sleep 3
8562
done'
@@ -94,34 +71,17 @@ jobs:
9471
shell: bash
9572

9673
- name: 🧪 Run Playwright E2E Tests
97-
run: pnpm e2e
98-
shell: bash
99-
env:
100-
PLAYWRIGHT_JUNIT_OUTPUT_NAME: test-results.xml
74+
run: |
75+
echo "🎬 Starting Playwright E2E Tests..."
76+
echo "================================================"
77+
pnpm e2e
78+
echo "================================================"
79+
echo "✅ E2E Tests completed!"
10180
10281
- name: 🛑 Stop Frontend App
82+
shell: bash
10383
if: always()
10484
run: |
10585
if [ ! -z "$FRONTEND_PID" ]; then
10686
kill $FRONTEND_PID || true
10787
fi
108-
shell: bash
109-
110-
- name: 📊 Upload Playwright Report
111-
uses: actions/upload-artifact@v4
112-
if: ${{ !cancelled() }}
113-
with:
114-
name: playwright-report-${{ github.run_id }}
115-
path: |
116-
packages/e2e-frontend/playwright-report/
117-
packages/e2e-frontend/test-results/
118-
retention-days: 30
119-
120-
- name: 📊 Upload Coverage Reports
121-
uses: actions/upload-artifact@v4
122-
if: success()
123-
with:
124-
name: e2e-coverage-${{ github.run_id }}
125-
path: |
126-
reports/a11y/
127-
retention-days: 7

packages/e2e-frontend/multi-device.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
import { test, expect, Browser } from '@playwright/test';
1+
import { Browser, expect, test } from '@playwright/test';
22
import { LoginPage } from './pages/login';
3-
import { wait } from './utils';
43

54
async function createContext(
65
browser: Browser,
@@ -13,9 +12,13 @@ async function createContext(
1312

1413
const login = new LoginPage(page);
1514
await login.goto();
15+
console.log('🔗 URL after login.goto():', page.url());
16+
1617
await login.login(email, password);
18+
console.log('🔗 URL after login.login():', page.url());
1719

1820
await page.waitForURL('/en');
21+
console.log("🔗 URL after waitForURL('/en'):", page.url());
1922
await expect(page.locator('text=Logged in')).toBeVisible();
2023
return { context, page };
2124
}

packages/test-utils/base.playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const baseConfig: PlaywrightTestConfig = {
77
forbidOnly: !!process.env.CI,
88
retries: process.env.CI ? 2 : 0,
99
workers: process.env.CI ? 1 : undefined,
10-
reporter: 'dot',
10+
reporter: process.env.CI ? [['github'], ['line']] : 'list',
1111
use: {
1212
trace: 'on-first-retry',
1313
viewport: { width: 1280, height: 720 },

0 commit comments

Comments
 (0)