Skip to content

Commit eda7970

Browse files
committed
feat: add cucumber ui tests
1 parent 4aa996a commit eda7970

File tree

10 files changed

+1698
-46
lines changed

10 files changed

+1698
-46
lines changed

.github/workflows/format-check.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ name: Format Check
22

33
on:
44
push:
5-
pull_request:
65

76
jobs:
87
backend-format:

.github/workflows/test.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
6+
jobs:
7+
backend-tests:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- name: Set up Python
12+
uses: actions/setup-python@v5
13+
with:
14+
python-version: "3.12"
15+
- name: Install uv
16+
run: curl -LsSf https://astral.sh/uv/install.sh | sh
17+
- name: Sync dependencies
18+
working-directory: backend
19+
run: uv sync
20+
- name: Run tests
21+
working-directory: backend
22+
run: uv run pytest
23+
24+
frontend-vitest:
25+
runs-on: ubuntu-latest
26+
steps:
27+
- uses: actions/checkout@v4
28+
- name: Set up Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: "20"
32+
- name: Install pnpm
33+
run: npm install -g pnpm
34+
- name: Install dependencies
35+
working-directory: frontend_omni
36+
run: pnpm install
37+
- name: Run vitest tests
38+
working-directory: frontend_omni
39+
run: pnpm test
40+
41+
frontend-cucumber:
42+
runs-on: ubuntu-latest
43+
steps:
44+
- uses: actions/checkout@v4
45+
- name: Set up Node.js
46+
uses: actions/setup-node@v4
47+
with:
48+
node-version: "20"
49+
- name: Install pnpm
50+
run: npm install -g pnpm
51+
- name: Install dependencies
52+
working-directory: frontend_omni
53+
run: pnpm install
54+
- name: Install Playwright browsers
55+
working-directory: frontend_omni
56+
run: pnpm playwright install --with-deps
57+
- name: Run cucumber tests
58+
working-directory: frontend_omni
59+
run: pnpm test:cucumber

frontend_omni/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,14 @@ The frontend is now available under http://localhost:5173
1616
**React Compionents**: PascalCase
1717
**React Services/Hooks**: camalCase
1818
**Folders**: kebab-case
19+
20+
## Testiong
21+
22+
### VS Code Cucumber Extension
23+
24+
In order to make the cucumber extension find cucumber tests, the paths must be adapted for
25+
26+
- `cucumber.features` and
27+
- `cucumber.glue`.
28+
29+
The `frontend_onmi` must be prepended to all the paths.

frontend_omni/cucumber.cjs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
default: {
3+
import: ["tests/**/*.ts"],
4+
format: ["progress"],
5+
formatOptions: {
6+
snippetInterface: "async-await",
7+
},
8+
paths: ["features/**/*.feature"],
9+
publishQuiet: true,
10+
},
11+
};
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
Feature: App loads successfully
2+
3+
Scenario: User opens the app
4+
Given the app is running
5+
When I visit the homepage
6+
Then I should see the page title contains "modAI"

frontend_omni/package.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@
88
"build": "tsc -b && vite build",
99
"lint": "eslint .",
1010
"format:check": "prettier --check .",
11+
"format:write": "prettier --write .",
1112
"check": "pnpm build && pnpm lint && pnpm format:check",
1213
"preview": "vite preview",
13-
"test": "vitest run"
14+
"test": "vitest run",
15+
"test:cucumber": "cucumber-js",
16+
"test:cucumber:headed": "HEADED=true cucumber-js"
1417
},
1518
"dependencies": {
1619
"@ai-sdk/openai": "^2.0.52",
@@ -60,7 +63,9 @@
6063
"use-stick-to-bottom": "^1.1.1"
6164
},
6265
"devDependencies": {
66+
"@cucumber/cucumber": "^12.2.0",
6367
"@eslint/js": "^9.33.0",
68+
"@playwright/test": "^1.56.1",
6469
"@testing-library/jest-dom": "^6.8.0",
6570
"@testing-library/react": "^16.3.0",
6671
"@types/node": "^24.3.0",
@@ -74,8 +79,10 @@
7479
"eslint-plugin-react-refresh": "^0.4.20",
7580
"globals": "^16.3.0",
7681
"jsdom": "^27.0.0",
82+
"playwright": "^1.56.1",
7783
"prettier": "^3.3.3",
7884
"tailwind-scrollbar": "^4.0.2",
85+
"ts-node": "^10.9.2",
7986
"tw-animate-css": "^1.3.7",
8087
"typescript": "~5.8.3",
8188
"typescript-eslint": "^8.39.1",

frontend_omni/playwright.config.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { defineConfig, devices } from "@playwright/test";
2+
3+
export default defineConfig({
4+
testDir: "./tests",
5+
fullyParallel: true,
6+
forbidOnly: !!process.env.CI,
7+
retries: process.env.CI ? 2 : 0,
8+
workers: process.env.CI ? 1 : undefined,
9+
reporter: "html",
10+
use: {
11+
baseURL: "http://localhost:5173",
12+
trace: "on-first-retry",
13+
},
14+
projects: [
15+
{
16+
name: "chromium",
17+
use: { ...devices["Desktop Chrome"] },
18+
},
19+
{
20+
name: "firefox",
21+
use: { ...devices["Desktop Firefox"] },
22+
},
23+
{
24+
name: "webkit",
25+
use: { ...devices["Desktop Safari"] },
26+
},
27+
],
28+
webServer: {
29+
command: "pnpm dev",
30+
url: "http://localhost:5173",
31+
reuseExistingServer: !process.env.CI,
32+
},
33+
});

0 commit comments

Comments
 (0)