e2e-auto-test:基于 Go 与 Playwright 的端到端自动化测试项目

用户可快速开展性能与集成测试。该项目基于 pytest 构建测试用例,使用 Playwright 模拟前端操作,通过 kubernetes-client python 管理后端资源,支持网络与资源监控及测试结果结构化输出。【此简介由AI生成】

Branch1Tags0
FilesLast commitLast update
1 year ago
5 months ago
5 months ago
6 months ago
5 months ago
1 year ago
5 months ago
5 months ago

e2e-auto-test

Repository Overview

This repository consolidates the end-to-end and automated testing capabilities for openFuyao, primarily including:

  • e2e/: Backend / cluster-side tests built on Go, Ginkgo v2, Gomega, and Kubernetes client-go (covering installation, console API, online-offline colocation, NUMA, InferNex, multi-cluster, system-level integration, etc.).
  • e2e-frontend/: UI automation tests for the management plane and guided installation interface, built on Playwright with TypeScript / JavaScript.

Repository SIG: sig-qa

Project Structure

e2e-auto-test/
├── e2e/                      # Go: Ginkgo tests & framework (k8s, helm, executor, env, etc.)
├── e2e-frontend/             # Playwright: frontend test cases & playwright.config.ts
├── docs/                     # Development notes (e.g., pytest/Playwright concepts & historical integration test guides)
├── .gitignore
├── LICENSE
└── README-en.md

e2e/ (Go)

Covers feature-level backend integration tests and system-level integration tests for openFuyao, written in Golang + Ginkgo. Tests are organized into directories by feature, with shared capabilities provided in framework/ (e.g., framework/env for resolving and loading e2e/.env from the repository root).

Sample Directory Structure

e2e/
├── framework/                # Shared test framework (k8s control, env management, utilities, etc.)
├── colocation/               # Online-offline colocation test cases
|   ├── system-integration/       # Colocation system-level integration tests
├── numa-affinity/            # NUMA affinity test cases
|   ├── system-integration/       # NUMA affinity system-level integration tests
├── ...
├── .env.template             # Environment variable template
├── go.mod
├── go.sum
└── README-en.md

Notes:

  • Each feature directory (e.g., colocation/, numa-affinity/, etc.) typically contains a _suite_test.go test entry file and _test test case files. The former includes setup and teardown operations for the current feature's tests, while the latter provides the code implementation for all test cases. Utility functions and resource template files are also provided.
  • Some feature directories include a standalone system-integration subdirectory for system-level integration test cases specific to that feature.
  • framework/ provides a unified K8s client, Helm management, environment variable loading, and common utilities for all test cases, avoiding redundant development.
  • Each feature directory includes a README-en.md with configuration details and test case onboarding guidelines for that feature.

For more detailed directory structure, test case design, and environment variable descriptions, refer to the README-en.md or comments within each feature subdirectory.

e2e-frontend/ (Playwright)

Covers feature-level frontend integration tests for openFuyao, implemented in JavaScript/TypeScript + Playwright. Tests are organized into directories by feature and managed via testMatch / projects in playwright.config.ts.

Sample Directory Structure

e2e-frontend/
├── auth/                    # Authentication, authorization & RBAC tests
├── colocation/              # Online-offline colocation tests
|   ├── test-xxx.spec.ts
|   ├── colocation.setup.ts       # Colocation setup
|   └── colocation.setup.ts       # Colocation teardown
├── ...
├── utils/                   # Cross-module shared utility functions
├── global.setup.ts          # Global setup
├── global.teardown.ts       # Global teardown
├── .env.test.template       # Environment variable template (copy to .env.test)
├── playwright.config.ts     # Playwright & projects configuration
├── package.json
└── tsconfig.json
  • Test cases under each feature directory should be named with .spec.ts or .spec.js to align with the testMatch patterns in playwright.config.ts.
  • utils/ contains cross-feature reusable TypeScript utilities; individual feature directories may also include their own utils/, constants.ts, etc.
  • Copy .env.test.template to .env.test and fill in values as needed. For specific fields and submodule instructions, see e2e-frontend/README-en.md.

Running Tests

e2e (Go / Ginkgo)

  1. Install Ginkgo.

    go install github.com/onsi/ginkgo/v2/ginkgo@latest
    

    Alternatively, refer to the Ginkgo installation guide.

  2. Environment variables: Copy e2e/.env.template to e2e/.env and fill in values according to the template and each feature's README-en (framework/env loads the specified file from the e2e root directory, e.g., .env).

  3. Dependencies:

    cd e2e
    go mod download
    
  4. Execution examples (from the e2e directory):

    # Example: Run all Ginkgo Suites under the colocation package
    go test ./colocation -v
    
    # Example: Run a specific subdirectory only
    go test ./numa-affinity -v
    

    If the Ginkgo CLI is installed, you can also use the ginkgo command to filter test cases. For example:

    # Example: Run all suites under the colocation package
    ginkgo -v ./colocation
    
    # Example: Run only test cases with "MyTest" in the title
    ginkgo -v --focus="MyTest" ./colocation
    
    # Example: Skip system-level integration tests under colocation
    ginkgo -v --skip-package="system-integration" ./colocation
    

e2e-frontend (Playwright)

  1. Navigate to the directory and install dependencies and browsers (Chromium by default):

    cd e2e-frontend
    npm install
    npx playwright install chromium
    
  2. Copy e2e-frontend/.env.test.template to e2e-frontend/.env.test and fill in values according to the comments and e2e-frontend/README-en.md (configuration is loaded via dotenv in playwright.config.ts).

  3. Run:

    npm run test        # Run all matching test cases from the command line
    npm run test:ui     # UI mode
    

    For VS Code, install the Playwright Test for VSCode extension to run and debug tests graphically. See e2e-frontend/README-en.md for details.

Introduction

用户可快速开展性能与集成测试。该项目基于 pytest 构建测试用例,使用 Playwright 模拟前端操作,通过 kubernetes-client python 管理后端资源,支持网络与资源监控及测试结果结构化输出。【此简介由AI生成】

Customize your domain