Add TS tests tooling#661
Conversation
|
Hey @fpliger you think using |
|
@marimeireles they are different tools for different purposes. We should keep using playwright for driving tests on example for instance, but for unit tests and some integration tests I think |
It seems that you can use Playwright for writing unit tests but that you may be using it in a way that is not exactly as intended. This is something that could be experimented with though. Jest is a very common javascript testing library and will be well known by contributors. |
|
Hum, we're currently using it to write unit tests on the Python side. Do you have opinions on that @antocuni ? |
|
@marimeireles we are not using
Makes sense? |
| @@ -1,93 +1,501 @@ | |||
| { | |||
| "name": "pyscript", | |||
| "version": "0.0.1", | |||
| "lockfileVersion": 2, | |||
| "lockfileVersion": 1, | |||
There was a problem hiding this comment.
Hi, IMHO you should update your npm.
https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#lockfileversion
There was a problem hiding this comment.
+1. If you have nvm (Node Version Manager) installed, you might be using something like Node v14 which uses an older version of NPM. Try nvm use v16 to switch version for the terminal session, or nvm alias default v16 to set it as your default Node version
|
It's funny, I was actually reading about the differences between Cypress, Selenium, and Playwright this week. I'm super impressed with Playwright. Seems to be the new up-and-coming player in the e2e testing world. I totally agree with your last comment @fpliger. Playwright would be a perfect tool for e2e tests, especially since it supports JS and Python by default. Love that it can also run in multiple browsers. And for TS unit testing, Jest is perfect. It's basically the new standard at this point. @marimeireles just to give a bit more color on unit tests vs e2e tests. In a nutshell, e2e tests are more for browser-based DOM testing. For example, an e2e test can assert that when you click a button a modal should pop up on the screen. JS/TS unit tests, on the other hand, are more for asserting pieces of code are working properly. For example, if I have |
) This PR is about integration tests: they use playwright to load HTML pages in the browser and check that PyScript works as intended, as opposed to unit tests like the ones being introduced by #665 and #661. The main goal of this PR is to introduce some machinery to make such tests easier to write, read and maintain, with some attention to capture enough information to produce useful error messages in case they fail in the CI. In order to use the machinery, you need to subclass tests.support.PyScriptTest, which provides several useful API calls in the form self.xxx(). See the full description here: #663 Co-authored-by: Mariana Meireles <marian.meireles@gmail.com> Co-authored-by: mariana <marianameireles@protonmail.com>
alexm-aceable
left a comment
There was a problem hiding this comment.
Looks good! I'm digging these Makefile targets.
No description provided.