So once you've installed, you're gonna get this. You'll get that GitHub folder there with the actions inside it, and you get a test folder, when you example.spec.ts file. That will have a very small test in there, which we're gonna go through today, and then there's a test example file, which has a to-do demo app, and you can have a look at that in more detail.
And then the PlayWrite config, in case you wanted to later add or remove some of those browsers, or put testing for mobile Safari, or set up a dev server to run your application on localhost 3000 before you run your tests, et cetera. You can do all that in the config, but you very rarely need to touch the config, because everything just works.
So when you wanna run tests, you can run all tests. You can run a set of tests, a single test, and tests run in parallel. Without you having to do anything, automatically runs in parallel, which makes them super fast. So I'm gonna run the tests using the VS Code extension. Again, you could use the terminal and just put npx.playwritetest, but here on line three, you'll see this lovely green triangle. So I'm gonna click on that, and then basically, it's gonna go down through each line, and it's gonna run the test. Now, you can see it opened up a browser window there for me, and I was able to see everything that's going on. I'll just play that again. You can see super fast, right? That's because I have this show browser ticked, and you can uncheck that if you want to. If you do not wanna see the browser, if you wanna see the browser, make sure that that is checked.
So live debugging, if you have any errors in your test, I mean, you never have errors, right? But if you do have any bugs or anything, you have live debugging and error messaging in VS Code itself. So again, we have our test here in VS Code, and I'm just gonna like break this here, right? So getByText, I'm gonna run that test, it's gonna break, and it says, error, strict mode violation. So playwright's saying, Hey, look, there's one, two, three elements there, and you can have the whole log. Now, if you don't wanna read the log or don't understand the log, you could basically just set a break point, and you could run that test again, so you can kind of see it. So running it in debug mode, and we can now go through that and see what's happening. So at this point in time, playwright's saying, Hey, look, getByText, resolved to three elements. Here's one of them. Here's the other one. And down the bottom, we've got another one that has the word star inside that getting started text. So playwright doesn't know which one you want it to choose. So it's saying, Hey, this is breaking the strict violation. So you can play around and live debug this and say, Okay, what if I put get star? Get star only resolves to one, so that would be okay. That would work. Again, we can kind of like go back into here and play around and put something like, imagine we put playwright, right? We put playwright. There's like way too many, okay? Hey, there's like 12 of these.
Comments