|
80 | 80 |
|
81 | 81 | expect($filteredButtons)->toBeInstanceOf(Locator::class); |
82 | 82 | }); |
| 83 | + |
| 84 | +it('handles non-string hasText in filter options', function (): void { |
| 85 | + $page = page()->goto('/test/element-tests'); |
| 86 | + $buttons = $page->locator('button'); |
| 87 | + |
| 88 | + // Test with non-string hasText (this should be ignored based on the code) |
| 89 | + $filteredButtons = $buttons->filter(['hasText' => 123]); |
| 90 | + |
| 91 | + expect($filteredButtons)->toBeInstanceOf(Locator::class); |
| 92 | +}); |
| 93 | + |
| 94 | +it('handles non-string hasNotText in filter options', function (): void { |
| 95 | + $page = page()->goto('/test/element-tests'); |
| 96 | + $buttons = $page->locator('button'); |
| 97 | + |
| 98 | + // Test with non-string hasNotText (this should be ignored based on the code) |
| 99 | + $filteredButtons = $buttons->filter(['hasNotText' => 123]); |
| 100 | + |
| 101 | + expect($filteredButtons)->toBeInstanceOf(Locator::class); |
| 102 | +}); |
| 103 | + |
| 104 | +it('handles non-locator has in filter options', function (): void { |
| 105 | + $page = page()->goto('/test/element-tests'); |
| 106 | + $buttons = $page->locator('button'); |
| 107 | + |
| 108 | + // Test with non-locator has (this should be ignored based on the code) |
| 109 | + $filteredButtons = $buttons->filter(['has' => 'not-a-locator']); |
| 110 | + |
| 111 | + expect($filteredButtons)->toBeInstanceOf(Locator::class); |
| 112 | +}); |
| 113 | + |
| 114 | +it('handles non-locator hasNot in filter options', function (): void { |
| 115 | + $page = page()->goto('/test/element-tests'); |
| 116 | + $buttons = $page->locator('button'); |
| 117 | + |
| 118 | + // Test with non-locator hasNot (this should be ignored based on the code) |
| 119 | + $filteredButtons = $buttons->filter(['hasNot' => 'not-a-locator']); |
| 120 | + |
| 121 | + expect($filteredButtons)->toBeInstanceOf(Locator::class); |
| 122 | +}); |
0 commit comments