-
-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathLocaleConfigurationTest.php
More file actions
50 lines (35 loc) · 1.33 KB
/
LocaleConfigurationTest.php
File metadata and controls
50 lines (35 loc) · 1.33 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
<?php
declare(strict_types=1);
use Pest\Browser\Configuration;
use Pest\Browser\Playwright\Playwright;
beforeEach(function (): void {
Playwright::setDefaultLocale('en-US');
});
it('can set locale via configuration', function (): void {
$config = new Configuration();
$result = $config->withLocale('fr-FR');
expect($result)->toBeInstanceOf(Configuration::class);
expect(Playwright::defaultLocale())->toBe('fr-FR');
});
it('follows fluent interface pattern', function (): void {
$config = new Configuration();
$result = $config
->withLocale('fr-FR')
->userAgent('Test Agent')
->timeout(10000);
expect($result)->toBeInstanceOf(Configuration::class);
expect(Playwright::defaultLocale())->toBe('fr-FR');
});
it('stores locale in Playwright global state', function (): void {
expect(Playwright::defaultLocale())->toBe('en-US');
Playwright::setDefaultLocale('ja-JP');
expect(Playwright::defaultLocale())->toBe('ja-JP');
});
it('can override locale multiple times', function (): void {
Playwright::setDefaultLocale('fr-FR');
expect(Playwright::defaultLocale())->toBe('fr-FR');
Playwright::setDefaultLocale('de-DE');
expect(Playwright::defaultLocale())->toBe('de-DE');
Playwright::setDefaultLocale('ja-JP');
expect(Playwright::defaultLocale())->toBe('ja-JP');
});