Files
puter/tests/ci/vitest.py
Xiaochen Cui c93a53ead2 ci: init e2e test for browser env, tidy other tests (#1796)
* ci: init e2e test for browser env

stash changes

* test: update fsentry definition, add tests

stash changes

* test: pass puter-js mkdir test

* test: add test for puter-js move

* tidy code

* tidy code

* doc: add docs for playwright test

* recover memoryfs

* test: puter-js readdir/stat

* test: puter-js write

* test: puter-js read

* test: puter-js move_cart

* test: fix failed tests on move

* tests: rename files

* test: puter-js copy_cart

* tests: puter-js batch/delete, read config from file

* ci: add vitest

* ci: update names and timeout

* ci: simplify playwright-test

* ci: simplify api-test

* move "api-tester" from tools to tests

* test: update example config

* test: remove folder tests/api-tester/ci

* test: unify config location

* test: remove unused files

* ci: fix wrong config

* ci: fix wrong path

* test: add docs

* ci: update timeout, print artifact url
2025-10-28 16:35:37 -07:00

54 lines
1.7 KiB
Python
Executable File

#! /usr/bin/env python3
import time
import cxc_toolkit
import common
def run():
# =========================================================================
# clean ports
# =========================================================================
# clean port 4100 for backend server
cxc_toolkit.exec.run_command("fuser -k 4100/tcp", ignore_failure=True)
# clean port 50052 for fs-tree-manager server
cxc_toolkit.exec.run_command("fuser -k 50052/tcp", ignore_failure=True)
# =========================================================================
# config server
# =========================================================================
cxc_toolkit.exec.run_command("npm install")
common.init_backend_config()
admin_password = common.get_admin_password()
# =========================================================================
# start backend server
# =========================================================================
cxc_toolkit.exec.run_background(
"npm start", work_dir=common.PUTER_ROOT, log_path="/tmp/backend.log"
)
# wait 10s for the server to start
time.sleep(10)
# =========================================================================
# config client
# =========================================================================
token = common.get_token(admin_password)
common.init_client_config(token)
# =========================================================================
# run the test
# =========================================================================
cxc_toolkit.exec.run_command(
"npm run test:puterjs-api",
work_dir=common.PUTER_ROOT,
)
if __name__ == "__main__":
run()