|
2 | 2 |
|
3 | 3 | declare(strict_types=1); |
4 | 4 |
|
5 | | -use Pest\Browser\Playwright\Element; |
6 | 5 | use Pest\Browser\Playwright\Locator; |
7 | 6 | use Pest\Browser\Playwright\Page; |
8 | 7 | use Pest\Expectation; |
|
20 | 19 |
|
21 | 20 | expect()->extend('toBeChecked', function (): Expectation { |
22 | 21 |
|
23 | | - if (! $this->value instanceof Element && ! $this->value instanceof Locator) { |
24 | | - throw new InvalidArgumentException('Expected value to be an Element or Locator instance'); |
| 22 | + if (! $this->value instanceof Locator) { |
| 23 | + throw new InvalidArgumentException('Expected value to be a Locator instance'); |
25 | 24 | } |
26 | 25 |
|
27 | 26 | expect($this->value->isChecked())->toBeTrue(); |
|
31 | 30 |
|
32 | 31 | expect()->extend('toBeVisible', function (): Expectation { |
33 | 32 |
|
34 | | - if (! $this->value instanceof Element && ! $this->value instanceof Locator) { |
35 | | - throw new InvalidArgumentException('Expected value to be an Element or Locator instance'); |
| 33 | + if (! $this->value instanceof Locator) { |
| 34 | + throw new InvalidArgumentException('Expected value to be a Locator instance'); |
36 | 35 | } |
37 | 36 |
|
38 | 37 | expect($this->value->isVisible())->toBeTrue(); |
|
42 | 41 |
|
43 | 42 | expect()->extend('toBeEnabled', function (): Expectation { |
44 | 43 |
|
45 | | - if (! $this->value instanceof Element && ! $this->value instanceof Locator) { |
46 | | - throw new InvalidArgumentException('Expected value to be an Element or Locator instance'); |
| 44 | + if (! $this->value instanceof Locator) { |
| 45 | + throw new InvalidArgumentException('Expected value to be a Locator instance'); |
47 | 46 | } |
48 | 47 |
|
49 | 48 | expect($this->value->isEnabled())->toBeTrue(); |
|
53 | 52 |
|
54 | 53 | expect()->extend('toBeDisabled', function (): Expectation { |
55 | 54 |
|
56 | | - if (! $this->value instanceof Element && ! $this->value instanceof Locator) { |
57 | | - throw new InvalidArgumentException('Expected value to be an Element or Locator instance'); |
| 55 | + if (! $this->value instanceof Locator) { |
| 56 | + throw new InvalidArgumentException('Expected value to be a Locator instance'); |
58 | 57 | } |
59 | 58 |
|
60 | 59 | expect($this->value->isDisabled())->toBeTrue(); |
|
64 | 63 |
|
65 | 64 | expect()->extend('toBeEditable', function (): Expectation { |
66 | 65 |
|
67 | | - if (! $this->value instanceof Element && ! $this->value instanceof Locator) { |
68 | | - throw new InvalidArgumentException('Expected value to be an Element or Locator instance'); |
| 66 | + if (! $this->value instanceof Locator) { |
| 67 | + throw new InvalidArgumentException('Expected value to be a Locator instance'); |
69 | 68 | } |
70 | 69 |
|
71 | 70 | expect($this->value->isEditable())->toBeTrue(); |
|
75 | 74 |
|
76 | 75 | expect()->extend('toBeHidden', function (): Expectation { |
77 | 76 |
|
78 | | - if (! $this->value instanceof Element && ! $this->value instanceof Locator) { |
79 | | - throw new InvalidArgumentException('Expected value to be an Element or Locator instance'); |
| 77 | + if (! $this->value instanceof Locator) { |
| 78 | + throw new InvalidArgumentException('Expected value to be a Locator instance'); |
80 | 79 | } |
81 | 80 |
|
82 | 81 | expect($this->value->isHidden())->toBeTrue(); |
|
0 commit comments