Podcast audio transcript

DrupalEasy Podcast S15E4 - Jordan Powell - Cypress - Javascript-based testing framework

Audio transcript

[0:00] Music.

[0:07] Welcome back to the drupal podcast. This is season 15 episode number four and my name is Mike Anello. 
In today's episode, we will be talking with Jordan Powell about Cyprus. 
Jordan works for Cypress dot IO. One of the main forces behind the Cyprus open source project. 
We'll be covering the basics of Cyprus and why it is a really good option for end to end testing of drupal sites. 
Now, before we get to my interview with Jordan, let me tell you a little bit about drupal easy's long form training courses.

[0:40] If you are a regular listener of the podcast, then you've probably heard of our long form beginner focus drupal training course, drupal career online. 
This course is designed to lay a rock solid foundation for becoming a professional drupal developer and it gets our students access to the drupal easy learning community. 
Among the benefits of that are access to our weekly office hours, community mentors, as well as our curriculum updates. 
Drupal career online meets twice a week for 12 weeks, starting August 28th to learn more. 
Just go to drupal easy dot com slash DC O.

[1:19] Now our newest long form drupal training course is called professional module development. 
This also gets you access to the drupal easy learning community and it includes 15 weeks of module development training. 
Now, that's twice a week of best practice focus training uh where we cover services, dependency injection, PHP unit, various drupal API S and tooling like P HPC, SPHP, Stan and debug. 
Along the way, we also dive deep into cashing and we create some custom drush commands. 
We have received some really great feedback from folks who have already completed the course. 
Here is a quote from one of those folks a fantastic course covering some really advanced stuff if you understand the principles of drupal, but want to move forward to deal with advanced development topics. 
This is a good place to start if you're interested. 
The full version begins August 8th and the light version of the course begins August 22nd. 
You can learn all about the two versions and more at drupal easy dot com slash P MD.

[2:33] Welcome to the drupal Easy podcast, Jordan Powell. How are you? 
I'm doing great. How are you pretty good? Uh We are just meeting for the first time. 
We've been chatting for a few minutes before uh starting the recording. 
This is kind of a new, I don't want to say it's a new type of episode for us, but it's pretty rare that we have someone on the podcast that A I haven't met previously and B is pretty much just outside of the drupal community.

[3:01] So, yeah. Well, thank you. 
It, I was thinking, I, I used to work in drupal uh boy 2010. 
Like this is a, you know, for now, it doesn't seem like that long ago. 
But now I'm like, wow, that's like 13 i years ago or something. 
But I used to work in drupal quite a bit and, and PHP and wordpress that did a lot of like small, like local business agency type work. 
And uh so I'm, I would say I'm, I wouldn't say I'm definitely embedded in the drupal community, but I can definitely appreciate many parts of it because I used to do it and bringing back a lot of old memories, that's for sure. 
So I'm glad to be here. Fantastic.

[3:42] Well, we're actually not gonna talk about a whole lot of drupal today. 
We're gonna talk about, you know, something you're very familiar with as you are an engineer at Cyprus, and we're gonna be talking about the Cyprus open source project and, and basically end to end testing with Cyprus today. 
As you know, I was telling you before we started, there are some folks in the drupal community that are using Cyprus, I wouldn't say it's anywhere close to a majority of the folks, but the folks that I know that use Cyprus just, they love it. They're really into it. 
And I started, I, I've, I've seen a couple of sessions within the drupal community about Cyprus and I've looked at some of the, the tutorial videos and it looks really, really cool and I just kind of wanted to get someone from Cyprus or Cyprus expert to come and just kind of introduce the topic to the drupal community. 
So, so that's why you're here. So, you know, I gave it a really short description there, but why don't you, in your words? Tell them what is Cyprus.

[4:43] So, yeah, great question. So Cyprus essentially tried to take something that was really difficult to do and make it but important being into in testing. 
So basically testing as similar to how users actually use your applications as possible. 
You know, historically, it's been really a painful thing to do. 
You know, we've used tools like selenium in the past or things like that. 
And many of us are familiar with the like testing triangle where we have like a lot of unit tests at the bottom and then at the very top, we have like in into and tests because traditionally, they were really painful to write. But Cyprus kind of like.

[5:24] Basically was created to essentially almost like flip that, that paradigm where N two and test could not only be less painful to write, but maybe even like fun to write and actually like really easy and reliable and, and uh that sort of thing. 
So that's sort of the problem it set out to face. 
I think this was, I think the very first like beta release was 2015. 
So it's been, it's been around for quite a while and we just surpassed like 5 million downloads a week on M PM. 
So it's been, uh it's wild to think how far, you know, the, the tool and the community has come. 
But yeah, it's, it's also really wild to work on a tool that is like used by so many people. 
And yeah, if you haven't used it, it's definitely, I remember the first time I saw it, I, I'll start here is I was at a conference, I think, back in 2000, I think, like 18, 2008, 2019 or something like that.

[6:19] And I hated, I didn't really write much of any automated tests at that point. 
A little unit testing. But I never really, I never written like engine tests because every time I tried it was like, unbelievably painful. 
And I'm like, this is just like, it's just like a big, a lot of effort for something that I didn't feel like confident, even writing myself. 
And so, but I remember going to this talk at a conference and I saw Cyprus being demo and I was like, oh my goodness, like, this is like, this is like magic, how are they doing this? 
Like, and at that point, like, I, I remember coming home and like, I have to download this and try this and I was like, I've never ever said, like I have to go and try this testing thing, right? 
So I was like, you know, testing is something that like, no one gets excited about. But in that moment, I was like, wow, this is like, really, really cool the way it's doing it. 
And so, yeah, and, and little did I know, you know, and fast forward a few years, I'd be working at Cypress. 
So it's kind of cool to look back and, and, you know, see everything. 
So the most surprising thing about your answer to me is that you do not use a word that if someone would ask me what Cyprus is. 
A word that I was would use. Do you know what word you didn't say?

[7:32] Uh I don't know, what did I say? It's, it's javascript based? Ok. Yeah, that is true. 
And for me that feels very different. 
It, that is a good point for me. I guess I've, I've, I used to, you know, work in PHP and drupal and that sort of thing. 
But the last probably eightish years, I've pretty much been exclusively in the javascript ecosystem. 
So I guess for me, my context it was my default. So, yes, I, I apologize. 
So it is written in javascript. So, and you could use typescript too. 
So, but uh yeah, I guess, sorry, III I missed no need to apologize. It just surprised me. 
So how did, how did the project get its start? Do you know anything about its origin story or can you enlighten us on like was this part of some other project and got spun off or was it a frustrated developer who just said, screw it? 
I'm gonna write my own. Like, what, what's the story? Yeah. 
So our founder and, and I don't wanna, uh I don't wanna the way I remember this as you know, I, I'll tell it from this perspective. 
II I could be saying it wrong. So I'll totally, I may be missing little spots but essentially that part out that your caveat will stay.

[8:47] Yeah, this is an absolute truth. No. But basically our, the founder of, of Cyprus was I believe working at a company and basically had this idea or he was at a conference or something and basically had like this a ha moment where he thought, wow, like basically Selenium and all these other testing tools used AAA protocol that basically sent requests outside the browser to like an API of the browser to then automate things. 
And but the problem is like browsers are complex and they're asynchronous. 
So they don't run, they're not always very reliable or deterministic. 
And so what we would have to do is we would have to like put a bunch of weight. 
So we'd say like visit this page and then like wait for 10 seconds and then like, then do some things and then wait some long, like some more time. 
But then like you would work, it would like work and then you'd like run in C I or someone else would run on a slower network connection and the test would fail and then you would just increment the count of how long you waited. 
And then there's just a lot of things like, you know, if you really think about exactly what a lot of, a lot of the things you think about what a browser is. 
It's actually fairly complex. There's a lot of things happening and that's what made testing like this really painful. And so.

[10:03] Had this this sort of a aha moment where what if Cyprus could actually run in the actual browser and it would have access to all the things in the browser. 
And so essentially what Cyprus does is it, it uses Chrome Safari, Firefox, whatever browser you want to run it in and it basically loads essentially Cyprus as an I frame inside the browser and then it then is in the same runtime loop as the actual as your browser itself. 
So you have access or I should say Cyprus has access to network requests, the entire dom tree console logs, you know, you have everything. 
So as a developer you're using, well, I would say as a javascript developer anyways, you have access to a lot of the, the same tooling that you're like using on a regular basis. 
And it, and it just like and it's, and it's javascript for, for a lot of people. 
So they're just like, oh it just, it just kind of just works, right? So that's sort of the, the the problem it set out to, to, to face and then, you know, many years later, you know, where sort of the in a lot of ways the, the de facto end to end testing tools. 
So I want to talk about, you know, how it actually works from like a user perspective in a few minutes. 
But, but, but I want to talk about like the community as well as the company who I believe is your employer as well. 
Yes. And, and, and what that looks like. So Cyprus, the code is, is all open source. Do I have that? Correct? Correct.

[11:31] And there's also Cyprus, the company is, how should I distinct.

[11:35] You know, should I call one Cyprus dot IO, which is kind of the URL or what? How do I distinguish? 
Yeah, people are. Well, I would say, you know, Cyprus is, is the open source, I guess package and then Cyprus dot IO is the company that basically backs and sort of stewards the open source project as well as something called Cyrus Cloud, which I think is kind of where you're leading, which is sort of, it's like an additional thing you can add to the open source product that really enhances the.

[12:05] Your overall experience as well as the insights you can kind of glean from your test. 
And I wanna ask, I wanna talk about that in a moment, but before we get there, I do wanna so Cyprus, the open source project are, you know, how large is like the contributor community?
How like as far as are we talking dozens hundreds thousands of code contributors and documentation contributors to Cyprus? 
So yeah, so I think on the actual product itself, we have like 400 or 500 contributors who have contributed to it. 
But we also have many other sort of ancillary repos that are sort of loosely connected. 
And I'll give an example of recently, I worked on the tooling team for a while at Cyprus. 
So I built, for example, we have a Docker image that basically it's like the recommended, like if you wanna run Cyprus in a Docker container, this is like everything that you need to you basically need to run. 
So it's just like I built this repo that then is downloaded tens of millions of times by people. 
So it's like, you know, crazy like number of people. So there are lots of as well as like circle C I. 
And then like, they're just, you know, all, all kinds of things that are not necessarily tied to Cyprus, but are sort of things exactly Cyprus adjacent that have lots of contributors to as well. 
And then the other thing I would say is beyond that, like, one of the things that really separates, I think Cyprus from.

[13:34] Really any other testing tool that I'm aware of is we actually have a really diverse like plug in and ecosystem. 
And so there are ways you can a lot of we've hundreds. 
Like I find like there's probably thousands of these, I find about new plugins all the time and like, I didn't even know this existed. 
But basically, people can build plugins or extend on top of Cyprus, you know, to solve certain use cases or to work with like other adjacent tools that aren't necessarily something we like officially support that type of thing. 
So, yeah, the the ecosystem is one of the things that really makes, I believe Cyprus, you know, the sort of the tool that it is, it sounds familiar, it sounds very familiar what you're saying to someone. 
So there's also Cyprus dot IO, the company, is it fairly well? 
Maybe I should let me ask it this way, are the majority of the contributors to the core Cyprus open source project employed by Cyrus dot IO or is that a minority or are there are there major contributors who aren't employed by Cyprus. 
I'm just trying to share and I think, you know, where I'm going with this. 
Right. You know, there are open source projects that are.

[14:40] Managed or heavily controlled by a single for profit entity and there's ones that aren't. 
So I'm just trying to figure out where does Cyprus fall in, in that continuum. Yeah. 
So Cyprus is probably, I don't, I don't know exact numbers, but I would guess 90 to 95% of contributions come from Cyprus IO employees. 
And, but we definitely do have lots of contributors. 
We have a lot of people that will either, you know, file an issue for some specific, you know, edge case and then we fix them. 
So in those cases, like, even though we, we fix it, a user identifies the problem or uh a feature that they would like that sort of thing. 
So, but in terms of like actually like sort of the, the stewarding of the, of the open source project is definitely falls upon Cyprus itself. 
And so that's one of the things that I would say, I think like some people may have a problem with, but in general, I would say open source is a really difficult thing that everyone depends upon and no one wants to pay for it. 
And so I think there are challenges that are probably outside of the scope of maybe this, this, this podcast episode. 
But I would say definitely when you can, if your company relies upon a tool like.

[15:56] Virus or some other open source project that has an open source offering, it's definitely advantageous to everyone to support those because, you know, they're the one building the tool that you're using for free to make money off of or, you know, or to, to make sure you keep making money or something. All right. 
So then the natural question is how does Cyprus dot IO, the company make, make its money to pay its developers?

[16:20] Sure. Sure. So we are a startup. So we have raised the most recent round of funding was series B funding back in 2019 before I came to Cyprus. 
But Cyprus has a, a cloud offering that essentially what it does is it records your, your tests that get run. 
And so what it does is it essentially gains insight into, you know, the tests that are being run. 
Like how reliable are they? Are they flaky, are there parts that could be improved, things like that and then we surface them to you in the app. 
And so an example of this is actually Cyprus tests Cyprus using Cyprus. 
It's actually really cool to see. It's very, like, it's very meta and like gives you a headache when you really think about it. 
But what we do is like, so we test Cyprus inside of Cyprus. 
And so one of the things when we're working on a feature or bug fix or something like that is if C I runs and, and something fails, well.

[17:18] I could go into like circle C I or, you know, in our case, our CRC I provider and I could like go through some logs to try to determine like what test failed. 
But it doesn't really give me valuable insight into why did it fails? Things like that. 
But the alternative is with the, if you're using Cyrus cloud, all you have to do is open, like be inside of that branch, like check out the branch that you're working on launch Cyprus. 
And we basically tell you, hey, this test failed and this is the specific test that's failed. 
And you could basically say just rerun this test. I want to see what failed. 
So there's, it gives like a way to like. 
Identify tests and really just improve workflow, you know, scalability efficiency, all that type of stuff, right? 
So it sounds like it, it provides some, you know, uh advanced reporting, let's say that leads to a point. 
But it also, and I don't know if I, if, if I understood you correctly, which is I, I wanna ask about this, you mentioned, it tells you if your tests are well written and if they're flaky. 
So is it doing some type of like static analysis of your javascript code? 
Does the or, or how does that?

[18:29] Sure. So it's, it's not doing that at least as of today, we are doing some things that are heading down that path a little bit more. 
But what it's doing at the moment is basically because it records all your test run. 
It knows that if like uh for example, a certain test is regularly failing, but if you rerun it, it passes, that's an indicator like, hey, this test is flaky. 
And what what I mean by that is like, you know, because browsers are asynchronous, maybe you're trying to make an assertion on something in the dome that hasn't been settled yet. 
So maybe it's waiting for an api request to complete or something like that to me. But whatever. 
Exactly. And so what, what happens is actually there are, there are different, like best practices in terms of how you go about selecting things from the dom. 
And oftentimes if you don't follow those best practices, you sort of enhance the likelihood of flaky test arriving. 
And I don't know if we want to go to very specifics on what those are, but there's basically just high level, like it's a, it's an indicator of, you know, why is this pointing in that something is like, not always.

[19:38] Giving you the same answer. So maybe you should go and look at it and follow a best practice or, you know, maybe rewrite your test or something like that or maybe it's saying, hey, like your service is not returning, you know, a response in the, in a deterministic way, maybe it takes two seconds, one time, it takes it times out the next. 
So that's something that's also valuable information. 
So it sounds like that like the, the Cyprus cloud offering is something that.

[20:04] Isn't geared just towards organizations of a certain size. 
It seems like anyone who's using Cyprus could, could get value out of that. 
Yeah. In fact, we actually have a, we have a free tier of it. 
So if you run like it records like up to like 500 tests, if you're working on a small project by yourself or maybe even open source project, like, you know, 500 tests are free. So you can use it and try it out. 
And, you know, I think people see the value in it really quickly. 
Is it safe to assume that there's some service offerings as well? 
Like if an organization needs help either getting up to speed on Cyprus or needs help writing some complex tests that there are, you know, that we could hire someone from, from the mother ship to help us with that. 
Yeah, so, so we're, we're slowly walking into the territory where Jordan doesn't know that much. 
But I will say we do have like, especially for our enterprise customers. 
We have like a technical account manager that provides like resources as well as uh myself and others often will do trainings for teams and say, hey, these are best practices based upon problems you're having or they'll say, hey, I'm having this problem and, you know, we, we provide insight to them, but it's much easier to provide technical support for people that are actually like customers of ours than people that are, you know, just using an open source tool. Right. Right. Right. 
Yeah. So it sounds like, I mean, it sounds like it's sustainable.

[21:28] Yeah, absolutely. All right, let's move away from the organization and the open source community. 
And kind of, let's talk about the actual, you know, the, the actual software for a bit coming from the drupal community. 
Drupal core uses PHP unit. 
We have functional javascript testing and functional testing. 
And so it's all like php based and uses M and, and stuff like that. 
And that's something that a lot of folks in the drupal community are comfortable with. 
So how does a tool like Cyprus, how does that differ or how is that the same than what the drupal community is already accustomed to?

[22:04] Yeah. So I would say this is probably the part that's going to be outside of it written in javascript. 
It's probably gonna be the most fundamentally different for drupal community. 
And that Cyprus takes sort of the opposite approach to testing. 
And that unit testing is great because it is very cheap. 
It's usually really easy to write, it's really fast to run. 
However, I would say the value you get from a unit test is arguably not that great outside of like if you have, for example, have like a, a complex calculation function that calculates some business logic or something, you know, for given sets of inputs, you want a certain output or something like like things like that. 
Those are great use cases for a business uh unit test because those are like, you know, core business logic that you want to make sure works right. 
However, when you're thinking like front end development at the end of the day, the interface that matters the most is the is the dom because it's the interface that your users actually interact with your application. So you could have.

[23:12] Like really great unit test coverage that all of your application. 
But if the users that actually interact with in the dom with your application have a bad experience, you know, that's, that's not good, right? 
And, and the problem with like unit testing is it tests a lot of little parts, but it doesn't necessarily test that all the little parts play together nicely. 
And so Cyprus takes the opposite approach where it doesn't test the internals of something for like end to end testing, it just basically visits a URL. 
It's, it's completely agnostic to a framework that you're using. 
It doesn't care if you're using drupal or some javascript framework or something like that. 
It's just gonna visit the compiled, you know, html cs S javascript that gets bundled in the browser at a URL. 
And so that's what's great about end to end testing. 
And that's something that would be very, very, you know, relevant for your community. 
And the thing with that is you're not testing business logic or your implementation of a function or something like that, you're testing that, hey, when a, when a user clicks this button, what side effect does it have on the URL. 
Does it, is it supposed to reroute to another page? It's supposed to display a thank you message, that type of thing. 
And so those are the things that you're testing with an end to end test as opposed to like a unit test.

[24:30] Now, I will say the one thing the team that I work on now is, is something called component testing, which is a sort of like a, a new type of testing we're doing with Cyprus, which uses the same API fundamentally, it's a little different, but essentially what it is is it's a way to test more granular kind of like a unit test like you're talking about or I just say, I just want to test this one button. 
I don't want to test the whole URL and all the assets and things that get loaded. 
I just want to take this, this selector component, this button component or whatever component at, you know, you could be the, the tiniest level or a high level parent component. 
And I wanna put that in the dome. In those cases, you, you just mount the component and then, but you still test it from the outside in instead of testing the internals of, of that thing. 
Now that wouldn't really translate in the, in the drupal community because you know, just the way like php, you know, gets rendered on the server and it's uh and it's not javascript, it doesn't have like javascript run time. 
So that would be different. I'm sure we could.

[25:36] I'm sure someone, maybe there's someone already has this. We have a third party api where people can build their own like framework mount and stuff or something. 
So I'm sure it's possible with the potentially drupal, but I, I have to think about it. 
But so that's the part that's not necessarily relevant to your all's community. 
But the end to end testing most certainly is. 
But I don't know if that answers your question, but fundamentally, they're, they're pretty different. 
It seems like Cyprus is more in the vein of the hat or old school selenium tests, like, as you mentioned earlier. Is that fair? 
Yes, it, it def definitely is more in line with those types of tests. 
The only difference is, is like if you've ever written tests like that, no, a new word, it's very painful, right? 
But from my experience, like writing a Cyprus test is like, it's like fun. 
Like I actually enjoy doing it and it's not, I don't want to, I like, you know, rip my hair out every time I do it. 
So, so, yeah, I, I've met actually, he was at a conference a couple weeks ago and the guy had a selenium tattoo on his arm and I was like, man, like, talk about regrets, right? 
Like, uh you know, and he was, I was joking and he was like, no, he's like, it's how I got, you know, where I am today because of Selenium. 
I was like, wow, like, OK, but uh you know, so there are a few people that really like Selenium, but for the most part, people have gladly enjoyed tool like Cyprus.

[27:01] And the sort of progressions that, you know, the ecosystem has made. All right. 
So let's talk about actually someone brand new to Cyprus, what skills should they have or at least be comfortable with or maybe even be interested in learning in order to use it in order to get started with Cyprus. 
Sure. So a couple things that I would say is actually think that I was having this conversation with a, a friend recently and he was telling me that he thinks Cyprus is like the gateway drug into programming. I said, really? 
And I've had the same sort of thought, but I wanted to hear his like explanation of it and basically Cyprus test, you know, they're using javascript, but essentially you can install it on any project. 
You just have to install, you just have to have nodes, you just M PM, install Cyprus and then it would download in Cyprus package from the not package manager. 
And then essentially you just open the Cyprus app and essentially NPX Cyprus open and then it will launch Cyprus, it will configure everything for you and then you just start writing tests.

[28:07] Now, how you write tests, the, the best place I would say to start doing that is the former team, I was on the, the developer experience team at Cyprus. 
We built something called learn dot Cyprus dot IO. 
And basically, it is sort of like the best practices on how to learn how to write and to and test with Cyprus from the Cyprus team. 
So that's a great resource for those of you who want to learn how to get started with Cyprus. It's completely free. It's not like a very.

[28:36] In depth. It's sort of like a, just a starting point the way we recommend testing how you should start thinking about writing tests like this. 
So it's definitely a resource for you. But getting back to the story about being a gateway drug, the reason why I think it is that way is you'll find, once you start, I think people will find writing tests are actually pretty easy to do.

[28:56] And the great thing is that it's running in a browser and you get this very quick instantaneous feature feedback loop that I think is like, exactly it's visual, it's constant. 
So like you could just like one command at a time and it'll just keep saving and refreshing and rerunning and you get this very quick feedback loop and it's almost like, wow, like I'm Cody and I'm writing code. I'm actually doing something useful. 
And so I think that sort of, you know, that's why he was saying it. 
He thinks it's like a gateway drug into, into programming for those of you who are maybe even new. 
So I would say, you know, to learn that Cypress 0.0 is a great resource for getting started. 
But I would just encourage anyone even if you don't really know javascript. 
Honestly, you don't really need to know much javascript if any to get started. 
But we have a uh I would say we hear that a lot of people really like our docs, Cyprus. 
So you can visit docs dot Cyprus dot A O and we have, I mean tons and tons of examples and deep from high level to small level of how to get started with using the Cypress API and so forth.

[30:00] But yeah, hopefully that gives some some insight for people, but I would just say try it out, give it a try. 
And I think, I think you'll, you'll find it's, it's really easy. So you said a lot there. 
But I, so I want to go back to a couple of things. I said, yeah, yeah, I will concur that learn dot Cypress dot IO is outstanding video based. 
There's some, some text as well. But uh you know, I went through the first two or three videos maybe just to kind of get a feel for things just really, really well done.

[30:30] I don't know how deep it gets because I didn't watch all the videos, but it's definitely something that When I decide that I have the bandwidth to really make the leap on the Cyprus, that's, that's I know that that's where I'm gonna start. 
The thing that really surprised me about Cyprus and you touched on it. 
And this is kind of our last big topic is it has an app. It has like a gooey to it. 
And when you actually go to and I don't know the order, you can correct me here. 
But I think when you launch it, you, when you launch the, the app using that NPX command, which that command was new to me. 
I don't, I'm not a huge N PM, no user, but you select the browser that you want to test it.

[31:08] So that goes to your point of what you said earlier. You're not running, you know, like a PHP functional test against some headless browser. 
You're actually using a browser that you have installed and then you kind of gave me a clue earlier when you said it runs in an I frame in said browser. 
But once, once that app is running, I mean, you see your test on the left and you see it running in, in the big screen. 
And it's got this feature called, I think it's called Time Travel.

[31:36] Where if you've got a number of assertions and correct me if I have my, my, my nouns wrong here. 
But if you have a number of assertions in your test, you can just click on a previous assertion to have that assertion rerun and give you the results. 
So you kind of jump around and the test. 
It was really for me, that was the big wild moment when I'm going through these videos. 
I'm like, what the hell is that? That's fantastic. So maybe talk about the app a little bit and yeah, and just go, I'll stop talking. Yeah. Yeah. 
No, not, not me. No, no. That, that, I mean, I love that you pointed it out. 
That that's what when I saw this at, you know, when I saw Cyprus demo at the, at the conference in 2018, like I mentioned earlier in the show, that was the aha moment. 
I'm like, oh my goodness, I can see I can go to open up the developer tools and I can see console logs of every command being executed as well is if my source code has conso log, I'll see that there. 
I can see the network, every network request being made. 
I can see, you know, source maps like literally everything I'm seeing in the browser that I'm already using when I'm building the code. 
So that is like a bit, you know, a huge win. It's one less thing you have to think about. 
And like, you know, it's, it just feels like you're developing as a, as a javascript developer or a front end developer. 
But yeah, like you said, the app, it runs in Electron and essentially it then launches the Cyprus instance in the browser that you choose it.

[33:02] And then like you said, you, you can search through, you know, a lot of apps have maybe dozens of tests or maybe hundreds of thousands. 
You can filter through the test. You want to run, click on the test and then yeah, it'll actually just run through basically the javascript runtime execution of all of every single test and it'll just run through them and you'll see the real time side effects of those apps running as if the user was doing it and it's so fast. 
Like you're like, wow, like this is crazy. Like you, you'd think it'd be really slow, but it's actually like.

[33:34] Blazing fast, you know, like, I don't know, I think that's really cool. 
I always wish we had a slow mode that would go slower. 
So I could see it slower, right? But you can go back on the left and click into a test and you'll see every single essentially like snapshot of state along the way and you can click on that, see what the dom look like, see what net network request resolved or didn't resolved or whatever side effect or bug you're trying to sort of, you know, you're trying to isolate, right? 
So, so yeah, that's the really cool thing. And then for those of you who are using Cyprus cloud, like we mentioned earlier, the feedback from those things then get embedded inside the Cyprus app. 
So we have like different pages that then sort of surface relevant information inside the Cyrus app. 
So yeah, that's the thing that um really is different about Cyprus from most other testing tools are just like a a node or some like shell command that runs, like you said in a headless browser or some sort of execution environment. 
That's the difference about Cyprus. 
And for those of you who are familiar with like writing components in javascript. 
One of the things that I love about component testing is that is that you don't have to mock things. 
So one of the painful parts of testing, especially components are mocking dependencies, whether this component is relies upon a service or some other dependency, right?

[34:57] You have to oftentimes when you're unit testing, you got to mock that or fake it or you know, you have to basically do something like that where with component testing, you actually use the actual production runtime environment to do all those things. 
So it not only is easier to write, it's a much more reliable test because you're actually using the real instance of all the things that your users are gonna use. 
So that's the thing that you really the I guess to kind of bring it all home. 
The thing that I love about Cyprus is not only is the the developer experience like, you know, I'm biased, but I think it's really, really good. 
I think that it's one that developers or even Q A people will find like, wow, it really gives me everything that I need to write like good tests.

[35:41] And then the other thing is like you end up writing tests, they're actually really valuable. 
Like I said, unit tests can be valuable for things. But at the end of the day, if you can have a an accurate end to end test, you almost don't need any unit test or very little unit test, depending upon the types of things you're doing. 
Because eventually the business logic function that you unit tested. 
The side effects of that are going to get surfaced to the user at some point, right? 
Like that's the idea. So, you know, I'm not saying don't ever unit test, but the idea is you can replace a lot of oftentimes, I've seen that you can replace a lot of unit tests and other types of tests with testing from the Dom itself, which uh again, that's the way most, you know, in drupal, like people actually interact with the browser and that's how they actually interact with your.

[36:30] Your, your thing that you're building your, you're selling or whatever. 
And I find that that that's a much higher value test to write. 
Um which is, you know, one of the things that I really believe about Cyprus, I don't know if that makes sense. 
But uh yeah, yeah. No, I see what you're saying. I suspect that there are folks out there who are on the other side of the fence totally who, who would probably strongly disagree with the, the balance between unit tests and, and, and, and tests. 
But that's not for, for this, for this discussion. 
One thing that did pop in my mind, I was actually gonna end things there. 
But I do wanna ask you one other question because something that when we run php unit functional or functional javascript tests, we're generally starting, you know, with a test like a fresh environment just for that test. 
So with Cyprus, it seems like you're gonna be running off of, as you said, a, a fully developed site and maybe a, you know, in, in ac I off a branch somewhere. 
But is it typically where you are, you're running your test against basically a copy of the production environment type of situation or like what's, what's a typical?

[37:38] Or recommended way of running these tests. Sure. So when you're doing end to end testing, you can test. 
The good thing is you could test different environments. So if you're locally and you're developing locally, you would want to run it against the development server development build. 
But you could have uh a staging or production test that hits production URL. S.

[38:00] So oftentimes the slugs of your URL are gonna be the same between environments, but maybe you have a different subdomain or something like that. 
So Cyprus, you can set a base URL in your configuration. 
So you could basically say run the the production configuration for these tests. 
And so it could, it could hit, you could run different types of tests based upon different environments. 
But the thing is is you are right, like the the thing about testing is you want it to be deterministic and you don't want state to leak from one test to the next. 
And so what Cyprus does is is it will, it will essentially tear down the browser or like not tear down the browser but basically re refresh the the page on every single test. 
So what it does is the initialization of a new test is basically visiting a URL in end to end testing. 
So when you say I visit the home page, it will visit that for a set of tests. 
And then if you were to run another test that tested something else on the home page, you would start it off by visiting the home page. 
So in every instance, it's going to basically, it's just like doing that. 
Actually, in a browser it's going to reload the page and all of its assets and all that type of thing. 
So, I don't know. Hopefully that answers your question.

[39:17] It does. You know, I think there are some pitfalls with that as well. 
Again, I don't want to get too far into the weeds with this, but, you know, if you are running a test early that changes some configuration.

[39:28] Then you run a later test like the, the fact that you made a configuration change that could change the output of a test depending on whether you ran the second test before that configuration change or after that configuration change. 
So that, that's kind of what I'm saying by a fresh environment for each, each test. 
But I, you know, II I take your point, I mean, it's, it's gonna be tricky no matter what. 
So, yeah, so all the links that we talked about will be in the show notes. 
I'm actually gonna also add some links to some uh Cyprus related presentations that I'm aware of in the drupal community. 
Uh So I'll put those in the show notes as well. And Jordan, I really appreciate your time and your knowledge today. 
And thank you for, I'm assuming introducing Cyprus to uh you know, more than a few drupal developers. 
Yeah. Yeah. Thank you. Always excited to, I haven't thought about drupal to be honest in a long time. 
So it was uh it was cool to uh go back can time time a bit for me. 
Not that uh drupal is, you know, in the past or something. 
But in terms of my work history, it has been, yeah, I'm excited to hopefully hear more from the community. 
And uh yeah, feel free to reach out to me if there's additional additional questions and we'll have links to um to how you can get a hold of Jordan in the show notes as well. 
All righty. Well, thank you very much, Jordan. Absolutely. Thanks for having me.

[40:53] Thanks so much for listening to the drupal Easy Podcast. Don't forget to check out all of our long form drupal training courses at drupal easy dot com and stay tuned for the next episode of the drupal Easy podcast where I will be talking with Andy Bloom about the drupal smart Snippets extension for Visual Studio code.

[41:12] Music. 

July 22, 2023