Skip to content
Open
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
50 changes: 36 additions & 14 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,9 @@ jobs:
python -m pip install --upgrade pip
pip install pipenv

- name: Install dependencies
- name: Install server dependencies
run: |
pipenv sync --dev

- name: Install frontend dependencies
run: |
node --version || true
npm --version || true
(cd app && npm ci)
make install-server

- name: Create test environment file
run: |
Expand All @@ -55,7 +49,7 @@ jobs:

- name: Run unit tests
run: |
pipenv run pytest tests/ -k "not e2e" --verbose
make test-unit

- name: Run lint
run: |
Expand Down Expand Up @@ -88,14 +82,13 @@ jobs:
python -m pip install --upgrade pip
pip install pipenv

- name: Install dependencies
- name: Install server dependencies
run: |
pipenv sync --dev
make install-server

- name: Install Playwright browsers
run: |
pipenv run playwright install chromium
pipenv run playwright install-deps
make install-playwright

- name: Create test environment file
run: |
Expand All @@ -111,7 +104,7 @@ jobs:

- name: Run E2E tests
run: |
pipenv run pytest tests/e2e/ --browser chromium
make test-e2e
env:
CI: true

Expand All @@ -124,3 +117,32 @@ jobs:
test-results/
playwright-report/
retention-days: 30

client-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '18'

- name: Install pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv

- name: Install client dependencies
run: |
make install-clients

- name: Run client tests
run: |
make test-clients
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
.env
.venv
*.pyc
*.egg-info
.vscode/
*_conf*
.ruff_code/
Expand All @@ -20,3 +21,4 @@ node_modules/
/app/public/js/*
.jinja_cache/
demo_tokens.py

23 changes: 19 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,28 @@
.PHONY: help install test test-unit test-e2e test-e2e-headed lint format clean setup-dev build lint-frontend
.PHONY: help install install-server install-clients test test-unit test-e2e test-e2e-headed test-e2e-debug test-clients lint format clean setup-dev build lint-frontend

help: ## Show this help message
@echo 'Usage: make [target]'
@echo ''
@echo 'Targets:'
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-15s %s\n", $$1, $$2}' $(MAKEFILE_LIST)

install: ## Install dependencies
install: install-server install-clients ## Install dependencies

install-server: ## Install server dependencies (Python + frontend, no clients)
pipenv sync --dev
npm install --prefix ./app

install-clients: ## Install client dependencies (Python and TypeScript)
@echo "Installing Python client dependencies..."
cd clients/python && pipenv sync --dev
@echo "Installing TypeScript client dependencies..."
cd clients/ts && npm install

setup-dev: install ## Set up development environment
install-playwright:
pipenv run playwright install chromium
pipenv run playwright install-deps

setup-dev: install install-playwright ## Set up development environment
@echo "Development environment setup complete!"
@echo "Don't forget to copy .env.example to .env and configure your settings"

Expand All @@ -23,7 +32,7 @@ build-dev:
build-prod:
npm --prefix ./app run build

test: build-dev test-unit test-e2e ## Run all tests
test: build-dev test-unit test-e2e test-clients ## Run all tests

test-unit: ## Run unit tests only
pipenv run python -m pytest tests/ -k "not e2e" --verbose
Expand All @@ -40,6 +49,12 @@ test-e2e-headed: build-dev ## Run E2E tests with browser visible
test-e2e-debug: build-dev ## Run E2E tests with debugging enabled
pipenv run python -m pytest tests/e2e/ --browser chromium --slowmo=1000

test-clients: ## Run client tests (Python and TypeScript)
@echo "Running Python client tests..."
cd clients/python && pipenv run pytest tests/ -v
@echo "Running TypeScript client tests..."
cd clients/ts && npm test

lint: ## Run linting (backend + frontend)
@echo "Running backend lint (pylint)"
pipenv run pylint $(shell git ls-files '*.py') || true
Expand Down
2 changes: 1 addition & 1 deletion app/eslint.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module.exports = [
{
rules: {
// Base JS recommended rules
'no-unused-vars': 'warn',
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
// TypeScript rules
'@typescript-eslint/no-explicit-any': 'off',
},
Expand Down
2 changes: 1 addition & 1 deletion app/ts/modules/graph_select.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function clearGraphOptions() {
if (optionsContainer) optionsContainer.innerHTML = '';
}

export function addGraphOption(name: string, onSelect: (n: string) => void, onDelete: (n: string) => void, isDemo: boolean = false) {
export function addGraphOption(name: string, onSelect: (_: string) => void, onDelete: (_: string) => void, isDemo: boolean = false) {
const optionsContainer = document.getElementById('graph-options');
if (!optionsContainer) return;
const row = document.createElement('div');
Expand Down
4 changes: 2 additions & 2 deletions app/ts/modules/left_toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function initLeftToolbar(): void {

try {
setOpen(mq.matches);
} catch (e) {
} catch {
setOpen(true);
}

Expand All @@ -54,7 +54,7 @@ export function initLeftToolbar(): void {
ignoreNextClick = true;
});

btn.addEventListener('click', function (_e: MouseEvent) {
btn.addEventListener('click', function () {
if (ignoreNextClick) {
ignoreNextClick = false;
return;
Expand Down
2 changes: 1 addition & 1 deletion app/ts/modules/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export function addMessage(
tableHeader.appendChild(headerRow);
table.appendChild(tableHeader);
const tableBody = document.createElement("tbody");
queryResult.forEach((row: any, index: number) => {
queryResult.forEach((row: any) => {
const rowRow = document.createElement("tr");
Object.values(row).forEach((value: any) => {
const cell = document.createElement("td");
Expand Down
2 changes: 1 addition & 1 deletion app/ts/modules/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ export function setupDatabaseModal() {
list.scrollTop = list.scrollHeight;
}

dbTypeSelect.addEventListener('change', function(this: HTMLInputElement) {
dbTypeSelect.addEventListener('change', function() {
const selectedType = this.value;
if (selectedType && databaseConfig[selectedType]) {
dbUrlInput.disabled = false;
Expand Down
2 changes: 1 addition & 1 deletion app/ts/modules/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export function setupTokenManagement() {
deleteTokenModal.style.display = 'none';
currentDeleteTokenId = null;
}
} catch (err) {
} catch {
// ignore if computed style fails for any reason
}
}
Expand Down
15 changes: 15 additions & 0 deletions clients/python/Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[packages]
aiohttp = "*"
queryweaver-client = {file = ".", editable = true}

[dev-packages]
pytest = "*"
pytest-asyncio = "*"

[requires]
python_version = "3.12"
Loading