Skip to content

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

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

Conversation

infomiho
Copy link
Contributor

@infomiho infomiho commented Jan 31, 2025

  • Adds headless tests for
    • 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

@infomiho infomiho force-pushed the miho-merge-todo-apps branch from e1ee1c0 to 4a9c181 Compare March 5, 2025 11:51
@infomiho infomiho changed the base branch from miho-merge-todo-apps to miho-wasp-app-runner March 5, 2025 12:07
@infomiho infomiho force-pushed the miho-example-apps-headless-tests branch from 3ea3f9d to 494a31d Compare March 5, 2025 12:57
@Martinsos
Copy link
Member

What are next steps here?

Copy link
Contributor

@sodic sodic left a 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/
Copy link
Contributor

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({
Copy link
Contributor

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',
Copy link
Contributor

Choose a reason for hiding this comment

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

What's happening here?

Copy link
Contributor

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(
Copy link
Contributor

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.

Copy link
Member

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?

Comment on lines +42 to +54
// 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();
});
Copy link
Contributor

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 :)

Copy link
Contributor

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.

@infomiho infomiho force-pushed the miho-wasp-app-runner branch from 119a4b4 to f7cb11b Compare April 4, 2025 14:49
Base automatically changed from miho-wasp-app-runner to main April 9, 2025 10:12
infomiho added 2 commits April 9, 2025 12:26
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
@infomiho infomiho force-pushed the miho-example-apps-headless-tests branch from f0e42a0 to a8ea42c Compare April 9, 2025 10:32
Signed-off-by: Mihovil Ilakovac <mihovil@ilakovac.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants