Skip to content

Commit bd50bf6

Browse files
committed
updated pipeline
1 parent 93fb944 commit bd50bf6

3 files changed

Lines changed: 82 additions & 6 deletions

File tree

.github/workflows/auto-test-deploy.yml

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,32 @@ jobs:
9595
push: true
9696
tags: docker.io/${{ secrets.DOCKERHUB_ADMIN_USERNAME }}/storybook:${{ env.TAG_NAME }}
9797

98-
# Add tests deployed to separate image (simple node image and pasted e2e tests in there should do the trick)
98+
build-and-push-e2e-runner:
99+
runs-on: ubuntu-latest
100+
needs: build-and-push-admin-auto-test
101+
102+
steps:
103+
- name: Set env for dynamic tag
104+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
105+
run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
106+
107+
- name: Set env manual
108+
if: github.event_name == 'workflow_dispatch'
109+
run: echo "TAG_NAME=default_version" >> $GITHUB_ENV
110+
111+
- name: Checkout code
112+
uses: actions/checkout@v4.2.2
113+
114+
- name: Login to DockerHub
115+
uses: docker/login-action@v3.4.0
116+
with:
117+
username: ${{ secrets.DOCKERHUB_ADMIN_USERNAME }}
118+
password: ${{ secrets.DOCKERHUB_ADMIN_TOKEN }}
119+
120+
- name: Build and push E2E runner image
121+
uses: docker/build-push-action@v6.17.0
122+
with:
123+
context: .
124+
file: ./client/Dockerfile.e2e
125+
push: true
126+
tags: docker.io/${{ secrets.DOCKERHUB_ADMIN_USERNAME }}/seb-server-gui-e2e-runner:${{ env.TAG_NAME }}

client/Dockerfile.e2e

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# Choose a pinned version that matches your @playwright/test version as closely as possible
2+
FROM mcr.microsoft.com/playwright:v1.47.2-jammy
3+
4+
WORKDIR /work
5+
6+
# Copy only what the runner needs (keeps image smaller + build faster)
7+
COPY client/package.json client/package-lock.json* client/pnpm-lock.yaml* client/yarn.lock* ./client/
8+
COPY client/playwright.config.ts ./client/
9+
COPY client/tsconfig.playwright.json ./client/
10+
COPY client/tests/e2e ./client/tests/e2e
11+
12+
# Install deps
13+
WORKDIR /work/client
14+
# If you use npm:
15+
RUN npm ci
16+
17+
# If your project uses pnpm or yarn, swap accordingly.
18+
19+
# Default output locations (we’ll also set these in playwright.config.ts)
20+
ENV PLAYWRIGHT_BROWSERS_PATH=/ms-playwright
21+
ENV NODE_ENV=production
22+
23+
# Entrypoint runs the tests
24+
CMD ["npx", "playwright", "test"]

client/playwright.config.ts

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,43 @@
11
import { defineConfig, devices } from "@playwright/test";
22

3+
const isCI = !!process.env.CI;
4+
5+
const baseURL = process.env.BASE_URL || "https://ralphina.ethz.ch";
6+
7+
const ignoreHTTPSErrors = process.env.E2E_IGNORE_HTTPS_ERRORS === "true";
8+
9+
// Output locations (server will set these to mounted /artifacts/...)
10+
const outputDir = process.env.E2E_OUTPUT_DIR || "test-results";
11+
const reportDir = process.env.E2E_REPORT_DIR || "playwright-report";
12+
13+
// Reporter behavior:
14+
// - Locally: html report (nice), but don’t auto-open
15+
// - CI/server: always html (so nginx can serve it) + also print line output for logs
16+
const reporters = isCI
17+
? [["line"], ["html", { outputFolder: reportDir, open: "never" }]]
18+
: [["html", { outputFolder: reportDir, open: "never" }]];
19+
320
export default defineConfig({
421
testDir: "tests/e2e",
522
fullyParallel: false,
6-
forbidOnly: !!process.env.CI,
7-
retries: process.env.CI ? 2 : 0,
8-
workers: process.env.CI ? 1 : undefined,
9-
reporter: process.env.CI ? "line" : "html",
23+
forbidOnly: isCI,
24+
retries: isCI ? 2 : 0,
25+
workers: isCI ? 1 : undefined,
26+
27+
reporter: reporters,
28+
29+
// This is where screenshots/videos/traces go
30+
outputDir,
31+
1032
use: {
11-
baseURL: process.env.BASE_URL || "https://ralphina.ethz.ch",
33+
baseURL,
1234
trace: "on",
35+
ignoreHTTPSErrors,
1336
contextOptions: {
1437
javaScriptEnabled: true,
1538
},
1639
},
40+
1741
projects: [
1842
{ name: "chromium", use: { ...devices["Desktop Chrome"] } },
1943
{ name: "firefox", use: { ...devices["Desktop Firefox"] } },

0 commit comments

Comments
 (0)