I'm trying to get a setup where I can run e2e tests in Github CI against a preview environment. Here's what I have:
- name: Build with Convex deploy
run: pnpm convex deploy
--cmd "pnpm run build"
--cmd-url-env-var-name VITE_PUBLIC_CONVEX_URL
--preview-name "e2e-${{ github.ref_name }}"
env:
CONVEX_DEPLOY_KEY: ${{ secrets.CONVEX_DEPLOY_KEY }}
- name: Run Playwright tests
run: pnpm run e2e
env:
CLERK_PUBLISHABLE_KEY: ${{ secrets.CLERK_PUBLISHABLE_KEY }}
CLERK_SECRET_KEY: ${{ secrets.CLERK_SECRET_KEY }}
I want my tests to run seed functions before they go, e.g.
test.beforeAll(async ({ page }) => {
await execa("pnpm", ["convex", "run", "seed:characters"], {
stdio: "inherit",
})
})
test("navigating characters", async ({ page }) => {
// etc
})
this doesn't work in CI because the tests are ran outside the convex deploy context and don't have the CONVEX_DEPLOYMENT environment variable
I can --preview-run seed:characters, but I want to be able to run specific functions for specific tests to replicate certain setup scenarios without the test going through the UI to do so
so my question is: how can I pass the info from convex deploy such that I can run functions during the tests?
