diff --git a/.github/workflows/pr-e2e-mvp.yml b/.github/workflows/pr-e2e-mvp.yml
index 8e6c88bb..161b525d 100644
--- a/.github/workflows/pr-e2e-mvp.yml
+++ b/.github/workflows/pr-e2e-mvp.yml
@@ -31,10 +31,20 @@ jobs:
cache: 'npm'
cache-dependency-path: tests/e2e/package-lock.json
- - name: Install LibreOffice
+ - name: Setup Python 3.11
+ uses: actions/setup-python@v5
+ with:
+ python-version: '3.11'
+
+ - name: Install LibreOffice + zip
run: |
sudo apt-get update
- sudo apt-get install -y libreoffice
+ sudo apt-get install -y libreoffice zip
+
+ - name: Setup Python deps for office fixtures
+ run: |
+ python -m pip install --upgrade pip
+ pip install -r tests/e2e/requirements.txt
- name: Build kkFileView
run: mvn -q -pl server -DskipTests package
@@ -45,9 +55,6 @@ jobs:
npm install
npx playwright install --with-deps chromium
- - name: Generate fixtures
- run: node tests/e2e/scripts/generate-fixtures.mjs
-
- name: Start fixture server
run: |
cd tests/e2e/fixtures
diff --git a/tests/e2e/.gitignore b/tests/e2e/.gitignore
index 945fcd0d..f3b87092 100644
--- a/tests/e2e/.gitignore
+++ b/tests/e2e/.gitignore
@@ -1,3 +1,9 @@
node_modules/
playwright-report/
test-results/
+
+__pycache__/
+fixtures/zip-tmp/
+fixtures/sample.docx
+fixtures/sample.xlsx
+fixtures/sample.pptx
diff --git a/tests/e2e/README.md b/tests/e2e/README.md
index d3861d6e..593fa4dd 100644
--- a/tests/e2e/README.md
+++ b/tests/e2e/README.md
@@ -5,6 +5,8 @@ This folder contains a first MVP of end-to-end automated tests.
## What is covered
- Basic preview smoke checks for common file types (txt/md/json/xml/csv/html/png)
+- Office Phase-2 smoke checks (docx/xlsx/pptx)
+- Archive smoke check (zip)
- Basic endpoint reachability
- Security regression checks for blocked internal-network hosts (`10.*`) on:
- `/onlinePreview`
@@ -24,13 +26,16 @@ mvn -q -pl server -DskipTests package
cd tests/e2e
npm install
npx playwright install --with-deps chromium
+pip3 install -r requirements.txt
```
+> Prerequisite: ensure `zip` command is available in PATH (used for `sample.zip` fixture generation).
+
3. Generate fixtures and start fixture server:
```bash
cd /path/to/kkFileView
-node tests/e2e/scripts/generate-fixtures.mjs
+npm run gen:all
cd tests/e2e/fixtures && python3 -m http.server 18080
```
diff --git a/tests/e2e/fixtures/sample.zip b/tests/e2e/fixtures/sample.zip
new file mode 100644
index 00000000..00235853
Binary files /dev/null and b/tests/e2e/fixtures/sample.zip differ
diff --git a/tests/e2e/package.json b/tests/e2e/package.json
index 49cb525c..6e08946d 100644
--- a/tests/e2e/package.json
+++ b/tests/e2e/package.json
@@ -4,9 +4,12 @@
"version": "0.1.0",
"type": "module",
"scripts": {
+ "gen:fixtures": "node ./scripts/generate-fixtures.mjs",
+ "gen:office": "python3 ./scripts/generate-office-fixtures.py",
+ "gen:all": "npm run gen:fixtures && npm run gen:office",
+ "pretest": "npm run gen:all",
"test": "playwright test",
- "test:headed": "playwright test --headed",
- "gen:fixtures": "node ./scripts/generate-fixtures.mjs"
+ "test:headed": "playwright test --headed"
},
"devDependencies": {
"@playwright/test": "^1.55.0"
diff --git a/tests/e2e/requirements.txt b/tests/e2e/requirements.txt
new file mode 100644
index 00000000..663606bb
--- /dev/null
+++ b/tests/e2e/requirements.txt
@@ -0,0 +1,3 @@
+python-docx==1.1.2
+openpyxl==3.1.5
+python-pptx==1.0.2
diff --git a/tests/e2e/scripts/generate-fixtures.mjs b/tests/e2e/scripts/generate-fixtures.mjs
index e43b5d8c..afd108cb 100644
--- a/tests/e2e/scripts/generate-fixtures.mjs
+++ b/tests/e2e/scripts/generate-fixtures.mjs
@@ -1,7 +1,10 @@
import fs from 'node:fs';
import path from 'node:path';
+import { execFileSync } from 'node:child_process';
+import { fileURLToPath } from 'node:url';
-const fixturesDir = path.resolve(process.cwd(), 'tests/e2e/fixtures');
+const __dirname = path.dirname(fileURLToPath(import.meta.url));
+const fixturesDir = path.resolve(__dirname, '..', 'fixtures');
fs.mkdirSync(fixturesDir, { recursive: true });
const write = (name, content) => fs.writeFileSync(path.join(fixturesDir, name), content);
@@ -13,6 +16,22 @@ write('sample.xml', '