All right, so now we are back once again, and this time we are going to be using our run directory
that we created in our first video where we were trying to execute our test using the playwright test
fixture.
But this time we are going to create our own test fixture and we'll see how it actually works.
So we already know how the folio works and how the fixtures are working fine without any problem, which
is pretty cool.
And now the idea is there and all we are going to do is we're going to create our own.
Fixture, which we can extend and we can see how it actually works, so there are two ways that you
can actually work with the fixer.
One is in line fixer or maybe the fixer, which is available within the same file where the tests exist,
or the fixer, which is available on an external file.
So there is no specific naming convention available on the playwright at the moment, on the documentation
or by the team.
They have given it, but it is pretty useful.
I mean, I really like the fact that you can write fiction in two different places.
One is on a separate file or you can write in the same file itself if we want to.
So we can probably see the one test that is going to be sitting within this particular test file.
I mean, the fixer within the test file.
And then we'll see how we can write a fixer on an external file and how we can run that.
So the first thing is, I'm going to do this.
I'm just going to run a in line test.
Fixture darts back dot the yes, so this particular test is going to be holding the fixture within this
particular file itself and then we'll see how it actually works.
So the first thing was going to do once again is going to be the import and I'm just going to do from
and I'm just going to specify the plate, right.
And then I'm just going to do and extending of the fixtures.
So, again, same color like how we discussed in our video.
So I probably need to extend the folio this time.
So I need the folio variable and folio dot extend.
So this is something which we know already and we are going to be extending the tape which is available
within the playwright.
So we don't really have to specify that type, like how we did not earlier video while we created our
own fixture.
So this is perfect for now and now I'm actually going to run the test and we'll see how it actually
works.
So I'm just going to do and fixture Dot pulled over here so you can now be wondering, like what the
heck I'm doing at the moment.
So just don't worry about it yet.
I'm just trying to do a build there.
I'm just going to specify the concept of, like, whatever things that we saw before.
I can just do all those things over here.
Yeah, pretty much done.
So you can see that I have not extended anything at the moment.
So there is no extension cord and you will understand why I can really do an extension in a minute.
So this is the extend extending cord exist here or something like that.
So this is exactly what is available in the documentation as well if you go and see there.
But I just want to make it a case while you understand why I really need to do this and why the documentation
to tells all those details run the the my got I run the basic test of Neo when something like that.
And I'm just going to specify the context when I'll close this thing and I'll write this code pretty
much like we did earlier in our course.
And let's also make this sink because this isn't.
Oh wait.
Yeah, there we go.
And now let me try to run this particular test and show you what basically happens.
So if I just go to the seed of the test runner and if I do and NPCs are Foleo there, I'm going to also
tell which filename, because now we have two files.
So I have to specify which file name that I need to execute this particular test.
So now if I tried to execute this test, you can see that it is going to open and run on three different
browsers and it's also going to run the test on a headless mode.
So this is very, very bad because if they want to run the same test like one time, then you need to
either pass it on the parameter on the on the command line over here like Pyramus, or you need to somehow
control it for your test.
So the way that you can control it in the test is what is the fixture and that's how you can extend
that and you can do that.
So in order for doing that, that's when this particular fixture comes into picture.
And it's very, very handy, as I told you.
So all I'm going to do over here is I'm going to extend the fixture in such a way that I don't really
have to specify, like the parameter name, like Headful or something like that.
Rather, this time what I'm going to do is I'm just going to do this.
Fixtures dart browser options override that.
I'm just going to do an override of the so I'm just going to do and I think here and I'm just going
to do a run something like this.
Sorry about that.
The braces.
And then I'm actually going to do an operation here.
So I'm just going to do like this, a vade, pretty much like how we did in our earlier video.
So I'm just going to set the run and here comes the launch option.
So you can see that it automatically tells me that there is a launch option.
So what does this launch option and where is this coming from?
So if you go to the browser options over here, this is basically a launch option type.
And if I go to the launch option type, you can see that it has many different modes that you can set
basically like headless mode, executable pod arguments and proxy ignore default args.
And so all the stuffs download a pod, chrome, chromium sandbox and all those things so we can set
a many different things, even the demo tools and slowmo everything comes in over here and we can set
it for our test run.
So this is what it is.
Guys, this is what I was about to do right now.
So I am going to set a.
Variable here, something like and headless.
I can see that it automatically comes in and I'm going to set the headless asphalt.
So by default, it is true and this time I'm going to be sitting as false.
And now if I try to run this particular test, this should open a browser for me.
You can see that it is actually opening a browser on a different window.
For me, there are three different tests or here are three different browsers and running the test on
all these different browsers.
And you can see that one of the tests somehow got failed.
All right.
And I want to ask, so just one test got passed on to discard fail, which is all right.
I mean, if you don't need a second time, it should be passing.
But you got the idea, right.
So this is how you can set the headless Moedas Falls.
And then if you want to do a slow motion, you can set the slowmo as well, like in milliseconds if
you want to.
You can do all those kind of things.
And if you want to set the dev tool as true, you can do that as well.
So it's going to open the door tools for all these three different browser that it's going to be executing
the test for us.
And then it just opens up.
You can see that it is opening up the dev tools for the chrome and the there is no doubt one thing.
And it's also opening the Firefox and.
You can see that it just opened everything over there pretty cool, so this is how we can actually extend
our.
Behavior using the fixtures of the test, and it was found that any problem, no next video, we'll
see how we can even extend further with not just the browser options, but also with the context options
for the different device, scalability on the screen, and we'll see how it actually works.