Skip to content

test: refactor e2e foldersΒ #99

@BioPhoton

Description

@BioPhoton

Motivation

Maintaining standardized targets across all projects in this repository is essential for consistency and quality. Currently, the apps folder does not fully align with the high standards established in packages.

By bringing apps up to the same standards, we can lock in a stable, maintainable state and introduce more automation to ensure these standards remain high. This benefits all maintainers and contributors by reducing technical debt and improving overall project health.

Problem

  • docs, e2e fixtures and e2e test projects are all in one folder apps
  • css and scss apps are duplicates besides the rsbuild.config.ts and rspack.config.ts file

Suggested Solution

To achieve this, we define a set of must-have targets and ensure the repository is standardised and they are passin:

  • build - Using ng-rspack executor
  • lint - Using @nx/eslint executor
  • e2e - Using @nx/playwright executor
  • integration - Using @nx/vitest executor

Implementation Details

πŸ“Œ Legend:

  • πŸ“¦ RsPack
  • πŸ¦€ RsBuild
  • 🎭 Playwright (e2e testing)
  • πŸ“‹ ESLint
  • πŸ§ͺ Vitest (integration testing)

Current Tree

The current structure has deeply nested directories within apps, making it difficult to maintain consistency across configurations for rsbuild, rspack, eslint, and playwright targets. Each subdirectory contains its own isolated configuration files, leading to duplication and scattered resources.

root
┣━ πŸ“‚ apps 
┇  ┣━ πŸ“‚ docs 
   ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┣━ πŸ§ͺ vitest.config.ts
   ┃  ┗━ πŸ¦€ rsbuild.config.ts
   ┣━ πŸ“‚ rsbuild 
   ┃  ┣━ πŸ“‚ csr
   ┃  ┃  ┣━ πŸ“‚ css 
   ┃  ┃  ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┃  ┃  ┣━ πŸ§ͺ vitest.config.ts
   ┃  ┃  ┃  ┗━ πŸ¦€ rsbuild.config.ts
   ┃  ┃  ┣━ πŸ“‚ css-e2e 
   ┃  ┃  ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┃  ┃  ┗━ 🎭  playwright.config.ts
   ┃  ┃  ┣━ πŸ“‚ scss 
   ┃  ┃  ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┃  ┃  ┣━ πŸ§ͺ vitest.config.ts
   ┃  ┃  ┃  ┗━ πŸ¦€ rsbuild.config.ts
   ┃  ┃  ┗━ πŸ“‚ scss-e2e 
   ┃  ┃     ┣━ πŸ“‹ eslint.config.ts
   ┃  ┃     ┗━ 🎭  playwright.config.ts
   ┃  ┗━ πŸ“‚ ssr
   ┃     ┣━ πŸ“‚ css 
   ┃     ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃     ┃  ┣━ πŸ§ͺ vitest.config.ts
   ┃     ┃  ┗━ πŸ¦€ rsbuild.config.ts
   ┃     ┗━ πŸ“‚ css-e2e 
   ┃          ┣━ πŸ“‹ eslint.config.ts
   ┃          ┗━ 🎭  playwright.config.ts
   ┗━ πŸ“‚ rspack 
      ┣━ πŸ“‚ csr
      ┃  ┗━ πŸ“‚ css 
      ┃     ┣━ πŸ“‹ eslint.config.ts
      ┃     ┣━ πŸ§ͺ vitest.config.ts
      ┃     ┗━ πŸ“¦ rspack.config.js
      ┗━ πŸ“‚ ssr
         ┗━ πŸ“‚ css 
            ┣━ πŸ“‹ eslint.config.ts
            ┣━ πŸ§ͺ vitest.config.ts
            ┗━ πŸ“¦ rspack.config.js

Target Tree

The new structure separated documentation from testing and centralizes configurations into e2e for all end-to-end testing setups. This reorganization reduces redundancy, and maintenance.

The following things are suggsted:

  • align all πŸ¦€ and πŸ“¦ files to have .ts extension
  • move e2e related code into e2e folder
  • for each e2e project
    • maintain test applications inside e2e/fixtures and reuse it across the e2e test projects
    • maintain πŸ¦€ and πŸ“¦ files inside e2e/<project>/fixtures e.g. e2e/rsbuild-csr-css-e2e/fixtures
    • autogenerate the final test setup under tmp and use it in playwright.config.ts
      • copy e2e/fixtures/css under tmp/e2e/<project>
      • copy e2e/rsbuild-csr-css-e2e/fixtures under tmp/e2e/<project>
      • generate package.json under tmp/e2e/<project>/package.json
root
┣━ πŸ“‚ apps 
┃  ┗━ πŸ“‚ docs 
┃     ┣━ πŸ“‹ eslint.config.ts
┃     ┣━ πŸ§ͺ vitest.config.ts
┃     ┗━ πŸ¦€ rsbuild.config.ts
┣━ πŸ“‚ e2e 
┇  ┣━ πŸ“‚ fixtures
   ┃  ┣━ πŸ“‚ css 
   ┃  ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┃  ┗━ πŸ§ͺ vitest.config.ts
   ┃  ┗━ πŸ“‚ scss 
   ┃       ┣━ πŸ“‹ eslint.config.ts
   ┃       ┗━ πŸ§ͺ vitest.config.ts
   ┣━ πŸ“‚ rsbuild-csr-css-e2e 
   ┃  ┣━ πŸ“‚ fixtures
   ┃  ┃  ┗━ πŸ¦€ rsbuild.config.ts
   ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┗━ 🎭  playwright.config.ts
   ┣━ πŸ“‚ rsbuild-csr-css-e2e 
   ┃  ┣━ πŸ“‚ fixtures
   ┃  ┃  ┗━ πŸ¦€ rsbuild.config.ts
   ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┗━ 🎭  playwright.config.ts
   ┣━ πŸ“‚ rspack-csr-css-e2e 
   ┃  ┣━ πŸ“‚ fixtures
   ┃  ┃  ┗━ πŸ“¦ rspack.config.ts
   ┃  ┣━ πŸ“‹ eslint.config.ts
   ┃  ┗━ 🎭  playwright.config.ts
   ┗━ πŸ“‚ rspack-csr-css-e2e 
      ┣━ πŸ“‚ fixtures
      ┃  ┗━ πŸ“¦ rspack.config.ts
      ┣━ πŸ“‹ eslint.config.ts
      ┗━ 🎭  playwright.config.ts

Todos:

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions