-
-
Notifications
You must be signed in to change notification settings - Fork 574
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: 🎸 add end-to-end test harness #253
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
amazing!!!
I think is missing the document of how to run the e2e in CONTRIBUITION.md
file
give 💸 to this PR!
tests/e2e/e2e.spec.ts
Outdated
import { test, expect } from "@playwright/test"; | ||
|
||
test("Create an account", async ({ page }) => { | ||
await page.goto("http://localhost:3030/login"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move the URL to the playwright.config.ts
use.baseURL. https://playwright.dev/docs/test-configuration
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the base URL to the config file and updated the tests to use the relative paths.
tests/e2e/e2e.spec.ts
Outdated
}); | ||
|
||
test("Verify jobs from the test nextjs project", async ({ page }) => { | ||
await page.goto("http://localhost:3030"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the base URL to the config file and updated the tests to use the relative paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest use the Page Object Pattern for getting test more easy to maintain...
https://www.selenium.dev/documentation/test_practices/encouraged/page_object_models/
reporter: "html", | ||
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ | ||
use: { | ||
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
here is missing the baseURL
and readed from .env file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added the base URL to the config file and updated the tests to use the relative paths.
tests/utils.ts
Outdated
}, | ||
}); | ||
|
||
try { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove the try .. if the connection not success the test should be fail ... ASAP..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed the try/catch
This is amazing, great work! Just a few tweaks and it should be ready to merge 👍 |
Hey @ericallam, I've gone ahead and made the suggested changes. I've also updated the Also, I re-verifed the github actions based on the suggested changes in my forked repo which can be found here: https://github.com/SSHari/trigger.dev/actions/runs/5753854155/job/15597913604 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome @SSHari, merging now. Thanks!
PR to add an end-to-end test harness using Playwright.
Changes
sendMagicLinkEmail
function to auto redirect to the magic link URL in test mode (Trying to parse the logs for the magic URL seemed unnecessary. We may consider just defaulting to this behavior indevelopment
in general.)examples/nextjs-test/.env.example
are associated with the test data)Running Locally
To run the tests locally, the following section from the publish github action can be followed:
# Setup environment variables cp ./.env.example ./.env cp ./examples/nextjs-test/.env.example ./examples/nextjs-test/.env.local cp ./packages/database/.env.example ./packages/database/.env pnpm run docker pnpm run db:migrate pnpm run db:seed pnpm run test:e2e pnpm run docker:stop
Other
Since I can't verify the github action works until we merge this change into the main branch, I created a dummy github action with the same steps below that's triggered when my branch is updated. The results of that github action can be found here: https://github.com/SSHari/trigger.dev/actions/runs/5745732725/job/15574162405. One thing to note is that I couldn't run my test github action on the
buildjet-4vcpu-ubuntu-2204
runner, so I used theubuntu-22.04
instead.Bounty: /claim #202