Skip to content

refactor(alpinejs): Fix test execution and correct minor mistakes in test files#16484

Open
rururux wants to merge 7 commits intowithastro:mainfrom
rururux:alpinejs-test
Open

refactor(alpinejs): Fix test execution and correct minor mistakes in test files#16484
rururux wants to merge 7 commits intowithastro:mainfrom
rururux:alpinejs-test

Conversation

@rururux
Copy link
Copy Markdown
Member

@rururux rururux commented Apr 25, 2026

Changes

  • Renamed the existing test:e2e command to test:e2e:astro
  • Added a new test:e2e:alpinejs command
  • Updated test:e2e to run both test:e2e:astro and test:e2e:alpinejs
  • Added packages/integrations/alpinejs/playwright.config.js (because CI failed without this)
  • Fixed minor mistakes in test files
  • Change the test assertions to more stable ones

Previously, the test files for integrations/alpinejs were not being run correctly.
The reason is that the alpinejs integration only contains e2e tests, and those files are not picked up by the test:integrations command.
You can see this in the CI logs of an already-merged pull request, searching for "alpinejs" returns only one hit:
https://github.com/withastro/astro/actions/runs/24900093515/job/72915439313
alpine-test

To address this, I added a new test:e2e:alpinejs command that explicitly runs the tests for the alpinejs integration.
I also moved the contents of the existing test:e2e command into test:e2e:astro, and configured test:e2e to run both test:e2e:astro and test:e2e:alpinejs.

I also noticed that test-utils.ts file was still using .js as the file extension when detecting files, and another had an incorrect path to a test fixture, so I went ahead and corrected those as well.

Additionally, I updated the test assertions to use a more reliable approach, as the tests were occasionally showing as flaky in CI.

Testing

Green CI

Docs

N/A, This will not affect users

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 25, 2026

⚠️ No Changeset found

Latest commit: 4b39995

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-actions github-actions Bot added the pkg: integration Related to any renderer integration (scope) label Apr 25, 2026
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rururux rururux changed the title refactor(alpinejs): Fix test execution and remove unused code refactor(alpinejs): Fix test execution and correct minor mistakes in test files Apr 25, 2026
@rururux
Copy link
Copy Markdown
Member Author

rururux commented Apr 25, 2026

I noticed that running test:e2e:alpinejs in CI shows tests as flaky, so in commit 4b39995 I updated the assertion to make the tests pass more reliably.

before:
flaky

after:
fixed

@ocavue
Copy link
Copy Markdown
Contributor

ocavue commented Apr 27, 2026

It's weird that @astrojs/alpinejs uses a different test framework (playwright) compared to all other integrations like @astrojs/react and @astrojs/svelte (node:test).

Perhaps we should migrate @astrojs/alpinejs's tests from playwright to node:test, following the other integrations.

@rururux
Copy link
Copy Markdown
Member Author

rururux commented Apr 27, 2026

I believe this test is written to use Playwright because AlpineJS operates via CSR.

@rururux
Copy link
Copy Markdown
Member Author

rururux commented Apr 27, 2026

For example, while the test expects the text "bar" to be visible, the actual HTML source served to the client hasn't rendered "bar" yet at that point.

alpine

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pkg: integration Related to any renderer integration (scope)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants