 Go ahead. Welcome to another Tech Talk. My name is Sergei Philippian. I work for MacMedia Foundation in the release engineering team. And we will be talking about Selenium tests in Node.js today. So I'll share my screen and I can start. So for about five years, we've had Selenium tests in Ruby. But from this year, we also have Selenium tests in Node.js. We have actually just deprecated Ruby frameworks. So everything going forward will be in Node. And it's all documented on Minibiquit.org. So let's take a look. This is the documentation for Node.js framework. And there's a lot of it. I think it's pretty well documented, but I'm subjective because I wrote most of it. What we'll be talking about today is writing tests. And that's this link here. So there's some slight difference between writing a Selenium test for core and extension. And since core already has some tests, we'll be writing a test for extension. I already recorded a shorter version of this talk. And it's available here. I'm sorry for the take look. There's also code examples from repositories that already have tests merged in. So there's plenty of code, I think, available. We will go through this example a bit slower today. And Rachel will be looking for questions on IRC. Well, so we will implement a simple test for math extension. I have set up my local MediKey rayon. So math is provisioned. And what we'll do is create a page with the random name and enter a simple math formula into it. So for example, let's say 1 plus 1, and we'll save the page. And the only thing that we'll check is that this formula was actually rendered as an image. And here it is. It's an image of this class, and we'll use this class name to check that the image is actually on the page. Let's start. So I'll create the file. Let's start writing code. So it's readable. Tests, Selenium, specs, math. The file is empty at the moment, so let's start. So we'll first say, we'll use strict. And we are using the Mocha testing framework. So we'll set it up. So Mocha had this describe and it functions. This describe function will be a suite. So describe math. There will be a test. It'll be just fun for this example. So a test is an 8th function in Mocha. So the test, we'll just check if math works for the simple addition. So we'll call it so math should work for addition. And let's write a FESL. If you remember from the example that I just did, we have created a random simple page. So this is way to get a random string in JavaScript just to use math and to string. So let's do that. Creating a page is several steps. So it'll be opening a page, clicking in the button, entering some text, and then clicking Save button. Luckily, it's already done. We already have the code for that in Meduki Core. So we can reuse that. So let me quickly show you. This is how to use it. So edit page, edit, then you provide name and content. And this is the implementation. This is the edit page. And this is the edit function. So it takes name and content, then opens it for editing. It's implemented here. There's content and save elements. And they're defined here. But we don't need to worry about those details in the moment. The important thing is that we can reuse that functionality in an extension. Let's do it. So we can say edit page, provide name and content. So page, we have just find the line above. And the content will be a simple formal, acquitted one plus one. And so we forgot to, I forgot to define the edit page up here, so let's do that right now. We can't use it before we find it. So long string, so I'll copy, paste it. This is how to get, how to require a page for midwiki core if you are in an extension. So let's start running that. So also to run all the tests, we can just run NPM run Selenium for midwiki core folder. But since we just want to run, this will run both core and extension tests. But since we just want to run this one a simple way, is just to start ChromeDriver in a separate tab. And then just run this one test. So let's do that. So we can start ChromeDriver here. And for midwiki core, we can just run this one test. We'll see the Chrome opening on random page, entering text, saving, and that's OK. So the test passes because it actually doesn't have any assertions yet. So Mocha can't really fail and everything. So we can check if we actually created a page. So let's reload. And this is the page we just created. And we can see the formulas here. And it is an image. So let's continue. So the next thing is an assertion. So the test is not really useful if it doesn't run any assertions. And we can use built-in assertions from an assertion library from Node.js. And so this assert is required assertion. We are, I didn't spend much time on page objects yet. I'll just assume that people know the basics of it. It's a simple pattern. And it's used in Insulin and Tesla and in our implementation. So let's create, let's assume that there is this new page called math page. We'll define it later. And that it has this, well, what we need actually, right? So we need a page that has this element on it, right? So let's say that there's a page with an image. And we are checking if it exists. Now, this will fail because the math page is not defined. So let's define that. And we'll put it in the page objects folder in the extension. Here, I forgot something. Oh, well, I actually forgot to create a page. So let's do that. Yeah, it's empty for a moment. So let's define it. First, we'll just save gstrc. And we need to provide path to the base page, base page object that's located in Unity Core. This is also really awesome, so we'll copy and paste it. And let's define the page with this one element. So we'll save a class, math page, extents page. So we'll just have one element called image. It will actually just return this browser element. Browser element will just be a CSS selector. And it will be this class closed page again. So we'll find the element by its class one. So there it is. I think that's actually all. Quick look at the other page. So before we run this, let's just invert the assertion. Let's just add this pan here. So it fails. I never trusted test them in C fail first. So let's try that. This now should fail, saying that false is not equal to true. Filling this up and I think, yeah. So the assertion failed saying false equals true because we've on purpose broke this assertion. So let's fix it. Let's rerun it. That should be all green now. Make sure you're turning in the background. And it's all green. So at this point, we can create a commit, push together it. I get it reviewed and merged. Or write more tests. That's all I had for today. The rest is documented on Mediaweek and Toric. There's also a section on how to get help if you have any questions. If you have any questions, if there aren't any people online with questions, I can answer them now. Or you can use Mediaweekly for our link RC channel. There's a publicator. You can use browser tests or browser test infrastructure. There's also Q&A on the list. Are there any questions? Not yet. All right. So should we just hand for now or should we wait? Sure. Let me ask one more time. If you have anything to say about how people can find more information about this, maybe do that now and I'll ask on IRC. I'm just trying to stop the screen share. The best place to go is the landing page on mediaweekly.org. Just go to mediaweekly.org slash week slash millennium. And all the getting help is documented there. OK. It looks like we have no questions. So thank you so much, Delko. Oh, wait. It looks like somebody is going to follow up with you with questions later. So thank you, Delko. We'll talk soon. And I'm stopping the broadcast.