Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: allow to run e2e tests against existing server #803

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

tobiasdiez
Copy link

@tobiasdiez tobiasdiez commented Mar 28, 2024

Allow to pass the url of an already running server to setup and use this as the target instead of building and running a new server. This has two use cases:

  1. Run tests against a deployment of your application (i.e. "real" end-to-end tests)
  2. During local development, run tests against a already running dev server. This reduces the time to run tests and was wished for in eg The "setup" in the tests is very slow for every rerun #314 (comment).

Usage:

setup({ endpoint: process.env.TEST_URL })

(or of course just using a hard-coded url)

@danielroe danielroe added the enhancement New feature or request label Mar 29, 2024 — with Volta.net
@tobiasdiez
Copy link
Author

@danielroe friendly ping. Is there anything a can improve in this PR?

@danielroe
Copy link
Member

danielroe commented Apr 15, 2024

I love this and would like to get this or something like it merged, but just want to make sure we do it in the best way. Will review soon.

@dosubot dosubot bot added the size:M This PR changes 30-99 lines, ignoring generated files. label Apr 24, 2024
@danielroe
Copy link
Member

@tobiasdiez Is the only use-case here avoiding restarting/rebuilding the server when running tests? (ie. if we can solve that issue, do you still think this is a needed feature?)

@tobiasdiez
Copy link
Author

My use cases are:

  • Run the same tests against a deployed instance. So for each PR, I build the app, deploy it to an temporary sandbox that is close to the actual production deployment (in my case, Azure Functions). Then I would like to run all the e2e tests against that deployed instance to check that the PR is not breaking anything. This setup is essential for me since every other nuxt update (or to a minor extend other dependency changes) breaks the deployment in some way while passing all tests locally (i.e. the issues are specific to azure). I'm currently using supertest for this (see eg https://github.com/JabRef/JabRefOnline/blob/main/server/e2e.test.ts and https://github.com/JabRef/JabRefOnline/blob/main/.github/workflows/deploy-preview.yml), but it would be nice to migrate to test-utils.
  • And indeed, if you already run nuxi dev to start a dev server, make some changes, and then want to verify that your changes are not breaking anything, it would be nice if the already running dev server is used as the endpoint for the tests instead of spinning up a new dev server.

Personally, the first use case is actually more important for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants