1
00:00:00,210 --> 00:00:05,910
Today, we're going to talk about the Skype feature of Playwrite Destructor, so we have been talking

2
00:00:05,910 --> 00:00:12,690
about this testing, like how we can write the IT blog and describe blog and how we can write our own

3
00:00:12,690 --> 00:00:15,420
fixtures and how we can customize our own fixtures and stuff.

4
00:00:15,660 --> 00:00:20,950
But there are cases that we would like to skip our test based on certain criteria.

5
00:00:21,270 --> 00:00:27,030
For example, if you remember in our earlier video we were discussing about this fixtures while we were

6
00:00:27,030 --> 00:00:35,820
using this device like iPhone 11, Permax couldn't able to actually run the test only for the Firefox

7
00:00:35,820 --> 00:00:36,240
browser.

8
00:00:36,240 --> 00:00:40,490
If we just remember, I can probably show you what I really mean.

9
00:00:40,500 --> 00:00:48,660
So if I just go to the test runner and then if I try to run the inline test fixture spec darts file,

10
00:00:48,930 --> 00:00:53,000
you could see that it is actually running three test for us.

11
00:00:53,520 --> 00:01:01,260
So it actually open the two browser for me somehow in the other window on the kit and on the Chrome

12
00:01:01,260 --> 00:01:01,760
browser.

13
00:01:01,950 --> 00:01:06,120
But the test actually failed in the Firefox browser over here.

14
00:01:06,330 --> 00:01:11,810
The reason being the browser, that new context optional is mobile, is not supported in Firefox.

15
00:01:11,820 --> 00:01:17,160
So there are many such cases that our test might fail because the browser does not support that kind

16
00:01:17,160 --> 00:01:17,590
of stuff.

17
00:01:17,610 --> 00:01:19,110
Internet browser is dead right now.

18
00:01:19,360 --> 00:01:22,560
We don't really have to worry about Internet protesting and stuff.

19
00:01:22,830 --> 00:01:29,850
But in these kind of cases where the Firefox browser itself, which is kind of very popular and it doesn't

20
00:01:29,850 --> 00:01:35,250
really support some of the capabilities of the playwright, then probably we need to skip that test

21
00:01:35,250 --> 00:01:41,640
or maybe just let the testers to be not executed while these kinds of issues happen.

22
00:01:41,820 --> 00:01:49,350
So in order for doing that, we actually have a controller of the whole playwright's test itself.

23
00:01:49,380 --> 00:01:58,590
So if you go to the tests over here and if you search for what is called as a test, you can see that

24
00:01:58,590 --> 00:02:01,530
we have something called a test over here, the contest.

25
00:02:01,800 --> 00:02:09,660
And it actually has a lot of different functionalities for the test operation that you can do.

26
00:02:09,840 --> 00:02:16,800
I mean, you can do something like a test of the skip or test only, and you can see that there is something

27
00:02:16,800 --> 00:02:18,150
called a test only.

28
00:02:18,480 --> 00:02:21,440
And similarly, there is something called a desktop.

29
00:02:21,450 --> 00:02:23,160
Skip all that stuff.

30
00:02:23,160 --> 00:02:28,750
So I can probably show you that in suffering in the description file, if I go to the.

31
00:02:29,160 --> 00:02:35,340
So what I actually need to do over here in order for this test to be executed is if I go to my inline

32
00:02:35,340 --> 00:02:40,890
fixture test fixture over here and if I go to the fixture file this one, you could see that we have

33
00:02:40,890 --> 00:02:42,480
been using the Foleo ID.

34
00:02:42,480 --> 00:02:47,280
We have extended the folio because we have extended the display right test itself.

35
00:02:47,430 --> 00:02:49,920
So we have to customize our test as well.

36
00:02:49,930 --> 00:02:56,910
So we need to export the concept of test for the folio, which is from like this.

37
00:02:56,910 --> 00:03:02,700
You can see that now the test also comes in pretty much like how we did for the ID block and described

38
00:03:02,700 --> 00:03:03,900
blocks in over 11 years.

39
00:03:03,900 --> 00:03:09,510
So I'm just going to be using the exact same concept here that I'm just going to be getting the test.

40
00:03:10,320 --> 00:03:19,740
And now if I go back to my color of this fixture, which is nothing, but I guess it's the inline test

41
00:03:19,740 --> 00:03:21,100
fixture, this guy.

42
00:03:21,390 --> 00:03:28,380
So if I go over here, I can now call something called as test, something like this.

43
00:03:28,710 --> 00:03:35,940
So this is, as you can see, this auto import from the playwright slash test from the concern that

44
00:03:35,940 --> 00:03:37,680
we just saw on the description before.

45
00:03:37,950 --> 00:03:39,320
That's what it is coming over here.

46
00:03:39,720 --> 00:03:46,380
So if I put it Dot, you can see that we get a lot of methods coming over here, like symbols and then

47
00:03:46,450 --> 00:03:48,170
only skip and stuff.

48
00:03:48,180 --> 00:03:53,580
So these are some of the methods that we really, really required for our requirement that we have.

49
00:03:54,000 --> 00:04:01,950
So I need to skip my test based upon the browser that we have in our test.

50
00:04:02,190 --> 00:04:06,030
So what I'm going to do is like I don't really need to disturb this particular test because you need

51
00:04:06,030 --> 00:04:07,050
it for the reference.

52
00:04:07,320 --> 00:04:10,200
So I'm just going to write one more ID block here.

53
00:04:10,710 --> 00:04:17,580
I'm going to say I should be probably skipped for the Firefox test.

54
00:04:17,880 --> 00:04:24,930
And over here I'm just going to pass the I mean, it's not a synchronous method.

55
00:04:24,930 --> 00:04:30,990
So bravely, basically, I can just do something like a browser name, something like that.

56
00:04:31,320 --> 00:04:34,720
I can just put this faleiro over here or something like that.

57
00:04:34,780 --> 00:04:39,690
So this browser name is basically this guy, the browser name from the Playwright's Barometer.

58
00:04:39,690 --> 00:04:43,460
And I know that playwrite by itself has got different types of parameters.

59
00:04:43,470 --> 00:04:47,490
And these are the parameters, what been passed from the command line as well as browser name.

60
00:04:47,490 --> 00:04:53,130
You can specify that chromium Firefox or Web kit, but they run the test from the command line.

61
00:04:53,130 --> 00:04:57,710
Like NPCs, Foleo browser name is equal to chromium, something like that.

62
00:04:57,720 --> 00:04:58,860
That's exactly what it is.

63
00:04:58,870 --> 00:04:59,850
So we are getting this guy.

64
00:04:59,930 --> 00:05:05,780
Over here, the browser name, and now I'm just going to call this test, which we just exported from

65
00:05:05,780 --> 00:05:15,380
the IT block in our from our fixture, and then I'm just going to call the test dot.

66
00:05:15,720 --> 00:05:19,760
And there is something called S Kipe, something like this.

67
00:05:20,240 --> 00:05:28,510
And here in the skip, I'm going to say if the browser name is equal to Firefox two, that Intellisense

68
00:05:28,520 --> 00:05:39,570
comes in, then I'm going to say skip the test as it doesn't support his mobile option.

69
00:05:40,640 --> 00:05:41,180
That's it.

70
00:05:41,780 --> 00:05:44,960
So this is amazing.

71
00:05:44,990 --> 00:05:53,630
So basically, we are telling that if this guy is going to be a Firefox, then just skip this sprinkler

72
00:05:53,630 --> 00:05:54,240
test for me.

73
00:05:54,290 --> 00:05:54,610
Right.

74
00:05:54,920 --> 00:06:01,820
So as that said, once we have this thing skipped, then I'm going to over here.

75
00:06:01,940 --> 00:06:06,230
I'm just going to call the sink off.

76
00:06:06,950 --> 00:06:07,480
Probably.

77
00:06:07,490 --> 00:06:11,720
I think what I'm doing is like I'm just going to do exactly the same kind of code over here.

78
00:06:11,990 --> 00:06:19,040
So I'm just going to pass the page instead of the context, because it's going to be the page conduct's

79
00:06:19,040 --> 00:06:27,500
from the parameter from the playwright to this comes in and then I can just do and a weight off the

80
00:06:27,500 --> 00:06:32,340
page, go to York dot com, something like that, so I can just do something like this.

81
00:06:32,370 --> 00:06:32,740
Yeah.

82
00:06:33,110 --> 00:06:39,920
And beginning this particular editor at the moment over here, the reason is because we could actually

83
00:06:40,580 --> 00:06:47,570
see that potentially this particular browser is telling that it cannot be assigned to a type of boolean.

84
00:06:47,840 --> 00:06:50,500
So there are two major problems we have at the moment.

85
00:06:50,510 --> 00:06:55,700
I could see that this test is something we exported from the fixture and we are not using that.

86
00:06:55,700 --> 00:06:58,100
First thing is that one, we need to fix that.

87
00:06:58,400 --> 00:07:04,790
So I'm just going to remove this picture feature because we are going to use the import of the playwright

88
00:07:05,060 --> 00:07:09,920
and we are going to be using the test from our fixture.

89
00:07:10,310 --> 00:07:17,120
And also we we need to pass because we are going to be using the test from the fixture which we have

90
00:07:17,450 --> 00:07:19,350
exported over here.

91
00:07:19,580 --> 00:07:25,220
I actually need to pass the test aswell, something like how we pass the parameter browser name.

92
00:07:25,340 --> 00:07:28,290
So I deposit as well and you can see that the error is gone.

93
00:07:28,520 --> 00:07:36,050
So now this is how we could actually be able to write the test with the skip method over here.

94
00:07:36,110 --> 00:07:36,430
Right.

95
00:07:36,680 --> 00:07:45,470
And now if I try to run the same test that we executed before for the Firefox browser as well, let's

96
00:07:45,470 --> 00:07:45,590
see.

97
00:07:45,590 --> 00:07:47,360
Just let me come in to the speaker code.

98
00:07:47,750 --> 00:07:52,220
And if I try to run this particular test, let's see what happens.

99
00:07:53,900 --> 00:07:58,060
So you can see that it runs like two different browser for me over here.

100
00:07:58,370 --> 00:07:59,990
But the test has not got failed.

101
00:08:00,290 --> 00:08:07,000
And if you could see that reason being, it says that should be skipped for the Firefox test.

102
00:08:07,010 --> 00:08:13,640
So this is actually coming from this guy and it is not actually running the Firefox test.

103
00:08:13,640 --> 00:08:16,700
And it says that there is one test being skipped.

104
00:08:16,770 --> 00:08:17,090
Yeah.

105
00:08:17,400 --> 00:08:23,870
So this is happening because our test is actually skipping the Firefox browser.

106
00:08:23,870 --> 00:08:25,440
For me, this is really, really cool.

107
00:08:25,670 --> 00:08:32,840
So with this, you can now get an idea of how that you can work with the skip functionality of the test

108
00:08:32,840 --> 00:08:33,340
itself.

109
00:08:33,650 --> 00:08:38,390
You know, this video will quickly see how we can instead of just commenting this a piece of code,

110
00:08:38,390 --> 00:08:43,370
we can run the test that we are actually looking for, we should be discussing in our next video.
