Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

Merge pull request #5797 from menloresearch/test/deprecate-webdriver-test

Louis4699b07ca612
diff --git a/Makefile b/Makefile
index f14234842..b6e1a01b5 100644
--- a/Makefile
+++ b/Makefile
@@ -43,7 +43,9 @@ test: lint
yarn download:bin
yarn download:lib
yarn test
- yarn test:e2e
+# yarn build:icon
+# yarn copy:assets:tauri
+# cargo test --manifest-path src-tauri/Cargo.toml
# Builds and publishes the app
build-and-publish: install-and-build
diff --git a/package.json b/package.json
index 2bdaca4cc..6bdd97fa8 100644
--- a/package.json
+++ b/package.json
@@ -4,8 +4,7 @@
"workspaces": {
"packages": [
"core",
- "web-app",
- "tests-e2e-js"
+ "web-app"
]
},
"scripts": {
@@ -17,10 +16,6 @@
"test:ui": "vitest --ui",
"test:coverage": "vitest run --coverage",
"test:prepare": "yarn build:icon && 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": "yarn build:icon && yarn copy:assets:tauri && tauri dev",
"copy:assets:tauri": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\"",
diff --git a/tests-e2e-js/.gitignore b/tests-e2e-js/.gitignore
deleted file mode 100644
index 1521c8b76..000000000
--- a/tests-e2e-js/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-dist
diff --git a/tests-e2e-js/package.json b/tests-e2e-js/package.json
deleted file mode 100644
index e7dc18587..000000000
--- a/tests-e2e-js/package.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "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
deleted file mode 100644
index b75426c47..000000000
--- a/tests-e2e-js/src/main.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-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'
-
-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
deleted file mode 100644
index 6189f7d38..000000000
--- a/tests-e2e-js/tsconfig.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "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"
- ],
-}