-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Adds headless tests for example apps #2478
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
base: main
Are you sure you want to change the base?
Conversation
e1ee1c0
to
4a9c181
Compare
3ea3f9d
to
494a31d
Compare
What are next steps 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.
Excellent work!
But I can't decide whether we should remove most of the tests. They're pretty repetitive and unlikely to fail if waspc/todoApp
works. Then again, we run them manually every time...
Another big repetition is the playwright config, so we should decide whether to do something about that too.
# Headless tests | ||
!.env.*.headless | ||
test-results/ |
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.
Hmm, I may have changed my mind on this grouping 😅
It makes sense to kepp all the headless stuff together. But netlify
should definitely be pushed up.
/** | ||
* See https://playwright.dev/docs/test-configuration. | ||
*/ | ||
export default defineConfig({ |
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.
Is this the same for all apps? Should we do something about it?
@@ -23,6 +23,7 @@ export const submitProject: SubmitProject<z.infer<typeof submitProjectInputSchem | |||
country, | |||
website, | |||
image, | |||
approved: process.env.HEADLESS_TESTING === 'true', |
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.
What's happening 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.
Since this app is supposed to test streaming, can we somehow write the test to check for that (not just the final content)?
await page.locator("button").click(); | ||
} | ||
|
||
export async function performLogin( |
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.
We could probably skip on testing the signup and the login in all apps. It's a lot of repetitive code that brings little benefit I'd say.
However, if and where we test for it (e.g., in waspc/todoApp
), we should also test for unsuccessful logins and signups.
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.
Jumping in a bit, but I see this is in helper.ts and I guess login is just needed to test the rest of the app, so probably no point in trying to do less of it?
// Fill input[name="description"] with random task | ||
await page.locator("input[name='description']").fill(randomTask); | ||
// Click input[type="submit"] to submit the form | ||
await page.locator("input[type='submit']").click(); | ||
// Expect to see the task on the page | ||
await expect(page.locator("body")).toContainText(randomTask); | ||
// Check the task as done input[type="checkbox"] | ||
await page.locator("input[type='checkbox']").click(); | ||
// Reload the page | ||
await page.reload(); | ||
// Expect the task to be checked | ||
await expect(page.locator("input[type='checkbox']")).toBeChecked(); | ||
}); |
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.
The comments are probably gpt leftovers, we can remove them :)
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.
For this one, we should probably test everything we tell them to do in the tutorial.
119a4b4
to
f7cb11b
Compare
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
f0e42a0
to
a8ea42c
Compare
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
examples/todo-typescript
(added in parent PR)examples/waspello
examples/waspleau
examples/hackathon-submissions
examples/thoughts
examples/websockets-realtime-voting
examples/streaming
examples/tutorials/TodoApp
examples/tutorials/TodoAppTs