mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-09 15:17:59 -05:00
refactor(frontend): e2e tests setup + speed + readability (#10388)
## Changes 🏗️ ### User creation tests Now, all tests use the users created via the platform signup in `global-setup.ts`. Their login details are on a `.auth/user-pool.json` file. I have the delete the logic that created tests users via Supabase directly. ### Build tests speed I have refactored the builder tests, so that, instead of adding 100s of blocks under a given test user session, a new test user logins and adds block for each letter: ``` Test user 1 - logins and adds blocks starting with "a" Test user 2 - logins and adds blocks starting with "b" ``` Given that we know the builder becomes slow once we have 30 or more blocks, in this way a test user never adds more than 10 blocks on a given test ( _without losing coverage_ ), so we don't need time-outs or artificially waiting due to the UI being slow. ### Readability test changes Refactor existing tests, using short-hand utilities, to be: - easier to write - clearer to read - easier to debug ```ts // Selectors getId("id") // --> page.getByTestId("id") getText("foo") // --> page.getByText("id") getButton("Run") // --> page.getByRole("button", {name: "Run"} ... // Assetions const btn = getButton("Save") isVisible(btn) // --> expect(btn).toBeVisible() ``` These utilities live under `selectors.ts` and `assertions.ts`. Their usage is optional but encouraged. ## Checklist 📋 ### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Refactored tests code looks good - [x] E2E tests are 🟢 on the CI ### For configuration changes: No config changes
This commit is contained in:
10
.github/workflows/platform-frontend-ci.yml
vendored
10
.github/workflows/platform-frontend-ci.yml
vendored
@@ -155,8 +155,6 @@ jobs:
|
||||
needs: setup
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
browser: [chromium, webkit]
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
@@ -208,13 +206,11 @@ jobs:
|
||||
run: pnpm build --turbo
|
||||
# uses Turbopack, much faster and safe enough for a test pipeline
|
||||
|
||||
- name: Install Browser '${{ matrix.browser }}'
|
||||
run: pnpm playwright install --with-deps ${{ matrix.browser }}
|
||||
- name: Install Browser 'chromium'
|
||||
run: pnpm playwright install --with-deps chromium
|
||||
|
||||
- name: Run Playwright tests
|
||||
run: pnpm test:no-build --project=${{ matrix.browser }}
|
||||
env:
|
||||
BROWSER_TYPE: ${{ matrix.browser }}
|
||||
run: pnpm test:no-build
|
||||
|
||||
- name: Print Final Docker Compose logs
|
||||
if: always()
|
||||
|
||||
Reference in New Issue
Block a user