From 43a4a98f6f0fa36c59c9f04631d49c182f336f46 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 08:15:44 +0000 Subject: [PATCH 01/33] chore(deps): bump lucide-react from 0.503.0 to 0.522.0 in /web-app Bumps [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) from 0.503.0 to 0.522.0. - [Release notes](https://github.com/lucide-icons/lucide/releases) - [Commits](https://github.com/lucide-icons/lucide/commits/0.522.0/packages/lucide-react) --- updated-dependencies: - dependency-name: lucide-react dependency-version: 0.522.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- web-app/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-app/package.json b/web-app/package.json index 8b3193817..4579b2a04 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -45,7 +45,7 @@ "i18next": "^25.0.1", "katex": "^0.16.22", "lodash.debounce": "^4.0.8", - "lucide-react": "^0.503.0", + "lucide-react": "^0.522.0", "motion": "^12.10.5", "next-themes": "^0.4.6", "posthog-js": "^1.246.0", From 5185d1912972b3bc1cccc1350fe1bbd6f1f90744 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 24 Jun 2025 07:56:32 +0000 Subject: [PATCH 02/33] chore(deps-dev): bump typescript from 5.7.3 to 5.8.3 Bumps [typescript](https://github.com/microsoft/TypeScript) from 5.7.3 to 5.8.3. - [Release notes](https://github.com/microsoft/TypeScript/releases) - [Changelog](https://github.com/microsoft/TypeScript/blob/main/azure-pipelines.release-publish.yml) - [Commits](https://github.com/microsoft/TypeScript/compare/v5.7.3...v5.8.3) --- updated-dependencies: - dependency-name: typescript dependency-version: 5.8.3 dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- core/package.json | 2 +- web-app/package.json | 2 +- yarn.lock | 20 ++++++++++---------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/core/package.json b/core/package.json index 1e6291375..dffc2bcfd 100644 --- a/core/package.json +++ b/core/package.json @@ -40,7 +40,7 @@ "rolldown": "1.0.0-beta.1", "ts-jest": "^29.2.5", "tslib": "^2.6.2", - "typescript": "^5.3.3" + "typescript": "^5.8.3" }, "dependencies": { "rxjs": "^7.8.1", diff --git a/web-app/package.json b/web-app/package.json index 8b3193817..dcbc0be62 100644 --- a/web-app/package.json +++ b/web-app/package.json @@ -87,7 +87,7 @@ "eslint-plugin-react-refresh": "^0.4.19", "globals": "^16.0.0", "tailwind-merge": "^3.2.0", - "typescript": "~5.7.2", + "typescript": "~5.8.3", "typescript-eslint": "^8.26.1", "vite": "^6.3.0", "vite-plugin-node-polyfills": "^0.23.0", diff --git a/yarn.lock b/yarn.lock index 55e915e56..0a0a1b56e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2247,7 +2247,7 @@ __metadata: rxjs: "npm:^7.8.1" ts-jest: "npm:^29.2.5" tslib: "npm:^2.6.2" - typescript: "npm:^5.3.3" + typescript: "npm:^5.8.3" ulidx: "npm:^2.3.0" languageName: unknown linkType: soft @@ -2326,7 +2326,7 @@ __metadata: tailwindcss: "npm:^4.1.4" token.js: "npm:token.js-fork@0.7.9" tw-animate-css: "npm:^1.2.7" - typescript: "npm:~5.7.2" + typescript: "npm:~5.8.3" typescript-eslint: "npm:^8.26.1" ulidx: "npm:^2.4.1" unified: "npm:^11.0.5" @@ -18434,23 +18434,23 @@ __metadata: languageName: node linkType: hard -"typescript@npm:^5.3.3, typescript@npm:~5.7.2": - version: 5.7.3 - resolution: "typescript@npm:5.7.3" +"typescript@npm:^5.8.3, typescript@npm:~5.8.3": + version: 5.8.3 + resolution: "typescript@npm:5.8.3" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/b7580d716cf1824736cc6e628ab4cd8b51877408ba2be0869d2866da35ef8366dd6ae9eb9d0851470a39be17cbd61df1126f9e211d8799d764ea7431d5435afa + checksum: 10c0/5f8bb01196e542e64d44db3d16ee0e4063ce4f3e3966df6005f2588e86d91c03e1fb131c2581baf0fb65ee79669eea6e161cd448178986587e9f6844446dbb48 languageName: node linkType: hard -"typescript@patch:typescript@npm%3A^5.3.3#optional!builtin, typescript@patch:typescript@npm%3A~5.7.2#optional!builtin": - version: 5.7.3 - resolution: "typescript@patch:typescript@npm%3A5.7.3#optional!builtin::version=5.7.3&hash=5786d5" +"typescript@patch:typescript@npm%3A^5.8.3#optional!builtin, typescript@patch:typescript@npm%3A~5.8.3#optional!builtin": + version: 5.8.3 + resolution: "typescript@patch:typescript@npm%3A5.8.3#optional!builtin::version=5.8.3&hash=5786d5" bin: tsc: bin/tsc tsserver: bin/tsserver - checksum: 10c0/6fd7e0ed3bf23a81246878c613423730c40e8bdbfec4c6e4d7bf1b847cbb39076e56ad5f50aa9d7ebd89877999abaee216002d3f2818885e41c907caaa192cc4 + checksum: 10c0/39117e346ff8ebd87ae1510b3a77d5d92dae5a89bde588c747d25da5c146603a99c8ee588c7ef80faaf123d89ed46f6dbd918d534d641083177d5fac38b8a1cb languageName: node linkType: hard From 5373b9336c77adf3b4e5f5673fa012023992a414 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 23 Jun 2025 08:25:34 +0000 Subject: [PATCH 03/33] chore(deps): bump lucide-react from 0.372.0 to 0.522.0 in /docs Bumps [lucide-react](https://github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react) from 0.372.0 to 0.522.0. - [Release notes](https://github.com/lucide-icons/lucide/releases) - [Commits](https://github.com/lucide-icons/lucide/commits/0.522.0/packages/lucide-react) --- updated-dependencies: - dependency-name: lucide-react dependency-version: 0.522.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- docs/package.json | 2 +- docs/yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/package.json b/docs/package.json index fd691a09a..08ff495c0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -27,7 +27,7 @@ "embla-carousel-react": "^8.0.0", "fs": "^0.0.1-security", "gray-matter": "^4.0.3", - "lucide-react": "^0.372.0", + "lucide-react": "^0.522.0", "next": "^14.1.4", "next-seo": "^6.5.0", "next-sitemap": "^4.2.3", diff --git a/docs/yarn.lock b/docs/yarn.lock index dd88120aa..eb57429c8 100644 --- a/docs/yarn.lock +++ b/docs/yarn.lock @@ -5503,10 +5503,10 @@ lru-cache@^4.0.1: pseudomap "^1.0.2" yallist "^2.1.2" -lucide-react@^0.372.0: - version "0.372.0" - resolved "https://registry.npmjs.org/lucide-react/-/lucide-react-0.372.0.tgz" - integrity sha512-0cKdqmilHXWUwWAWnf6CrrjHD8YaqPMtLrmEHXolZusNTr9epULCsiJwIOHk2q1yFxdEwd96D4zShlAj67UJdA== +lucide-react@^0.522.0: + version "0.522.0" + resolved "https://registry.yarnpkg.com/lucide-react/-/lucide-react-0.522.0.tgz#c0951dd32936b6a7bcc474a829a251fede0bdfbd" + integrity sha512-jnJbw974yZ7rQHHEFKJOlWAefG3ATSCZHANZxIdx8Rk/16siuwjgA4fBULpXEAWx/RlTs3FzmKW/udWUuO0aRw== lz-string@^1.5.0: version "1.5.0" From 942a3d619586db288c8602ef814c1f4add4ed328 Mon Sep 17 00:00:00 2001 From: Nicole Zhu Date: Wed, 25 Jun 2025 14:42:49 +0800 Subject: [PATCH 04/33] chore: update issue templates for goals --- .github/ISSUE_TEMPLATE/goal.md | 16 ++++++++++++++ .github/ISSUE_TEMPLATE/roadmap.md | 35 ------------------------------- 2 files changed, 16 insertions(+), 35 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/goal.md delete mode 100644 .github/ISSUE_TEMPLATE/roadmap.md diff --git a/.github/ISSUE_TEMPLATE/goal.md b/.github/ISSUE_TEMPLATE/goal.md new file mode 100644 index 000000000..f5f5f4dff --- /dev/null +++ b/.github/ISSUE_TEMPLATE/goal.md @@ -0,0 +1,16 @@ +--- +name: Goal +about: Team-wide Quarterly Goals for Jan +title: 'goal: ' +labels: '' +assignees: freelerobot + +--- + +## Goal + +## Motivation + +## Key Outcomes + +## Related Epics diff --git a/.github/ISSUE_TEMPLATE/roadmap.md b/.github/ISSUE_TEMPLATE/roadmap.md deleted file mode 100644 index 7947f31bf..000000000 --- a/.github/ISSUE_TEMPLATE/roadmap.md +++ /dev/null @@ -1,35 +0,0 @@ ---- -name: Roadmap -about: Plan Roadmap items with subtasks -title: 'roadmap: ' -labels: 'type: planning' -assignees: '' - ---- - -## Goal - -## Tasklist - -### Frontend -- [ ] link to janhq/jan epics - -**Bugs** -- [ ] link to bugs - -### Backend -- [ ] link to janhq/cortex.cpp epics - -**Bugs** -- [ ] link to bug issues - -### Infra -- [ ] link to infra issues - -### Administrative / Management -- [ ] link to infra issues - -### Marketing - -------- -## Resources From ae25dbbbc45a3a90b2045c85af47ffd4cb22d7f7 Mon Sep 17 00:00:00 2001 From: DistractionRectangle <48034372+DistractionRectangle@users.noreply.github.com> Date: Thu, 26 Jun 2025 22:18:16 -0700 Subject: [PATCH 05/33] chore: update .devcontainer to provide a reproducible build environment (#5558) --- .devcontainer/devcontainer.json | 20 ++++++++++++++++++-- .devcontainer/postCreateCommand.sh | 20 ++++++++++++++++++++ 2 files changed, 38 insertions(+), 2 deletions(-) create mode 100755 .devcontainer/postCreateCommand.sh diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index db1eed38d..f42828b31 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,4 +1,20 @@ { - "name": "jan", - "image": "node:20" + "name": "Jan", + "image": "mcr.microsoft.com/devcontainers/base:jammy", + "features": { + "ghcr.io/devcontainers/features/node:1": { + "version": "20" + }, + "ghcr.io/devcontainers/features/rust:1": {}, + "ghcr.io/devcontainers-extra/features/corepack:1": {} + }, + + "postCreateCommand": "./.devcontainer/postCreateCommand.sh", + + // appimagekit requires fuse to package appimage, to use fuse in the container you need to enable it on the host + "runArgs": [ + "--device", "/dev/fuse", + "--cap-add=SYS_ADMIN", + "--security-opt", "apparmor:unconfined" + ] } diff --git a/.devcontainer/postCreateCommand.sh b/.devcontainer/postCreateCommand.sh new file mode 100755 index 000000000..79fb4de1c --- /dev/null +++ b/.devcontainer/postCreateCommand.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash + +# install tauri prerequisites + xdg-utils for xdg-open + libfuse2 for using appimagekit + +sudo apt update +sudo apt install -yqq libwebkit2gtk-4.1-dev \ + build-essential \ + curl \ + wget \ + file \ + libxdo-dev \ + libssl-dev \ + libayatana-appindicator3-dev \ + librsvg2-dev \ + xdg-utils \ + libfuse2 + +sudo mkdir -p /opt/bin +sudo wget https://github.com/AppImage/AppImageKit/releases/download/continuous/appimagetool-x86_64.AppImage -O /opt/bin/appimagetool +sudo chmod +x /opt/bin/appimagetool \ No newline at end of file From 239f93e48d4addf3bc0ca04120fe8544309831e0 Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Minh <91668012+Minh141120@users.noreply.github.com> Date: Fri, 27 Jun 2025 13:09:19 +0700 Subject: [PATCH 06/33] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20update=20issue=20?= =?UTF-8?q?template=20(#5572)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: update label feature request * chore: remove labels type bug --- .github/ISSUE_TEMPLATE/bug_report.yml | 1 - .github/ISSUE_TEMPLATE/feature_request.yml | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index be0f34319..940383f72 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,6 +1,5 @@ name: "\U0001F41B Bug Report" description: "If something isn't working as expected \U0001F914" -labels: [ "type: bug" ] title: 'bug: [DESCRIPTION]' body: diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index b1a10e856..8e7fb4ca7 100644 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,7 +1,7 @@ name: "\U0001F680 Feature Request" description: "Suggest an idea for this project \U0001F63B!" title: 'idea: [DESCRIPTION]' -labels: 'type: feature request' +labels: 'feature request' body: - type: textarea validations: From 242fbcd43e87087b99dfa19e5bc3d3741c57e433 Mon Sep 17 00:00:00 2001 From: Sam Hoang Van Date: Fri, 27 Jun 2025 13:27:25 +0700 Subject: [PATCH 07/33] chore: update mise.toml configuration (#5556) --- mise.toml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/mise.toml b/mise.toml index ea6d3e65b..9f6cee5c7 100644 --- a/mise.toml +++ b/mise.toml @@ -24,13 +24,7 @@ run = [ [tasks.install] description = "Install dependencies" depends = ["config-yarn"] -run = ''' -#!/usr/bin/env bash -# Skip install on Windows per Makefile logic -if [[ "$OSTYPE" != "msys" && "$OSTYPE" != "win32" ]]; then - yarn install -fi -''' +run = "yarn install" sources = ['package.json', 'yarn.lock'] outputs = ['node_modules'] From 472ef88bdca06aecb6a2adceb1f6a356cc3ac9fe Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Minh <91668012+Minh141120@users.noreply.github.com> Date: Fri, 27 Jun 2025 23:21:28 +0700 Subject: [PATCH 08/33] chore: flexible installation path windows installer (#5573) --- src-tauri/tauri.bundle.windows.nsis.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src-tauri/tauri.bundle.windows.nsis.template b/src-tauri/tauri.bundle.windows.nsis.template index 2da569bac..e991d62f7 100644 --- a/src-tauri/tauri.bundle.windows.nsis.template +++ b/src-tauri/tauri.bundle.windows.nsis.template @@ -33,7 +33,7 @@ ${StrLoc} !define VERSION "jan_version" !define VERSIONWITHBUILD "jan_build" !define HOMEPAGE "" -!define INSTALLMODE "currentUser" +!define INSTALLMODE "both" !define LICENSE "" !define INSTALLERICON "D:\a\jan\jan\src-tauri\icons\icon.ico" !define SIDEBARIMAGE "" From a7453d16ef172f6c7581cd94079c802ebba3a785 Mon Sep 17 00:00:00 2001 From: Nguyen Ngoc Minh <91668012+Minh141120@users.noreply.github.com> Date: Sat, 28 Jun 2025 15:50:48 +0700 Subject: [PATCH 09/33] ci: add issues to project board (#5583) --- .github/workflows/issues.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 .github/workflows/issues.yaml diff --git a/.github/workflows/issues.yaml b/.github/workflows/issues.yaml new file mode 100644 index 000000000..732f66862 --- /dev/null +++ b/.github/workflows/issues.yaml @@ -0,0 +1,16 @@ +name: Adds all issues to project board + +on: + issues: + types: + - opened + +jobs: + add-to-project: + name: Add issue to project + runs-on: ubuntu-latest + steps: + - uses: actions/add-to-project@v1.0.2 + with: + project-url: https://github.com/orgs/${{ vars.ORG_NAME }}/projects/${{ vars.JAN_PROJECT_NUMBER }} + github-token: ${{ secrets.AUTO_ADD_TICKET_PAT }} From 834bc39242813320c8a2a777604229e7dd03dc03 Mon Sep 17 00:00:00 2001 From: Louis Date: Sun, 29 Jun 2025 17:12:16 +0700 Subject: [PATCH 10/33] test: init e2e test with selenium and CI work (#5591) * test: init e2e test * Update yarn.lock --- .../jan-electron-linter-and-test.yml | 54 ++ .../template-tauri-build-linux-x64.yml | 2 +- .vscode/settings.json | 5 +- Makefile | 11 +- package.json | 8 +- src-tauri/Cargo.toml | 4 +- src-tauri/src/core/setup.rs | 19 +- tests-e2e-js/.gitignore | 1 + tests-e2e-js/package.json | 23 + tests-e2e-js/src/main.ts | 51 ++ tests-e2e-js/tsconfig.json | 21 + web-app/src/containers/ChatInput.tsx | 2 + web-app/src/containers/LeftPanel.tsx | 1 + web-app/src/routes/hub.tsx | 7 +- web-app/src/routes/threads/$threadId.tsx | 7 +- yarn.lock | 558 +++++++++++++++++- 16 files changed, 732 insertions(+), 42 deletions(-) create mode 100644 tests-e2e-js/.gitignore create mode 100644 tests-e2e-js/package.json create mode 100644 tests-e2e-js/src/main.ts create mode 100644 tests-e2e-js/tsconfig.json diff --git a/.github/workflows/jan-electron-linter-and-test.yml b/.github/workflows/jan-electron-linter-and-test.yml index 6c2842c30..e895baf06 100644 --- a/.github/workflows/jan-electron-linter-and-test.yml +++ b/.github/workflows/jan-electron-linter-and-test.yml @@ -154,6 +154,10 @@ jobs: with: node-version: 20 + - name: Install tauri-driver dependencies + run: | + cargo install tauri-driver --locked + # Clean cache, continue on error - name: 'Cleanup cache' shell: powershell @@ -192,11 +196,25 @@ jobs: with: fetch-depth: 0 + - uses: actions/cache@v4 # v4 + with: + path: | + ~/.cargo/bin/ + ~/.cargo/registry/index/ + ~/.cargo/registry/cache/ + ~/.cargo/git/db/ + target/ + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/yarn.lock') }} + - name: Installing node uses: actions/setup-node@v3 with: node-version: 20 + - name: Install tauri-driver dependencies + run: | + cargo install tauri-driver --locked + # Clean cache, continue on error - name: 'Cleanup cache' shell: powershell @@ -221,6 +239,20 @@ jobs: # run: | # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}" + - name: Install Prerequisites + shell: 'powershell' + # https://github.com/actions/runner-images/issues/9538 + # https://github.com/microsoft/playwright/pull/30009/files + # https://github.com/tauri-apps/wry/issues/1268 + # Evergreen Bootstrapper + # The Bootstrapper is a tiny installer that downloads + # the Evergreen Runtime matching device architecture + # and installs it locally. + # https://developer.microsoft.com/en-us/microsoft-edge/webview2/consumer/?form=MA13LH + run: | + Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe' + Start-Process -FilePath setup.exe -Verb RunAs -Wait + - name: Linter and test shell: powershell run: | @@ -240,6 +272,10 @@ jobs: with: node-version: 20 + - name: Install tauri-driver dependencies + run: | + cargo install tauri-driver --locked + # Clean cache, continue on error - name: 'Cleanup cache' shell: powershell @@ -272,6 +308,15 @@ jobs: with: node-version: 20 + - name: Install Tauri dependencies + run: | + sudo apt update + sudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev libfuse2 webkit2gtk-driver + + - name: Install tauri-driver dependencies + run: | + cargo install tauri-driver --locked + - name: 'Cleanup cache' continue-on-error: true run: | @@ -368,6 +413,15 @@ jobs: with: node-version: 20 + - name: Install Tauri dependencies + run: | + sudo apt update + sudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev libfuse2 webkit2gtk-driver + + - name: Install tauri-driver dependencies + run: | + cargo install tauri-driver --locked + - name: 'Cleanup cache' continue-on-error: true run: | diff --git a/.github/workflows/template-tauri-build-linux-x64.yml b/.github/workflows/template-tauri-build-linux-x64.yml index 9356c3f28..18f6c40e9 100644 --- a/.github/workflows/template-tauri-build-linux-x64.yml +++ b/.github/workflows/template-tauri-build-linux-x64.yml @@ -96,7 +96,7 @@ jobs: run: | cargo install ctoml - - name: Install Tauri dependecies + - name: Install Tauri dependencies run: | sudo apt update sudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev libfuse2 diff --git a/.vscode/settings.json b/.vscode/settings.json index 9bf4d12b5..78bf4f0ab 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,4 +1,7 @@ { "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true + "editor.formatOnSave": true, + "[rust]": { + "editor.defaultFormatter": "rust-lang.rust-analyzer" + } } diff --git a/Makefile b/Makefile index 56b50a9d2..6e69c602d 100644 --- a/Makefile +++ b/Makefile @@ -33,23 +33,14 @@ dev: install-and-build yarn copy:lib yarn dev -# Deprecated soon -dev-tauri: install-and-build - yarn install:cortex - yarn download:bin - yarn copy:lib - yarn dev:tauri - # Linting lint: install-and-build yarn lint # Testing test: lint - # yarn build:test - # yarn test:coverage - # Need e2e setup for tauri backend yarn test + yarn test:e2e # Builds and publishes the app build-and-publish: install-and-build diff --git a/package.json b/package.json index 4d9f8382e..7e525f07b 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,8 @@ "workspaces": { "packages": [ "core", - "web-app" + "web-app", + "tests-e2e-js" ] }, "scripts": { @@ -13,6 +14,11 @@ "build": "yarn build:web && yarn build:tauri", "test": "yarn workspace @janhq/web-app test", "test:coverage": "yarn workspace @janhq/web-app test", + "test:prepare": "yarn build:icon && yarn copy:lib && yarn copy:assets:tauri && yarn build --no-bundle ", + "test:e2e:linux": "yarn test:prepare && xvfb-run yarn workspace tests-e2-js test", + "test:e2e:win32": "yarn test:prepare && yarn workspace tests-e2-js test", + "test:e2e:darwin": "echo 'E2E tests are not supported on macOS yet due to WebDriver limitations'", + "test:e2e": "run-script-os", "dev:web": "yarn workspace @janhq/web-app dev", "dev:tauri": "CLEAN=true yarn build:icon && yarn copy:assets:tauri && tauri dev", "install:cortex:linux:darwin": "cd src-tauri/binaries && ./download.sh", diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c55c8ea4e..7068ffba6 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -19,8 +19,8 @@ tauri-build = { version = "2.0.2", features = [] } serde_json = "1.0" serde = { version = "1.0", features = ["derive"] } log = "0.4" -tauri = { version = "2.4.0", features = [ "protocol-asset", "macos-private-api", - "test", +tauri = { version = "2.5.0", features = [ "protocol-asset", "macos-private-api", + "test" ] } tauri-plugin-log = "2.0.0-rc" tauri-plugin-shell = "2.2.0" diff --git a/src-tauri/src/core/setup.rs b/src-tauri/src/core/setup.rs index 8d8a3d557..42ee0faa5 100644 --- a/src-tauri/src/core/setup.rs +++ b/src-tauri/src/core/setup.rs @@ -277,7 +277,12 @@ pub fn setup_sidecar(app: &App) -> Result<(), String> { ]); #[cfg(target_os = "windows")] { - let resource_dir = app_handle_for_spawn.path().resource_dir().unwrap(); + let mut resource_dir = app_handle_for_spawn.path().resource_dir().unwrap(); + // If debug + #[cfg(debug_assertions)] + { + resource_dir = resource_dir.join("binaries"); + } let normalized_path = resource_dir.to_string_lossy().replace(r"\\?\", ""); let normalized_pathbuf = PathBuf::from(normalized_path); cmd = cmd.current_dir(normalized_pathbuf); @@ -286,12 +291,12 @@ pub fn setup_sidecar(app: &App) -> Result<(), String> { #[cfg(not(target_os = "windows"))] { cmd = cmd.env("LD_LIBRARY_PATH", { - let current_app_data_dir = app_handle_for_spawn - .path() - .resource_dir() - .unwrap() - .join("binaries"); - let dest = current_app_data_dir.to_str().unwrap(); + let mut resource_dir = app_handle_for_spawn.path().resource_dir().unwrap(); + #[cfg(not(debug_assertions))] + { + resource_dir = resource_dir.join("binaries"); + } + let dest = resource_dir.to_str().unwrap(); let ld_path_env = std::env::var("LD_LIBRARY_PATH").unwrap_or_default(); format!("{}{}{}", ld_path_env, ":", dest) }); diff --git a/tests-e2e-js/.gitignore b/tests-e2e-js/.gitignore new file mode 100644 index 000000000..1521c8b76 --- /dev/null +++ b/tests-e2e-js/.gitignore @@ -0,0 +1 @@ +dist diff --git a/tests-e2e-js/package.json b/tests-e2e-js/package.json new file mode 100644 index 000000000..e7dc18587 --- /dev/null +++ b/tests-e2e-js/package.json @@ -0,0 +1,23 @@ +{ + "name": "tests-e2-js", + "version": "0.0.0", + "private": true, + "type": "module", + "main": "src/main.ts", + "scripts": { + "build": "tsc", + "test": "node --test --test-force-exit --loader ts-node/esm ./src/main.ts" + }, + "dependencies": { + "@tauri-e2e/selenium": "0.2.2", + "log4js": "^6.9.1", + "selenium-webdriver": "^4.22.0", + "ts-node": "^10.9.2" + }, + "devDependencies": { + "@types/node": "^20.14.9", + "@types/selenium-webdriver": "^4.1.28", + "tsimp": "^2.0.11", + "typescript": "^5.5.2" + } +} diff --git a/tests-e2e-js/src/main.ts b/tests-e2e-js/src/main.ts new file mode 100644 index 000000000..c6e0aeba6 --- /dev/null +++ b/tests-e2e-js/src/main.ts @@ -0,0 +1,51 @@ +import assert from 'node:assert' +import { ChildProcess } from 'node:child_process' +import { afterEach, beforeEach, describe, test } from 'node:test' +import { By, until, WebDriver } from 'selenium-webdriver' +import * as e2e from '@tauri-e2e/selenium' +import { default as log4js } from 'log4js' + +let logger = log4js.getLogger() +logger.level = 'debug' + +process.env.TAURI_WEBDRIVER_LOGLEVEL = 'debug' +process.env.TAURI_WEBDRIVER_BINARY = await e2e.install.PlatformDriver() +process.env.TAURI_SELENIUM_BINARY = '../src-tauri/target/release/Jan.exe' +process.env.SELENIUM_REMOTE_URL = 'http://127.0.0.1:6655' + +//@ts-ignore fuck you javascript +e2e.setLogger(logger) + +describe('Tauri E2E tests', async () => { + let driver: WebDriver + let webDriver: ChildProcess + + beforeEach(async () => { + // Spawn WebDriver process. + webDriver = await e2e.launch.spawnWebDriver() + // wait 1 second + await new Promise((r) => setTimeout(r, 1000)) + // Create driver session. + driver = new e2e.selenium.Builder().build() + // Wait for the body element to be present + // await driver.wait(until.elementLocated({ css: 'body' })) + }) + + afterEach(async () => { + await e2e.selenium.cleanupSession(driver) + e2e.launch.killWebDriver(webDriver) + }) + + test('Find hub', async () => { + const hub = until.elementLocated(By.css('[data-test-id="menu-common:hub"')) + // console.log('GG', hub) + // @ts-ignore + await driver.wait(hub.fn, 120000) + + const menuElement = await driver.findElement({ + css: '[data-test-id="menu-common:hub"]', + }) + assert(menuElement !== null, 'Hub menu element should be available') + await menuElement.isDisplayed() + }) +}) diff --git a/tests-e2e-js/tsconfig.json b/tests-e2e-js/tsconfig.json new file mode 100644 index 000000000..6189f7d38 --- /dev/null +++ b/tests-e2e-js/tsconfig.json @@ -0,0 +1,21 @@ +{ + "compilerOptions": { + "outDir": "./dist", + "rootDir": "./src", + "target": "ESNext", + "module": "ESNext", + "moduleResolution": "Bundler", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "declaration": true, + "declarationMap": true + }, + "include": [ + "src/*.ts" + ], + "exclude": [ + "node_modules", + "dist" + ], +} diff --git a/web-app/src/containers/ChatInput.tsx b/web-app/src/containers/ChatInput.tsx index 2d16b2eee..0cecb2bf3 100644 --- a/web-app/src/containers/ChatInput.tsx +++ b/web-app/src/containers/ChatInput.tsx @@ -365,6 +365,7 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => { rows={1} maxRows={10} value={prompt} + data-test-id={'chat-input'} onChange={(e) => { setPrompt(e.target.value) // Count the number of newlines to estimate rows @@ -567,6 +568,7 @@ const ChatInput = ({ model, className, initialMessage }: ChatInputProps) => { variant={!prompt.trim() ? null : 'default'} size="icon" disabled={!prompt.trim()} + data-test-id="send-message-button" onClick={() => handleSendMesage(prompt)} > {streamingContent ? ( diff --git a/web-app/src/containers/LeftPanel.tsx b/web-app/src/containers/LeftPanel.tsx index 5d0b1542e..ea4fbafc2 100644 --- a/web-app/src/containers/LeftPanel.tsx +++ b/web-app/src/containers/LeftPanel.tsx @@ -324,6 +324,7 @@ const LeftPanel = () => { )} {isDownloaded ? ( - ) : (