-
-
Notifications
You must be signed in to change notification settings - Fork 104
Expand file tree
/
Copy pathConfiguration.php
More file actions
130 lines (105 loc) · 2.36 KB
/
Configuration.php
File metadata and controls
130 lines (105 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
declare(strict_types=1);
namespace Pest\Browser;
use Pest\Browser\Contracts\HttpServer;
use Pest\Browser\Enums\BrowserType;
use Pest\Browser\Enums\ColorScheme;
use Pest\Browser\Playwright\Playwright;
/**
* @internal
*
* @codeCoverageIgnore
*/
final readonly class Configuration
{
/**
* Defaults the browser to Chrome.
*/
public function inChrome(): self
{
Playwright::setDefaultBrowserType(BrowserType::CHROME);
return $this;
}
/**
* Defaults the browser to Firefox.
*/
public function inFirefox(): self
{
Playwright::setDefaultBrowserType(BrowserType::FIREFOX);
return $this;
}
/**
* Defaults the browser to Safari.
*/
public function inSafari(): self
{
Playwright::setDefaultBrowserType(BrowserType::SAFARI);
return $this;
}
/**
* Sets the theme to light mode.
*/
public function inLightMode(): self
{
Playwright::setColorScheme(ColorScheme::LIGHT);
return $this;
}
/**
* Sets the theme to dark mode.
*/
public function inDarkMode(): self
{
Playwright::setColorScheme(ColorScheme::DARK);
return $this;
}
/**
* Sets the assertion's timeout in milliseconds.
*/
public function timeout(int $milliseconds): self
{
Playwright::setTimeout($milliseconds);
return $this;
}
/**
* Uses playwright in headed mode.
*/
public function headed(): self
{
Playwright::headed();
return $this;
}
/**
* Sets the browsers userAgent.
*/
public function userAgent(string $userAgent): self
{
Playwright::setUserAgent($userAgent);
return $this;
}
/**
* Enables debug mode for assertions.
*/
public function debug(): self
{
Playwright::setShouldDebugAssertions();
return $this;
}
/**
* Enables diff mode for screenshot assertions.
*/
public function diff(): self
{
Playwright::setShouldDiffOnScreenshotAssertions();
return $this;
}
/**
* Sets the browsers http server class.
*
* @param class-string<HttpServer> $class
*/
public function httpServer(string $class): self
{
ServerManager::setHttpServerClass($class);
return $this;
}
}