I have been admiring the console codebase and real...
# general
j
I have been admiring the console codebase and really impressed with the architecture. One thing that did catch my eye are there are no tests? Is this an intentional?
t
hey don't embarrass us like that 😄
we cranked out that whole console in a month so we accrued some debt in some places, testing being one of them
j
thats also totally fair! Was just wondering!
t
my goto currently is cypress for frontend testing but I haven't done a refresher on what new options there are
j
also made me wonder, does it actually need tests
t
I'm pretty minimal on tests as I try to let type systems force me into correct code but I like to mix in cypress tests to make sure certain flows work - also helpful in development
j
yeah, its very strongly typed which is how i ended up looking through it from trpc. I totally agree with having tests to valid flows rather than capture every case.
With cypress, do you tend to do e2e or integration style testing?
t
we're getting together some good testing examples but I typically write primarily tests around by API. So basically making API calls then checking to see if the right data got written, if the right events were emitted, etc
The testing section of this article is more or less what I do: https://journal.plain.com/posts/2022-02-08-a-magical-aws-serverless-developer-experience/
a
@Jono Allen what do you admire of the console?
r
I'm a big fan of playwright for these sort of hybrid integration/e2e tests now, especially since their runner added API support. Much lighter and more robust than cypress imho
s
@thdxr I am a huge Cypress fan myself. Recently got into Playwright though. Def drop it into your consideration bucket.
And just seen @Richard Simpson replied the same. 😅 +1
d
Looking at playwright's docs, it does look like they have a solution for both api and ui testing. Last I checked, api testing with Cypress was still fresh.
r
It's worth noting that Playwright's is pretty fresh too but playwright is operating under looser and easier to implement constraints (they just use DevTools Protocol w/ patches vs Cypress's very tight chrome/electron integration)
s
I read the Plain article about focusing more on integration testing over unit testing when testing AWS services, which makes a lot of sense. I’m still not sure of the best approach of how to setup/teardown the test environment, though (especially locally vs on CI). Any thoughts there? They have a code snippet for a single test. Does this test assume that the test environment is permanently available? Does it run
sst start
at the beginning and then run tests? I’d love any advice on how to setup the environment if I want to use this sort of integration test heavy approach.
t
we're going to be focusing on testing next month to provide guidance for all of this
but for CI I do
sst deploy
then run my tests (which mostly do calls to the api)
s
perfect, that’s enough to get me started. thanks!