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

test: deprecate webdriver test in favor of auto qa using CUA
This commit is contained in:
Louis 2025-07-17 21:28:12 +07:00 committed by GitHub
parent b736d09168
commit 4699b07ca6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 4 additions and 102 deletions

View File

@ -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

View File

@ -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/\"",

View File

@ -1 +0,0 @@
dist

View File

@ -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"
}
}

View File

@ -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()
})
})

View File

@ -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"
],
}