Today, we're going to talk about the Skype feature of Playwrite Destructor, so we have been talking
about this testing, like how we can write the IT blog and describe blog and how we can write our own
fixtures and how we can customize our own fixtures and stuff.
But there are cases that we would like to skip our test based on certain criteria.
For example, if you remember in our earlier video we were discussing about this fixtures while we were
using this device like iPhone 11, Permax couldn't able to actually run the test only for the Firefox
browser.
If we just remember, I can probably show you what I really mean.
So if I just go to the test runner and then if I try to run the inline test fixture spec darts file,
you could see that it is actually running three test for us.
So it actually open the two browser for me somehow in the other window on the kit and on the Chrome
browser.
But the test actually failed in the Firefox browser over here.
The reason being the browser, that new context optional is mobile, is not supported in Firefox.
So there are many such cases that our test might fail because the browser does not support that kind
of stuff.
Internet browser is dead right now.
We don't really have to worry about Internet protesting and stuff.
But in these kind of cases where the Firefox browser itself, which is kind of very popular and it doesn't
really support some of the capabilities of the playwright, then probably we need to skip that test
or maybe just let the testers to be not executed while these kinds of issues happen.
So in order for doing that, we actually have a controller of the whole playwright's test itself.
So if you go to the tests over here and if you search for what is called as a test, you can see that
we have something called a test over here, the contest.
And it actually has a lot of different functionalities for the test operation that you can do.
I mean, you can do something like a test of the skip or test only, and you can see that there is something
called a test only.
And similarly, there is something called a desktop.
Skip all that stuff.
So I can probably show you that in suffering in the description file, if I go to the.
So what I actually need to do over here in order for this test to be executed is if I go to my inline
fixture test fixture over here and if I go to the fixture file this one, you could see that we have
been using the Foleo ID.
We have extended the folio because we have extended the display right test itself.
So we have to customize our test as well.
So we need to export the concept of test for the folio, which is from like this.
You can see that now the test also comes in pretty much like how we did for the ID block and described
blocks in over 11 years.
So I'm just going to be using the exact same concept here that I'm just going to be getting the test.
And now if I go back to my color of this fixture, which is nothing, but I guess it's the inline test
fixture, this guy.
So if I go over here, I can now call something called as test, something like this.
So this is, as you can see, this auto import from the playwright slash test from the concern that
we just saw on the description before.
That's what it is coming over here.
So if I put it Dot, you can see that we get a lot of methods coming over here, like symbols and then
only skip and stuff.
So these are some of the methods that we really, really required for our requirement that we have.
So I need to skip my test based upon the browser that we have in our test.
So what I'm going to do is like I don't really need to disturb this particular test because you need
it for the reference.
So I'm just going to write one more ID block here.
I'm going to say I should be probably skipped for the Firefox test.
And over here I'm just going to pass the I mean, it's not a synchronous method.
So bravely, basically, I can just do something like a browser name, something like that.
I can just put this faleiro over here or something like that.
So this browser name is basically this guy, the browser name from the Playwright's Barometer.
And I know that playwrite by itself has got different types of parameters.
And these are the parameters, what been passed from the command line as well as browser name.
You can specify that chromium Firefox or Web kit, but they run the test from the command line.
Like NPCs, Foleo browser name is equal to chromium, something like that.
That's exactly what it is.
So we are getting this guy.
Over here, the browser name, and now I'm just going to call this test, which we just exported from
the IT block in our from our fixture, and then I'm just going to call the test dot.
And there is something called S Kipe, something like this.
And here in the skip, I'm going to say if the browser name is equal to Firefox two, that Intellisense
comes in, then I'm going to say skip the test as it doesn't support his mobile option.
That's it.
So this is amazing.
So basically, we are telling that if this guy is going to be a Firefox, then just skip this sprinkler
test for me.
Right.
So as that said, once we have this thing skipped, then I'm going to over here.
I'm just going to call the sink off.
Probably.
I think what I'm doing is like I'm just going to do exactly the same kind of code over here.
So I'm just going to pass the page instead of the context, because it's going to be the page conduct's
from the parameter from the playwright to this comes in and then I can just do and a weight off the
page, go to York dot com, something like that, so I can just do something like this.
Yeah.
And beginning this particular editor at the moment over here, the reason is because we could actually
see that potentially this particular browser is telling that it cannot be assigned to a type of boolean.
So there are two major problems we have at the moment.
I could see that this test is something we exported from the fixture and we are not using that.
First thing is that one, we need to fix that.
So I'm just going to remove this picture feature because we are going to use the import of the playwright
and we are going to be using the test from our fixture.
And also we we need to pass because we are going to be using the test from the fixture which we have
exported over here.
I actually need to pass the test aswell, something like how we pass the parameter browser name.
So I deposit as well and you can see that the error is gone.
So now this is how we could actually be able to write the test with the skip method over here.
Right.
And now if I try to run the same test that we executed before for the Firefox browser as well, let's
see.
Just let me come in to the speaker code.
And if I try to run this particular test, let's see what happens.
So you can see that it runs like two different browser for me over here.
But the test has not got failed.
And if you could see that reason being, it says that should be skipped for the Firefox test.
So this is actually coming from this guy and it is not actually running the Firefox test.
And it says that there is one test being skipped.
Yeah.
So this is happening because our test is actually skipping the Firefox browser.
For me, this is really, really cool.
So with this, you can now get an idea of how that you can work with the skip functionality of the test
itself.
You know, this video will quickly see how we can instead of just commenting this a piece of code,
we can run the test that we are actually looking for, we should be discussing in our next video.