|
13 | 13 |
|
14 | 14 | namespace Symfony\Component\Panther\Tests;
|
15 | 15 |
|
| 16 | +use Facebook\WebDriver\Exception\ElementClickInterceptedException; |
16 | 17 | use Facebook\WebDriver\Exception\InvalidSelectorException;
|
17 | 18 | use Facebook\WebDriver\Exception\StaleElementReferenceException;
|
18 | 19 | use Facebook\WebDriver\Exception\TimeoutException;
|
@@ -577,4 +578,36 @@ public function testCreateHttpBrowserClientWithInvalidHttpClientOptions(): void
|
577 | 578 | 'http_client_options' => 'bad http client option data type',
|
578 | 579 | ]);
|
579 | 580 | }
|
| 581 | + |
| 582 | + /** |
| 583 | + * @dataProvider providePrefersReducedMotion |
| 584 | + */ |
| 585 | + public function testPrefersReducedMotion(string $browser): void |
| 586 | + { |
| 587 | + $client = self::createPantherClient(['browser' => $browser]); |
| 588 | + $client->request('GET', '/prefers-reduced-motion.html'); |
| 589 | + |
| 590 | + $client->clickLink('Click me!'); |
| 591 | + $this->assertStringEndsWith('#clicked', $client->getCurrentURL()); |
| 592 | + } |
| 593 | + |
| 594 | + /** |
| 595 | + * @dataProvider providePrefersReducedMotion |
| 596 | + */ |
| 597 | + public function testPrefersReducedMotionDisabled(string $browser): void |
| 598 | + { |
| 599 | + $this->expectException(ElementClickInterceptedException::class); |
| 600 | + |
| 601 | + $_SERVER['PANTHER_NO_REDUCED_MOTION'] = true; |
| 602 | + $client = self::createPantherClient(['browser' => $browser]); |
| 603 | + $client->request('GET', '/prefers-reduced-motion.html'); |
| 604 | + |
| 605 | + $client->clickLink('Click me!'); |
| 606 | + } |
| 607 | + |
| 608 | + public function providePrefersReducedMotion(): iterable |
| 609 | + { |
| 610 | + yield 'Chrome' => [PantherTestCase::CHROME]; |
| 611 | + yield 'Firefox' => [PantherTestCase::FIREFOX]; |
| 612 | + } |
580 | 613 | }
|
0 commit comments