From c59242136f630e478863720033a3a735d51938e6 Mon Sep 17 00:00:00 2001 From: gtheler Date: Thu, 22 Jan 2026 13:22:37 -0300 Subject: [PATCH 01/26] first attempt at testing --- .gitignore | 3 ++ package-lock.json | 75 +++++++++++++++++++++++++++++++++++ package.json | 26 ++++++++++++ playwright.config.js | 28 +++++++++++++ tests/e2e/create_case.spec.js | 38 ++++++++++++++++++ tests/e2e/example.spec.js | 9 +++++ 6 files changed, 179 insertions(+) create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 playwright.config.js create mode 100644 tests/e2e/create_case.spec.js create mode 100644 tests/e2e/example.spec.js diff --git a/.gitignore b/.gitignore index 3f9cfaf..ce2104c 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,4 @@ deps +node_modules/ +test-results/ +playwright-report/ diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..ba8c545 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,75 @@ +{ + "name": "suncae", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "suncae", + "version": "1.0.0", + "license": "ISC", + "devDependencies": { + "@playwright/test": "^1.57.0" + } + }, + "node_modules/@playwright/test": { + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.57.0.tgz", + "integrity": "sha512-6TyEnHgd6SArQO8UO2OMTxshln3QMWBtPGrOCgs3wVEmQmwyuNtB10IZMfmYDE0riwNR1cu4q+pPcxMVtaG3TA==", + "dev": true, + "dependencies": { + "playwright": "1.57.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + } + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/playwright": { + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.57.0.tgz", + "integrity": "sha512-ilYQj1s8sr2ppEJ2YVadYBN0Mb3mdo9J0wQ+UuDhzYqURwSoW4n1Xs5vs7ORwgDGmyEh33tRMeS8KhdkMoLXQw==", + "dev": true, + "dependencies": { + "playwright-core": "1.57.0" + }, + "bin": { + "playwright": "cli.js" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "fsevents": "2.3.2" + } + }, + "node_modules/playwright-core": { + "version": "1.57.0", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.57.0.tgz", + "integrity": "sha512-agTcKlMw/mjBWOnD6kFZttAAGHgi/Nw0CZ2o6JqWSbMlI219lAFLZZCyqByTsvVAJq5XA5H8cA6PrvBRpBWEuQ==", + "dev": true, + "bin": { + "playwright-core": "cli.js" + }, + "engines": { + "node": ">=18" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..f9672cc --- /dev/null +++ b/package.json @@ -0,0 +1,26 @@ +{ + "name": "suncae", + "version": "1.0.0", + "description": "![](doc/logo.svg)", + "main": "index.js", + "directories": { + "doc": "doc" + }, + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/seamplex/suncae.git" + }, + "keywords": [], + "author": "", + "license": "ISC", + "bugs": { + "url": "https://github.com/seamplex/suncae/issues" + }, + "homepage": "https://github.com/seamplex/suncae#readme", + "devDependencies": { + "@playwright/test": "^1.57.0" + } +} diff --git a/playwright.config.js b/playwright.config.js new file mode 100644 index 0000000..3e3f7ea --- /dev/null +++ b/playwright.config.js @@ -0,0 +1,28 @@ +// @ts-check +const { defineConfig, devices } = require('@playwright/test'); + +module.exports = defineConfig({ + testDir: './tests/e2e', + fullyParallel: true, + forbidOnly: !!process.env.CI, + retries: process.env.CI ? 2 : 0, + workers: process.env.CI ? 1 : undefined, + reporter: 'html', + use: { + baseURL: 'http://localhost:8000', + trace: 'on-first-retry', + }, + + projects: [ + { + name: 'chromium', + use: { ...devices['Desktop Chrome'] }, + }, + ], + + webServer: { + command: 'php -S localhost:8000 -t html', + url: 'http://localhost:8000', + reuseExistingServer: !process.env.CI, + }, +}); diff --git a/tests/e2e/create_case.spec.js b/tests/e2e/create_case.spec.js new file mode 100644 index 0000000..55ddb35 --- /dev/null +++ b/tests/e2e/create_case.spec.js @@ -0,0 +1,38 @@ +// @ts-check +const { test, expect } = require('@playwright/test'); +const path = require('path'); + +test('create new case from sample.step', async ({ page }) => { + // 1. Go to /new + await page.goto('/new/'); + + // 2. In that view, there's a file upload input box. Put the file html/new/sample.step in the upload box + // Note: path is relative to the test file. + // tests/e2e/create_case.spec.js -> ../../html/new/sample.step + const sampleFile = path.join(__dirname, '../../html/new/sample.step'); + await page.setInputFiles('#cad', sampleFile); + + // Wait for the file to be processed and preview to be shown + await expect(page.locator('#cad_preview')).toBeVisible({ timeout: 30000 }); + + // 3. Select "Solid mechanics" in the combo box for physics + await page.selectOption('#physics', 'solid'); + + // 4. Select "Mechanical elasticty" in the combo box for problem + await page.selectOption('#problem', 'mechanical'); + + // 5. Select "FeenoX" in the combo box for solver + await page.selectOption('#solver', 'feenox'); + + // 6. Select "Gmsh" in thecombo box for mesher + await page.selectOption('#mesher', 'gmsh'); + + // Verify start button is enabled before clicking + await expect(page.locator('#btn_start')).toBeEnabled(); + + // 7. Click "Start" + await page.click('#btn_start'); + + // Optional: Verify we moved to the next step (e.g., URL changes to create.php or creating a case) + // For now, just ensuring no error occurs immediately after click. +}); diff --git a/tests/e2e/example.spec.js b/tests/e2e/example.spec.js new file mode 100644 index 0000000..f36a88d --- /dev/null +++ b/tests/e2e/example.spec.js @@ -0,0 +1,9 @@ +// @ts-check +const { test, expect } = require('@playwright/test'); + +test('homepage has title', async ({ page }) => { + await page.goto('/'); + + // Expect a title "to contain" a substring. + await expect(page).toHaveTitle(/Faster-than-quick/); +}); From b25da5f82980c913c67e6b895ea39ccfa9e061d3 Mon Sep 17 00:00:00 2001 From: gtheler Date: Fri, 23 Jan 2026 11:06:27 -0300 Subject: [PATCH 02/26] actions --- .github/workflows/playwright.yml | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/playwright.yml diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml new file mode 100644 index 0000000..8f3f26a --- /dev/null +++ b/.github/workflows/playwright.yml @@ -0,0 +1,54 @@ +name: Playwright Tests + +on: + push: + branches: [ main, master ] + pull_request: + branches: [ main, master ] + +jobs: + test: + timeout-minutes: 60 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: yaml + + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot libgl1-mesa-glx libxrender1 libxcursor1 libxft2 libxinerama1 + + - name: Install SunCAE Dependencies (FeenoX & Gmsh) + run: ./deps.sh + + - name: Install Node Dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Start PHP Server + run: php -S localhost:8000 -t html > php-server.log 2>&1 & + + - name: Run Playwright tests + run: npx playwright test + + - name: Upload Playwright Report + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 From 0d1b05732ea5bbb20f707649be0b30a6c932ac37 Mon Sep 17 00:00:00 2001 From: gtheler Date: Fri, 23 Jan 2026 11:19:14 -0300 Subject: [PATCH 03/26] autodetect package name --- .github/workflows/playwright.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 8f3f26a..ef0ba91 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -28,7 +28,8 @@ jobs: - name: Install System Dependencies run: | sudo apt-get update - sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot libgl1-mesa-glx libxrender1 libxcursor1 libxft2 libxinerama1 + sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot libxrender1 libxcursor1 libxft2 libxinerama1 + sudo apt-get install -y libgl1-mesa-glx || sudo apt-get install -y libgl1-mesa-dri || sudo apt-get install -y libgl1 - name: Install SunCAE Dependencies (FeenoX & Gmsh) run: ./deps.sh From c42041468f7ee42ec1fa524a5ccec307a8a1fec4 Mon Sep 17 00:00:00 2001 From: gtheler Date: Fri, 23 Jan 2026 11:24:36 -0300 Subject: [PATCH 04/26] free port 8000 --- .github/workflows/playwright.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ef0ba91..07027db 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -37,6 +37,12 @@ jobs: - name: Install Node Dependencies run: npm ci + - name: Check what's on port 8000 + run: ss -ltnp | grep ':8000' || true + + - name: Free port 8000 (if occupied) + run: npx kill-port 8000 || true + - name: Install Playwright Browsers run: npx playwright install --with-deps From 14df71671b5bd994c993001a55f9871b2eb80775 Mon Sep 17 00:00:00 2001 From: gtheler Date: Fri, 23 Jan 2026 12:39:24 -0300 Subject: [PATCH 05/26] do not start php server --- .github/workflows/playwright.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 07027db..db80050 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -37,17 +37,17 @@ jobs: - name: Install Node Dependencies run: npm ci - - name: Check what's on port 8000 - run: ss -ltnp | grep ':8000' || true - - - name: Free port 8000 (if occupied) - run: npx kill-port 8000 || true +# - name: Check what's on port 8000 +# run: ss -ltnp | grep ':8000' || true +# +# - name: Free port 8000 (if occupied) +# run: npx kill-port 8000 || true - name: Install Playwright Browsers run: npx playwright install --with-deps - - name: Start PHP Server - run: php -S localhost:8000 -t html > php-server.log 2>&1 & + # - name: Start PHP Server + # run: php -S localhost:8000 -t html > php-server.log 2>&1 & - name: Run Playwright tests run: npx playwright test From da365ddf620337093f6ded138bc3ca089a19fe44 Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 16:17:59 -0300 Subject: [PATCH 06/26] missing mkdir bin --- deps.sh | 6 +++++- meshers/gmsh/deps.sh | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/deps.sh b/deps.sh index 7985bc0..1a0e04a 100755 --- a/deps.sh +++ b/deps.sh @@ -19,12 +19,16 @@ for i in wget tar unzip python3; do fi done +# create gitignored directories +mkdir -p deps bin + +# this one needs to be either world writable or owned by the user running the web server +# we start with 0777 but a sane admin would change it back to 0744 (or less) if [ ! -d data ]; then mkdir -p data chmod 0777 data fi -mkdir -p deps # Function to compare versions (include in main deps.sh or source from a utils file) diff --git a/meshers/gmsh/deps.sh b/meshers/gmsh/deps.sh index af53a80..87cdb10 100644 --- a/meshers/gmsh/deps.sh +++ b/meshers/gmsh/deps.sh @@ -36,6 +36,7 @@ if [ $use_system_binary = 0 ]; then echo "error: downloaded gmsh needs ${i}, please do sudo apt install patchelf" exit 1 fi + mkdir -p bin cd deps if [ ! -e ${gmsh_tarball}.tgz ]; then wget -c http://gmsh.info/bin/Linux/${gmsh_tarball}.tgz From 2592b29cb5cb161d0835671c8adb3df409075ddf Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 16:30:14 -0300 Subject: [PATCH 07/26] small improvements --- .github/workflows/playwright.yml | 12 +----------- meshers/gmsh/deps.sh | 1 + uxs/faster-than-quick/deps.sh | 1 + 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index db80050..ab95792 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -28,8 +28,7 @@ jobs: - name: Install System Dependencies run: | sudo apt-get update - sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot libxrender1 libxcursor1 libxft2 libxinerama1 - sudo apt-get install -y libgl1-mesa-glx || sudo apt-get install -y libgl1-mesa-dri || sudo apt-get install -y libgl1 + sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot - name: Install SunCAE Dependencies (FeenoX & Gmsh) run: ./deps.sh @@ -37,18 +36,9 @@ jobs: - name: Install Node Dependencies run: npm ci -# - name: Check what's on port 8000 -# run: ss -ltnp | grep ':8000' || true -# -# - name: Free port 8000 (if occupied) -# run: npx kill-port 8000 || true - - name: Install Playwright Browsers run: npx playwright install --with-deps - # - name: Start PHP Server - # run: php -S localhost:8000 -t html > php-server.log 2>&1 & - - name: Run Playwright tests run: npx playwright test diff --git a/meshers/gmsh/deps.sh b/meshers/gmsh/deps.sh index 87cdb10..3883d1e 100644 --- a/meshers/gmsh/deps.sh +++ b/meshers/gmsh/deps.sh @@ -42,6 +42,7 @@ if [ $use_system_binary = 0 ]; then wget -c http://gmsh.info/bin/Linux/${gmsh_tarball}.tgz fi tar xzf ${gmsh_tarball}.tgz + rm -f ../bin/gmsh.py cp ${gmsh_tarball}/bin/gmsh ../bin cp ${gmsh_tarball}/lib/gmsh.py ../bin cp -d ${gmsh_tarball}/lib/libgmsh.so* ../bin diff --git a/uxs/faster-than-quick/deps.sh b/uxs/faster-than-quick/deps.sh index b572cdb..e04a323 100644 --- a/uxs/faster-than-quick/deps.sh +++ b/uxs/faster-than-quick/deps.sh @@ -105,6 +105,7 @@ if [ $use_system_binary = 0 ]; then if [ ! -d pandoc-${pandoc_version} ]; then tar xvzf ${pandoc_tarball}.tar.gz fi + rm -f ../bin/pandoc cp pandoc-${pandoc_version}/bin/pandoc ../bin echo "done" cd .. From 42e3752c3b0716f51f0aacd9628b4623bbfd7a63 Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 16:51:25 -0300 Subject: [PATCH 08/26] from apt --- .github/workflows/playwright.yml | 53 ++++++++++++++++++++++++++++++-- solvers/feenox/deps.sh | 6 ++-- uxs/faster-than-quick/deps.sh | 2 +- 3 files changed, 54 insertions(+), 7 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index ab95792..8391af4 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -7,7 +7,7 @@ on: branches: [ main, master ] jobs: - test: + playwrigth-standalone: timeout-minutes: 60 runs-on: ubuntu-latest @@ -18,7 +18,7 @@ jobs: uses: actions/setup-node@v4 with: node-version: '18' - + - name: Setup PHP uses: shivammathur/setup-php@v2 with: @@ -30,7 +30,7 @@ jobs: sudo apt-get update sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot - - name: Install SunCAE Dependencies (FeenoX & Gmsh) + - name: Install SunCAE Dependencies (FeenoX & Gmsh) standalone run: ./deps.sh - name: Install Node Dependencies @@ -49,3 +49,50 @@ jobs: name: playwright-report path: playwright-report/ retention-days: 30 + + +jobs: + playwrigth-apt: + timeout-minutes: 60 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '18' + + - name: Setup PHP + uses: shivammathur/setup-php@v2 + with: + php-version: '8.3' + extensions: yaml + + - name: Install System Dependencies + run: | + sudo apt-get update + sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot + + - name: Install SunCAE Dependencies (FeenoX & Gmsh) from apt + run: | + sudo apt-get install -y libgmsh-dev feenox pandoc + ./deps.sh + + - name: Install Node Dependencies + run: npm ci + + - name: Install Playwright Browsers + run: npx playwright install --with-deps + + - name: Run Playwright tests + run: npx playwright test + + - name: Upload Playwright Report + if: failure() + uses: actions/upload-artifact@v4 + with: + name: playwright-report + path: playwright-report/ + retention-days: 30 diff --git a/solvers/feenox/deps.sh b/solvers/feenox/deps.sh index f235db6..db05749 100644 --- a/solvers/feenox/deps.sh +++ b/solvers/feenox/deps.sh @@ -16,14 +16,14 @@ echo -n "meshers/feenox... " use_system_binary=0 if [ -x "$(which feenox 2>/dev/null)" ] && [ $force = 0 ]; then installed_version=$(get_feenox_version "$(which feenox)") - if [ -n "$installed_version" ] && version_ge "$installed_version" "$feenox_min_version"; then - echo "found system version $installed_version (>= $feenox_min_version), using it" + if [ -n "$installed_version" ] && version_ge "$installed_version" "$feenox_version_min"; then + echo "found system version $installed_version (>= $feenox_version_min), using it" use_system_binary=1 # Create symlink to system binary mkdir -p bin ln -sf "$(which feenox)" bin/feenox else - echo "system version $installed_version is too old (need >= $feenox_min_version), will download" + echo "system version $installed_version is too old (need >= $feenox_version_min), will download" fi fi diff --git a/uxs/faster-than-quick/deps.sh b/uxs/faster-than-quick/deps.sh index e04a323..201c160 100644 --- a/uxs/faster-than-quick/deps.sh +++ b/uxs/faster-than-quick/deps.sh @@ -4,7 +4,7 @@ bootstrap_version=5.3.3 bootstrap_icons_version=1.11.3 katex_version=0.16.11 pandoc_version=3.5 -pandoc_version_min=3.2 +pandoc_version_min=3.1 # boostrap (we only need the js, the css comes from bootswatch) echo -n "uxs/faster-than-quick/bootstrap.js... " From e63cb8dd3aa7ea599ae2d25ca3dd945a62016982 Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 16:52:07 -0300 Subject: [PATCH 09/26] fixed yaml --- .github/workflows/playwright.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 8391af4..f5973dc 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -50,8 +50,6 @@ jobs: path: playwright-report/ retention-days: 30 - -jobs: playwrigth-apt: timeout-minutes: 60 runs-on: ubuntu-latest From abf69b263d36d84036bd64e40c15d30d825b478a Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 17:03:33 -0300 Subject: [PATCH 10/26] feenox is not in ubuntu-latest --- .github/workflows/playwright.yml | 3 ++- solvers/feenox/deps.sh | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index f5973dc..77a3ed2 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -75,7 +75,8 @@ jobs: - name: Install SunCAE Dependencies (FeenoX & Gmsh) from apt run: | - sudo apt-get install -y libgmsh-dev feenox pandoc +# feenox 1.2 is not available in ubuntu 24.04, only in 25.10 + sudo apt-get install -y libgmsh-dev pandoc ./deps.sh - name: Install Node Dependencies diff --git a/solvers/feenox/deps.sh b/solvers/feenox/deps.sh index db05749..9fb4e31 100644 --- a/solvers/feenox/deps.sh +++ b/solvers/feenox/deps.sh @@ -1,6 +1,6 @@ #!/bin/false -feenox_version=1.2 +feenox_version=1.2.1 feenox_version_min=1.72 # feenox From f28a45e79bfd0975029ea5daaf3f45218f0b154f Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 17:04:59 -0300 Subject: [PATCH 11/26] fixed syntax --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 77a3ed2..1f69566 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -73,9 +73,9 @@ jobs: sudo apt-get update sudo apt-get install -y unzip patchelf wget php-cli php-yaml gnuplot +# feenox 1.2 is not available in ubuntu 24.04, only in 25.10 - name: Install SunCAE Dependencies (FeenoX & Gmsh) from apt run: | -# feenox 1.2 is not available in ubuntu 24.04, only in 25.10 sudo apt-get install -y libgmsh-dev pandoc ./deps.sh From 8c944a5adca212460ca26ba2ca1cc88057dc6bb0 Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 17:46:32 -0300 Subject: [PATCH 12/26] fixes --- .github/workflows/playwright.yml | 8 ++++---- autoclean.sh | 5 +++++ cadimporters/upload/gmshcheck.py | 1 + cadprocessors/gmsh/cadimport.py | 1 + cadprocessors/gmsh/process.php | 12 ++++++++---- html/common.php | 23 ++++++++++++++--------- renderers/x3dom/deps.sh | 4 ++-- 7 files changed, 35 insertions(+), 19 deletions(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 1f69566..62cb0ed 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -46,8 +46,8 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: playwright-report - path: playwright-report/ + name: playwright-report-standalone + path: playwright-report-stanadlone/ retention-days: 30 playwrigth-apt: @@ -92,6 +92,6 @@ jobs: if: failure() uses: actions/upload-artifact@v4 with: - name: playwright-report - path: playwright-report/ + name: playwright-report-apt + path: playwright-report-apt/ retention-days: 30 diff --git a/autoclean.sh b/autoclean.sh index 0c1cc7f..c547ecb 100644 --- a/autoclean.sh +++ b/autoclean.sh @@ -33,3 +33,8 @@ for i in $(find . -name .gitignore); do cd ${pwd} fi done + +# more +for i in x3dom.js x3dom.css + find . -name {$i} | xargs rm +done diff --git a/cadimporters/upload/gmshcheck.py b/cadimporters/upload/gmshcheck.py index 0722292..89ac3fe 100755 --- a/cadimporters/upload/gmshcheck.py +++ b/cadimporters/upload/gmshcheck.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 import sys +sys.path.append("../../bin") sys.path.append("../../../../bin") import gmsh diff --git a/cadprocessors/gmsh/cadimport.py b/cadprocessors/gmsh/cadimport.py index 1779891..efc7f7f 100755 --- a/cadprocessors/gmsh/cadimport.py +++ b/cadprocessors/gmsh/cadimport.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 import sys +sys.path.append("../../bin") sys.path.append("../../../../bin") import gmsh import os diff --git a/cadprocessors/gmsh/process.php b/cadprocessors/gmsh/process.php index 00154c3..a2cae73 100644 --- a/cadprocessors/gmsh/process.php +++ b/cadprocessors/gmsh/process.php @@ -14,16 +14,20 @@ return_error_json("username is empty"); } -$cad_dir = "../../data/{$username}/cads/{$cad_hash}"; +$cad_dir = $data_dir . "{$username}/cads/{$cad_hash}"; if (file_exists($cad_dir) === false) { - mkdir($cad_dir, $permissions, true); + if (mkdir($cad_dir, $permissions, true) === false) { + return_error_json("cannot mkdir {$cad_dir}"); + } +} +if (chdir($cad_dir) === false) { + return_error_json("cannot chdir to {$cad_dir}"); } -chdir($cad_dir); // ------------------------------------------------------------ if (file_exists("cad.json") === false) { exec(sprintf("%s/cadimport.py 2>&1", __DIR__), $output, $error_level); - + // TODO: keep output if ($error_level != 0) { $error_message = "Error {$error_level} when importing CAD: "; diff --git a/html/common.php b/html/common.php index a1e52fe..3e3cdf7 100644 --- a/html/common.php +++ b/html/common.php @@ -3,8 +3,15 @@ // SunCAE is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. // SunCAE is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. -$permissions = 0755; +$permissions = 0777; $id = (isset($_POST["id"])) ? $_POST["id"] : ((isset($_GET["id"])) ? $_GET["id"] : ""); +$data_dir = __DIR__ . "/../data/"; +if (file_exists($data_dir) === false) { + if (mkdir($data_dir, $permissions, true) === false) { + echo "cannot mkdir {$data_dir}, please check permissions"; + exit(1); + } +} // based on original work from the PHP Laravel framework if (!function_exists('str_contains')) { @@ -16,11 +23,10 @@ function str_contains($haystack, $needle) { function suncae_log_write($file_path, $username, $message) { $log = fopen($file_path, "a"); - if ($log === false) { - suncae_error("Cannot open log file, please check permissions."); + if ($log) { + fprintf($log, "%s %s\t%s: %s\n", date("c"), $_SERVER['REMOTE_ADDR'], $username, $message); + fclose($log); } - fprintf($log, "%s %s\t%s: %s\n", date("c"), $_SERVER['REMOTE_ADDR'], $username, $message); - fclose($log); } @@ -33,7 +39,7 @@ function suncae_log_error($message, $level = 0) { $log_dir = __DIR__ . "/../data/logs/"; if (file_exists($log_dir) == false) { if (mkdir($log_dir, $permissions, true) == false) { - suncae_error("error: cannot create log directory"); + exit(1); } } @@ -43,7 +49,6 @@ function suncae_log_error($message, $level = 0) { if ($level > 0) { suncae_log_write("{$log_dir}0-{$date}.log", $username, $message); } - } @@ -64,7 +69,7 @@ function suncae_log($message, $level = 0) { $log_dir = __DIR__ . "/../data/logs/"; if (file_exists($log_dir) == false) { if (mkdir($log_dir, $permissions, true) == false) { - suncae_error("error: cannot create log directory"); + exit(1); } } @@ -78,7 +83,7 @@ function suncae_log($message, $level = 0) { $log_dir = __DIR__ . "/../data/{$username}/"; if (file_exists($log_dir) == false) { if (mkdir($log_dir, $permissions, true) == false) { - suncae_error("error: cannot create log directory"); + exit(1); } } suncae_log_write("{$log_dir}activity.log", $username, $message); diff --git a/renderers/x3dom/deps.sh b/renderers/x3dom/deps.sh index 826ec60..93b629a 100644 --- a/renderers/x3dom/deps.sh +++ b/renderers/x3dom/deps.sh @@ -19,8 +19,8 @@ if [ $force = 1 ] || [ ! -e renderers/x3dom/x3dom.js ]; then # cp x3dom/x3dom.js ../renderers/x3dom # cp x3dom/x3dom.css ../renderers/x3dom - wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.js -o ../renderers/x3dom/x3dom.js - wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.css -o ../renderers/x3dom/x3dom.css + wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.js -O ../renderers/x3dom/x3dom.js + wget -c https://andreasplesch.github.io/x3dom/dist/x3dom.css -O ../renderers/x3dom/x3dom.css cd ../uxs/faster-than-quick/js if [ ! -e x3dom.js ]; then From 9bfb22be30746a170107f6899178d56b0e5e9938 Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 18:09:19 -0300 Subject: [PATCH 13/26] apt install python3-gmsh instead of libgmsh-dev --- .github/workflows/playwright.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 62cb0ed..f48799b 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -76,7 +76,7 @@ jobs: # feenox 1.2 is not available in ubuntu 24.04, only in 25.10 - name: Install SunCAE Dependencies (FeenoX & Gmsh) from apt run: | - sudo apt-get install -y libgmsh-dev pandoc + sudo apt-get install -y python3-gmsh pandoc ./deps.sh - name: Install Node Dependencies From ee06fb24007c2d6a83abaf44d3781ef0a30632f6 Mon Sep 17 00:00:00 2001 From: jeremy theler Date: Sun, 25 Jan 2026 21:30:33 -0300 Subject: [PATCH 14/26] check script --- deps.sh | 2 +- html/check.php | 106 ++++++++++++++++++++++++++++++++ html/common.php | 20 ++++-- uxs/faster-than-quick/about.php | 7 +-- 4 files changed, 124 insertions(+), 11 deletions(-) create mode 100644 html/check.php diff --git a/deps.sh b/deps.sh index 1a0e04a..1db9b64 100755 --- a/deps.sh +++ b/deps.sh @@ -31,7 +31,7 @@ fi -# Function to compare versions (include in main deps.sh or source from a utils file) +# Function to compare versions version_ge() { printf '%s\n%s\n' "$2" "$1" | sort -V -C return $? diff --git a/html/check.php b/html/check.php new file mode 100644 index 0000000..4039894 --- /dev/null +++ b/html/check.php @@ -0,0 +1,106 @@ +\n"; + +$username_output = []; +exec('whoami', $username_output); +$user = $username_output[0]; + +echo "[info] username running the web server is {$user}
\n"; + +if (file_exists($data_dir) === false) { + if (mkdir($data_dir, 0777) === false) { + echo "[error] cannot create data dir {$data_dir}
\n"; + exit(1); + } +} else { + if (is_dir($data_dir) === false) { + echo "[error] data dir exists but is not a directory
\n"; + exit(2); + } +} + +if (is_writable($data_dir)) { + echo "[good] {$data_dir} is writable by user {$user}
\n"; +} else { + echo "[error] {$data_dir} is not writable by user {$user}
\n"; + exit(3); +} + +// --- bin dir ---------------- +$version_output = []; +$bin_dir = __DIR__ . "/../bin"; +echo "[info] bin_dir is {$bin_dir}
\n"; + +if (file_exists($bin_dir) && is_dir($bin_dir)) { + echo "[good] {$bin_dir} exists
\n"; +} else { + echo "[error] {$bin_dir} does not exist
\n"; + exit(4); +} + + + + +// --- logging ---------------------------------- +include("common.php"); +$username = "root"; +$err = suncae_log("running check.php script"); + +if ($err == 0) { + echo "[good] logging works
\n"; +} else { + echo "[error] cannot create a log entry
\n"; + exit(5); +} + + +// conf +include("../conf.php"); + +// --- auth ---------------------------------- +if (file_exists(__DIR__ . "/../auths/{$auth}/auth.php")) { + echo "[good] auth {$auth} exists
\n"; +} else { + echo "[error] auth {$auth} does not exist
\n"; + exit(6); +} + +// --- ux ---------------------------------- +if (file_exists(__DIR__ . "/../uxs/{$ux}/index.php")) { + echo "[good] ux {$ux} exists
\n"; +} else { + echo "[error] ux {$ux} does not exist
\n"; + exit(7); +} + +if ($ux == "faster-than-quick") { + foreach (['css/bootstrap.min.css', 'css/katex.min.css', 'css/x3dom.css'] as $i) { + if (file_exists(__DIR__ . "/../uxs/{$ux}/{$i}")) { + echo "[good] {$i} exists
\n"; + } else { + echo "[error] {$i} does not exist
\n"; + exit(8); + } + } + + // pandoc + if (file_exists("{$bin_dir}/pandoc")) { + echo "[good] pandoc binary exists
\n"; + } else { + echo "[error] pandoc binary does not exist
\n"; + exit(9); + } + exec("{$bin_dir}/pandoc --version", $version_output, $err); + if ($err == 0) { + echo "[good] pandoc version is {$version_output[0]}
\n"; + } else { + echo "[error] pandoc binary does not work
\n"; + exit(10); + } +} + + + diff --git a/html/common.php b/html/common.php index 3e3cdf7..ec90dfe 100644 --- a/html/common.php +++ b/html/common.php @@ -24,10 +24,13 @@ function suncae_log_write($file_path, $username, $message) { $log = fopen($file_path, "a"); if ($log) { - fprintf($log, "%s %s\t%s: %s\n", date("c"), $_SERVER['REMOTE_ADDR'], $username, $message); + $ip = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : "localhost"; + fprintf($log, "%s %s\t%s: %s\n", date("c"), $ip, $username, $message); fclose($log); + return 0; + } else { + return 1; } - } function suncae_log_error($message, $level = 0) { @@ -69,25 +72,30 @@ function suncae_log($message, $level = 0) { $log_dir = __DIR__ . "/../data/logs/"; if (file_exists($log_dir) == false) { if (mkdir($log_dir, $permissions, true) == false) { - exit(1); + return 1; } } $date = date('Y-m-d'); suncae_log_write("{$log_dir}0-{$date}.log", $username, $message); if ($level > 0) { - suncae_log_write("{$log_dir}{$level}-{$date}.log", $username, $message); + if (suncae_log_write("{$log_dir}{$level}-{$date}.log", $username, $message) != 0) { + return 1; + } } if ($username != "anonymous") { $log_dir = __DIR__ . "/../data/{$username}/"; if (file_exists($log_dir) == false) { if (mkdir($log_dir, $permissions, true) == false) { - exit(1); + return 2; } } - suncae_log_write("{$log_dir}activity.log", $username, $message); + if (suncae_log_write("{$log_dir}activity.log", $username, $message) != 0) { + return 1; + } } + return 0; } diff --git a/uxs/faster-than-quick/about.php b/uxs/faster-than-quick/about.php index 7f3134d..be6f335 100644 --- a/uxs/faster-than-quick/about.php +++ b/uxs/faster-than-quick/about.php @@ -18,16 +18,15 @@
Versions
"; -echo "Gmsh ".`../bin/gmsh -info | head -n1`; +// get versions from a txt file? ?> +To be done.
License
GNU Affero General Public License version 3, or at your option, any later version. You can get a copy of the source code of this web interface here. - +