Yeah, I've had a ton, I'm not going to talk about them though, because it's in the past. It's in the past. At the same time, right, it's no blame as well, because like, of course not, yeah. I review everybody else's code, and everybody else reviews my code, and if something goes in that causes a bug, it's all of our fault, not just the one who wrote the code, so.
Yeah, for sure. We got a couple more questions from the audience already. So Lee asks, do you always mock APIs when running integration tests and only call the actual API in end-to-ends outside your CI flow? For my team, that is true, yeah. But mocking in this case, we use a tool called PolyJS, so it basically just calls your actual APIs and then stores the response on your end. So that is to just reduce the risk that the API changes while the front-end doesn't as you develop. It's not really a guarantee after you deploy, but at least as you develop, you would notice those differences.
Do you usually write any tests to check for backwards compatibility of your front-end to the back-end? No, because versioning of APIs takes care of that, usually. We've not run into any problems with that so far.
Nice. Floros asks, can you implement visual regression without having the components in Storybook? Absolutely. We actually in the beginning didn't really have Storybook. We just built our own little page where we demonstrated components, which is what Storybook does. It was a lot less pretty. It didn't have an API or anything, but it works, and even if you just give it life URLs if you don't have a login or something, as long as you have a tool that can take screenshots and you give it some URLs, you can do visual regression testing.
That's awesome. I think there are some tools that you recommended in your talk, right? Yes. Persi, I know, does it. Loki, StoryShots, I think, is another one. Or, I think Backstop.js is a tool that you can use for comparing the screenshots, and then you can just use Puppeteer or Cypress or any of the end-to-end test framework for taking screenshots of your website. Awesome. Gaddi asks, how do you make sure you don't repeat the same tests with unit integration, end-to-end, etc.? Huh. And has that ever happened to you? I don't think so. Like, maybe? I've never come, it's never been a problem at least. We do sometimes, you know, copy and paste around a little bit, but even there, like, because tests are also code, we try to keep it dry at least a little bit. So to not run into that problem, we would try to actually extract some of the tests into some utility function or something, and then your test becomes readable again. You avoid, you know, copying the same code around several times.
Comments