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

add test to confirm that playground page still works #356

Open
Trott opened this issue Oct 2, 2022 · 9 comments
Open

add test to confirm that playground page still works #356

Trott opened this issue Oct 2, 2022 · 9 comments

Comments

@Trott
Copy link
Owner

Trott commented Oct 2, 2022

No description provided.

@screensaversclub
Copy link
Contributor

If this is still relevant, could you provide some detail to this? For example, are you thinking about starting a headless browser instance that tries to load up the playground page, or some sort of e2e testing?

Would love to work on this too.

@Trott
Copy link
Owner Author

Trott commented May 7, 2024

For example, are you thinking about starting a headless browser instance that tries to load up the playground page, or some sort of e2e testing?

Something like that. Since the playground can be loaded with a file:// URL, we wouldn't even need to fire up a web server. We just need a browser to open the page, enter one or two things into the form, and make sure the results are correct.

@Trott
Copy link
Owner Author

Trott commented May 7, 2024

I'm not sure if this could be added to the karma tests or not, but also karma is deprecated, so maybe doing something else makes sense.

@screensaversclub
Copy link
Contributor

Sounds fun. What are your thoughts on moving the whole test suite to something like Jest?

@Trott
Copy link
Owner Author

Trott commented May 8, 2024

jest doesn't do browser testing, at least not by default. You can't use jest to test a web page. We have testing in mocha and I'm not inclined to migrate to jest without a very good reason.

karma launches headless browsers and tests things in browsers. Since slug works both in Node.js and the browser (and since we want to test the playground), I've used karma to test the browser functionality.

@screensaversclub
Copy link
Contributor

Thanks for the clarification. So specifically we're looking to keep mocha and looking for an e2e testing solution to replace karma, which is getting deprecated.

Do you have any libraries off the top of your head that would be a good starting point to investigate a suitable replacement? Hoping to get as much context from you as possible before I go off trying something else which might miss the mark 😄

@Trott
Copy link
Owner Author

Trott commented May 8, 2024

I haven't looked at it so I can't guarantee it is the way to go, but it seems like Web Test Runner is sorta kinda the new de facto default tool people use. https://modern-web.dev/docs/test-runner/overview/

@Trott
Copy link
Owner Author

Trott commented May 8, 2024

Also note that this is kind of a gnarly task because we have to get coverage stats and merge them with the Node.js test coverage stats. You can see how this is done in our package.json test command and in .karma.config.js. It's not the most difficult thing in the world, but it's also a bit of a headache to figure out. Just want to warn you upfront about that complication.

@screensaversclub
Copy link
Contributor

thanks for the heads up. I'm treating this as something to learn so let's see. I'll start from Web Test Runner.

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

No branches or pull requests

2 participants