1
00:00:00,150 --> 00:00:05,280
All right, so now we are back once again, and this time we are going to be using our run directory

2
00:00:05,280 --> 00:00:13,530
that we created in our first video where we were trying to execute our test using the playwright test

3
00:00:13,830 --> 00:00:14,450
fixture.

4
00:00:14,850 --> 00:00:18,400
But this time we are going to create our own test fixture and we'll see how it actually works.

5
00:00:18,430 --> 00:00:24,240
So we already know how the folio works and how the fixtures are working fine without any problem, which

6
00:00:24,240 --> 00:00:25,160
is pretty cool.

7
00:00:25,380 --> 00:00:29,550
And now the idea is there and all we are going to do is we're going to create our own.

8
00:00:31,070 --> 00:00:37,070
Fixture, which we can extend and we can see how it actually works, so there are two ways that you

9
00:00:37,070 --> 00:00:38,320
can actually work with the fixer.

10
00:00:38,660 --> 00:00:44,150
One is in line fixer or maybe the fixer, which is available within the same file where the tests exist,

11
00:00:44,420 --> 00:00:48,580
or the fixer, which is available on an external file.

12
00:00:48,890 --> 00:00:54,530
So there is no specific naming convention available on the playwright at the moment, on the documentation

13
00:00:54,740 --> 00:00:55,700
or by the team.

14
00:00:55,700 --> 00:00:58,610
They have given it, but it is pretty useful.

15
00:00:58,640 --> 00:01:02,320
I mean, I really like the fact that you can write fiction in two different places.

16
00:01:02,330 --> 00:01:06,680
One is on a separate file or you can write in the same file itself if we want to.

17
00:01:07,010 --> 00:01:13,950
So we can probably see the one test that is going to be sitting within this particular test file.

18
00:01:13,970 --> 00:01:15,440
I mean, the fixer within the test file.

19
00:01:15,530 --> 00:01:20,870
And then we'll see how we can write a fixer on an external file and how we can run that.

20
00:01:21,200 --> 00:01:23,180
So the first thing is, I'm going to do this.

21
00:01:23,180 --> 00:01:28,190
I'm just going to run a in line test.

22
00:01:29,820 --> 00:01:38,550
Fixture darts back dot the yes, so this particular test is going to be holding the fixture within this

23
00:01:38,550 --> 00:01:42,570
particular file itself and then we'll see how it actually works.

24
00:01:44,490 --> 00:01:50,670
So the first thing was going to do once again is going to be the import and I'm just going to do from

25
00:01:51,600 --> 00:01:53,910
and I'm just going to specify the plate, right.

26
00:01:54,180 --> 00:02:00,150
And then I'm just going to do and extending of the fixtures.

27
00:02:00,180 --> 00:02:03,980
So, again, same color like how we discussed in our video.

28
00:02:04,260 --> 00:02:08,930
So I probably need to extend the folio this time.

29
00:02:09,540 --> 00:02:14,230
So I need the folio variable and folio dot extend.

30
00:02:14,250 --> 00:02:19,890
So this is something which we know already and we are going to be extending the tape which is available

31
00:02:19,890 --> 00:02:20,730
within the playwright.

32
00:02:20,730 --> 00:02:27,120
So we don't really have to specify that type, like how we did not earlier video while we created our

33
00:02:27,120 --> 00:02:28,560
own fixture.

34
00:02:29,220 --> 00:02:35,640
So this is perfect for now and now I'm actually going to run the test and we'll see how it actually

35
00:02:35,640 --> 00:02:36,030
works.

36
00:02:36,300 --> 00:02:45,210
So I'm just going to do and fixture Dot pulled over here so you can now be wondering, like what the

37
00:02:45,210 --> 00:02:46,710
heck I'm doing at the moment.

38
00:02:46,920 --> 00:02:48,360
So just don't worry about it yet.

39
00:02:48,360 --> 00:02:52,020
I'm just trying to do a build there.

40
00:02:52,020 --> 00:02:56,760
I'm just going to specify the concept of, like, whatever things that we saw before.

41
00:02:57,120 --> 00:02:59,720
I can just do all those things over here.

42
00:02:59,910 --> 00:03:02,690
Yeah, pretty much done.

43
00:03:02,910 --> 00:03:05,430
So you can see that I have not extended anything at the moment.

44
00:03:05,430 --> 00:03:11,210
So there is no extension cord and you will understand why I can really do an extension in a minute.

45
00:03:11,400 --> 00:03:17,830
So this is the extend extending cord exist here or something like that.

46
00:03:18,090 --> 00:03:21,450
So this is exactly what is available in the documentation as well if you go and see there.

47
00:03:21,720 --> 00:03:27,640
But I just want to make it a case while you understand why I really need to do this and why the documentation

48
00:03:27,640 --> 00:03:38,370
to tells all those details run the the my got I run the basic test of Neo when something like that.

49
00:03:40,290 --> 00:03:50,460
And I'm just going to specify the context when I'll close this thing and I'll write this code pretty

50
00:03:50,460 --> 00:03:52,980
much like we did earlier in our course.

51
00:03:53,160 --> 00:03:56,520
And let's also make this sink because this isn't.

52
00:03:56,520 --> 00:03:57,000
Oh wait.

53
00:03:57,120 --> 00:03:59,040
Yeah, there we go.

54
00:03:59,280 --> 00:04:02,800
And now let me try to run this particular test and show you what basically happens.

55
00:04:02,800 --> 00:04:14,190
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

56
00:04:14,190 --> 00:04:16,890
tell which filename, because now we have two files.

57
00:04:17,190 --> 00:04:20,530
So I have to specify which file name that I need to execute this particular test.

58
00:04:21,000 --> 00:04:27,300
So now if I tried to execute this test, you can see that it is going to open and run on three different

59
00:04:27,300 --> 00:04:31,670
browsers and it's also going to run the test on a headless mode.

60
00:04:32,010 --> 00:04:39,190
So this is very, very bad because if they want to run the same test like one time, then you need to

61
00:04:39,210 --> 00:04:46,920
either pass it on the parameter on the on the command line over here like Pyramus, or you need to somehow

62
00:04:46,920 --> 00:04:48,560
control it for your test.

63
00:04:48,780 --> 00:04:54,390
So the way that you can control it in the test is what is the fixture and that's how you can extend

64
00:04:54,390 --> 00:04:55,700
that and you can do that.

65
00:04:56,100 --> 00:05:00,600
So in order for doing that, that's when this particular fixture comes into picture.

66
00:05:00,600 --> 00:05:02,510
And it's very, very handy, as I told you.

67
00:05:02,880 --> 00:05:09,000
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

68
00:05:09,000 --> 00:05:14,280
have to specify, like the parameter name, like Headful or something like that.

69
00:05:14,490 --> 00:05:17,880
Rather, this time what I'm going to do is I'm just going to do this.

70
00:05:17,880 --> 00:05:23,670
Fixtures dart browser options override that.

71
00:05:23,670 --> 00:05:32,110
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

72
00:05:32,160 --> 00:05:36,840
to do a run something like this.

73
00:05:37,350 --> 00:05:38,130
Sorry about that.

74
00:05:38,250 --> 00:05:38,880
The braces.

75
00:05:39,150 --> 00:05:44,250
And then I'm actually going to do an operation here.

76
00:05:44,250 --> 00:05:49,980
So I'm just going to do like this, a vade, pretty much like how we did in our earlier video.

77
00:05:50,070 --> 00:05:54,240
So I'm just going to set the run and here comes the launch option.

78
00:05:54,240 --> 00:05:57,450
So you can see that it automatically tells me that there is a launch option.

79
00:05:57,460 --> 00:06:00,040
So what does this launch option and where is this coming from?

80
00:06:00,450 --> 00:06:06,060
So if you go to the browser options over here, this is basically a launch option type.

81
00:06:06,360 --> 00:06:12,960
And if I go to the launch option type, you can see that it has many different modes that you can set

82
00:06:12,960 --> 00:06:20,220
basically like headless mode, executable pod arguments and proxy ignore default args.

83
00:06:20,220 --> 00:06:27,660
And so all the stuffs download a pod, chrome, chromium sandbox and all those things so we can set

84
00:06:27,660 --> 00:06:34,170
a many different things, even the demo tools and slowmo everything comes in over here and we can set

85
00:06:34,170 --> 00:06:35,810
it for our test run.

86
00:06:36,030 --> 00:06:37,420
So this is what it is.

87
00:06:37,450 --> 00:06:39,780
Guys, this is what I was about to do right now.

88
00:06:40,020 --> 00:06:43,070
So I am going to set a.

89
00:06:43,470 --> 00:06:46,640
Variable here, something like and headless.

90
00:06:46,670 --> 00:06:51,340
I can see that it automatically comes in and I'm going to set the headless asphalt.

91
00:06:51,350 --> 00:06:54,900
So by default, it is true and this time I'm going to be sitting as false.

92
00:06:55,320 --> 00:07:02,570
And now if I try to run this particular test, this should open a browser for me.

93
00:07:02,580 --> 00:07:05,450
You can see that it is actually opening a browser on a different window.

94
00:07:05,460 --> 00:07:12,630
For me, there are three different tests or here are three different browsers and running the test on

95
00:07:12,660 --> 00:07:14,160
all these different browsers.

96
00:07:14,940 --> 00:07:18,750
And you can see that one of the tests somehow got failed.

97
00:07:18,990 --> 00:07:19,410
All right.

98
00:07:21,060 --> 00:07:25,450
And I want to ask, so just one test got passed on to discard fail, which is all right.

99
00:07:25,470 --> 00:07:27,750
I mean, if you don't need a second time, it should be passing.

100
00:07:27,780 --> 00:07:29,050
But you got the idea, right.

101
00:07:29,070 --> 00:07:32,520
So this is how you can set the headless Moedas Falls.

102
00:07:32,730 --> 00:07:40,110
And then if you want to do a slow motion, you can set the slowmo as well, like in milliseconds if

103
00:07:40,110 --> 00:07:40,710
you want to.

104
00:07:41,490 --> 00:07:43,260
You can do all those kind of things.

105
00:07:43,260 --> 00:07:48,180
And if you want to set the dev tool as true, you can do that as well.

106
00:07:48,210 --> 00:07:53,220
So it's going to open the door tools for all these three different browser that it's going to be executing

107
00:07:53,220 --> 00:07:53,970
the test for us.

108
00:07:54,390 --> 00:07:55,830
And then it just opens up.

109
00:07:56,250 --> 00:08:02,550
You can see that it is opening up the dev tools for the chrome and the there is no doubt one thing.

110
00:08:03,510 --> 00:08:06,810
And it's also opening the Firefox and.

111
00:08:07,900 --> 00:08:14,500
You can see that it just opened everything over there pretty cool, so this is how we can actually extend

112
00:08:14,650 --> 00:08:15,190
our.

113
00:08:16,900 --> 00:08:22,510
Behavior using the fixtures of the test, and it was found that any problem, no next video, we'll

114
00:08:22,510 --> 00:08:28,420
see how we can even extend further with not just the browser options, but also with the context options

115
00:08:28,420 --> 00:08:33,630
for the different device, scalability on the screen, and we'll see how it actually works.
