Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,27 @@ jobs:

- name: Run Tests
run: pnpm turbo run test

e2e:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '24.x'

- name: Setup pnpm
uses: pnpm/action-setup@v4

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Install dependencies
run: pnpm playwright install chromium chromium-headless-shell

- name: Run Tests
run: pnpm turbo run e2e
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@
**/*.pem
**/.env
**/*.env

# Playwright
**/test-results/
**/playwright-report/
**/blob-report/
**/playwright/.cache/
**/playwright/.auth/
9 changes: 8 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@
"source.organizeImports.biome": "always",
"source.removeUnusedImports": "always"
},
"[css]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[tailwindcss]": {
"editor.defaultFormatter": "biomejs.biome"
},
"[json]": {
"editor.defaultFormatter": "biomejs.biome"
},
Expand All @@ -22,5 +28,6 @@
"**/.DS_Store": true,
"**/.turbo": true,
"**/node_modules": true
}
},
"typescript.preferences.autoImportSpecifierExcludeRegexes": ["node:test"]
}
117 changes: 0 additions & 117 deletions agents.md

This file was deleted.

4 changes: 2 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
"$schema": "https://biomejs.dev/schemas/2.3.8/schema.json",
"files": {
"includes": [
"*.{json,md,yaml}",
"*.{json,md,ts,yaml}",
".github/**/*.{yml,md}",
".vscode/*.json",
"packages/**/*.{json,ts,tsx}",
"{e2e,packages}/**/*.{css,json,ts,tsx}",
"!packages/**/dist/*.{js,ts}"
]
},
Expand Down
17 changes: 16 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,23 @@ test: ## Run Unit tests
test-watch: ## Run Unit tests in watch mode
@pnpm turbo watch test:watch

test-browser: ## Run Unit tests in browser mode
@pnpm turbo run test:browser

test-browser-react-tei: ## Run demo React TEI in browser mode
@pnpm turbo run test:browser --filter="@istex/react-tei"

test-browser-demo: ## Run demo tests in browser mode
@pnpm turbo run test:browser --filter="@istex/viewer-demo"

e2e:
@pnpm turbo run e2e --no-cache

e2e-ui:
@(DEV=1 pnpm playwright test --ui)

typecheck: ## Run type checks
@pnpm turbo run typecheck
@pnpm turbo run typecheck --no-cache

lint-check: ## Run lint checks
@pnpm turbo run lint:check --no-cache
Expand Down
18 changes: 4 additions & 14 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,17 @@
"scripts": {
"lint:apply": "biome check --write",
"lint:check": "biome check",
"prepare": "husky"
"prepare": "husky",
"typecheck": "tsc --noEmit tsconfig.e2e.json"
},
"private": true,
"dependencies": {},
"devDependencies": {
"@biomejs/biome": "catalog:",
"@playwright/test": "^1.57.0",
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@vitejs/plugin-react-swc": "catalog:",
"@vitest/browser-playwright": "catalog:",
"@vitest/coverage-v8": "catalog:",
"husky": "catalog:",
"playwright": "catalog:",
"turbo": "catalog:",
"typescript": "catalog:",
"vite": "catalog:",
"vite-plugin-devtools-json": "catalog:",
"vite-tsconfig-paths": "catalog:",
"vitest": "catalog:",
"vitest-browser-react": "catalog:"
"turbo": "catalog:"
},
"packageManager": "pnpm@10.25.0+sha512.5e82639027af37cf832061bcc6d639c219634488e0f2baebe785028a793de7b525ffcd3f7ff574f5e9860654e098fe852ba8ac5dd5cefe1767d23a020a92f501"
}
1 change: 0 additions & 1 deletion packages/demo/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>demo</title>
</head>
Expand Down
22 changes: 21 additions & 1 deletion packages/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,34 @@
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview --port 8000",
"test": "vitest run --browser.headless",
"test:watch": "vitest watch --browser.headless",
"test:browser": "vitest watch",
"typecheck": "tsc --noEmit"
},
"dependencies": {
"@emotion/react": "catalog:",
"@emotion/styled": "catalog:",
"@fontsource/roboto": "catalog:",
"@istex/react-tei": "workspace:^",
"@mui/icons-material": "catalog:",
"@mui/material": "catalog:",
"react": "catalog:",
"react-dom": "catalog:"
},
"devDependencies": {}
"devDependencies": {
"@types/node": "catalog:",
"@types/react": "catalog:",
"@types/react-dom": "catalog:",
"@vitejs/plugin-react-swc": "catalog:",
"@vitest/browser-playwright": "catalog:",
"@vitest/coverage-v8": "catalog:",
"typescript": "catalog:",
"vite": "catalog:",
"vite-plugin-devtools-json": "catalog:",
"vite-tsconfig-paths": "catalog:",
"vitest": "catalog:",
"vitest-browser-react": "catalog:"
}
}
1 change: 0 additions & 1 deletion packages/demo/public/vite.svg

This file was deleted.

26 changes: 22 additions & 4 deletions packages/demo/src/App.spec.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
import { describe, expect, it } from "vitest";
import { describe, expect, it, vi } from "vitest";
import { userEvent } from "vitest/browser";
import { render } from "vitest-browser-react";

import App from "./App.js";

describe("App", () => {
it('should render "Hello world"', async () => {
it("should render the upload button", async () => {
const screen = await render(<App />);

expect(
screen.getByRole("button", { name: "Select a TEI File to View" }),
).toBeInTheDocument();
});

it("should render the XML document when a file is uploaded", async () => {
const screen = await render(<App />);

expect(screen.getByText("Hello world")).toBeInTheDocument();
const file = new File(["<TEI></TEI>"], "example.tei", {
type: "text/plain",
});

const input = screen.getByTestId("file-selector-input");

await userEvent.upload(input, file);

await vi.waitFor(() => {
expect(screen.getByText(/<TEI><\/TEI>/)).toBeInTheDocument();
});
});
});
16 changes: 15 additions & 1 deletion packages/demo/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
import CssBaseline from "@mui/material/CssBaseline";

import { UploadPage } from "./upload/UploadPage";
import { ViewerContextProvider } from "./viewer/ViewerContext";
import { ViewerPage } from "./viewer/ViewerPage";

function App() {
return "Hello world";
return (
<>
<CssBaseline />
<ViewerContextProvider>
<UploadPage />
<ViewerPage />
</ViewerContextProvider>
</>
);
}

export default App;
3 changes: 3 additions & 0 deletions packages/demo/src/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export function Layout() {
return null;
}
23 changes: 23 additions & 0 deletions packages/demo/src/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
@import "@fontsource/roboto/300.css";
@import "@fontsource/roboto/400.css";
@import "@fontsource/roboto/500.css";
@import "@fontsource/roboto/700.css";

* {
box-sizing: border-box;
}

html {
height: 100%;
width: 100%;
}

body,
#root {
width: 100%;
min-height: 100%;
height: 100%;
padding: 0;
margin: 0;
background-color: var(--mui-palette-background-default);
}
2 changes: 2 additions & 0 deletions packages/demo/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";

import App from "./App.js";
import "./main.css";

const rootElement = document.getElementById("root");

Expand Down
Loading