|
8 | 8 | it('returns correct selector without exact match', function (): void { |
9 | 9 | $selector = Selector::getByAttributeTextSelector('data-test', 'example', false); |
10 | 10 |
|
11 | | - expect($selector)->toBe('attr=[data-test="example"i]'); |
12 | | - }); |
13 | | - |
14 | | - it('returns correct selector with exact match', function (): void { |
| 11 | + expect($selector)->toBe('internal:attr=[data-test="example"i]'); |
| 12 | + }); it('returns correct selector with exact match', function (): void { |
15 | 13 | $selector = Selector::getByAttributeTextSelector('data-test', 'example', true); |
16 | 14 |
|
17 | | - expect($selector)->toBe('attr=[data-test="example"]'); |
18 | | - }); |
19 | | - |
20 | | - it('escapes special characters in attribute values', function (): void { |
| 15 | + expect($selector)->toBe('internal:attr=[data-test="example"]'); |
| 16 | + }); it('escapes special characters in attribute values', function (): void { |
21 | 17 | $selector = Selector::getByAttributeTextSelector('data-test', 'example "quoted" text', false); |
22 | 18 |
|
23 | | - expect($selector)->toBe('attr=[data-test="example \"quoted\" text"i]'); |
24 | | - }); |
25 | | - |
26 | | - it('escapes backslashes in attribute values', function (): void { |
| 19 | + expect($selector)->toBe('internal:attr=[data-test="example \"quoted\" text"i]'); |
| 20 | + }); it('escapes backslashes in attribute values', function (): void { |
27 | 21 | $selector = Selector::getByAttributeTextSelector('data-test', 'example\\path', false); |
28 | 22 |
|
29 | | - expect($selector)->toBe('attr=[data-test="example\\\\path"i]'); |
| 23 | + expect($selector)->toBe('internal:attr=[data-test="example\\\\path"i]'); |
30 | 24 | }); |
31 | 25 | }); |
32 | 26 |
|
33 | | -describe('getByTestIdSelector', function (): void { |
34 | | - it('returns correct selector for test ID', function (): void { |
| 27 | +describe('getByTestIdSelector', function (): void { it('returns correct selector for test ID', function (): void { |
35 | 28 | $selector = Selector::getByTestIdSelector('data-testid', 'login-button'); |
36 | 29 |
|
37 | | - expect($selector)->toBe('testid=[data-testid="login-button"]'); |
38 | | - }); |
39 | | - |
40 | | - it('escapes special characters in test ID', function (): void { |
| 30 | + expect($selector)->toBe('internal:testid=[data-testid="login-button"]'); |
| 31 | + }); it('escapes special characters in test ID', function (): void { |
41 | 32 | $selector = Selector::getByTestIdSelector('data-testid', 'button"with"quotes'); |
42 | 33 |
|
43 | | - expect($selector)->toBe('testid=[data-testid="button\"with\"quotes"]'); |
| 34 | + expect($selector)->toBe('internal:testid=[data-testid="button\"with\"quotes"]'); |
44 | 35 | }); |
45 | 36 | }); |
46 | 37 |
|
47 | | -describe('getByLabelSelector', function (): void { |
48 | | - it('returns correct selector without exact match', function (): void { |
| 38 | +describe('getByLabelSelector', function (): void { it('returns correct selector without exact match', function (): void { |
49 | 39 | $selector = Selector::getByLabelSelector('Email address', false); |
50 | 40 |
|
51 | | - expect($selector)->toBe('label="Email address"i'); |
52 | | - }); |
53 | | - |
54 | | - it('returns correct selector with exact match', function (): void { |
| 41 | + expect($selector)->toBe('internal:label="Email address"i'); |
| 42 | + }); it('returns correct selector with exact match', function (): void { |
55 | 43 | $selector = Selector::getByLabelSelector('Email address', true); |
56 | 44 |
|
57 | | - expect($selector)->toBe('label="Email address"s'); |
| 45 | + expect($selector)->toBe('internal:label="Email address"s'); |
58 | 46 | }); |
59 | 47 | }); |
60 | 48 |
|
61 | 49 | describe('getByAltTextSelector', function (): void { |
62 | 50 | it('returns correct selector without exact match', function (): void { |
63 | 51 | $selector = Selector::getByAltTextSelector('Logo image', false); |
64 | 52 |
|
65 | | - expect($selector)->toBe('attr=[alt="Logo image"i]'); |
| 53 | + expect($selector)->toBe('internal:attr=[alt="Logo image"i]'); |
66 | 54 | }); |
67 | 55 |
|
68 | 56 | it('returns correct selector with exact match', function (): void { |
69 | 57 | $selector = Selector::getByAltTextSelector('Logo image', true); |
70 | 58 |
|
71 | | - expect($selector)->toBe('attr=[alt="Logo image"]'); |
| 59 | + expect($selector)->toBe('internal:attr=[alt="Logo image"]'); |
72 | 60 | }); |
73 | 61 | }); |
74 | 62 |
|
75 | 63 | describe('getByTitleSelector', function (): void { |
76 | 64 | it('returns correct selector without exact match', function (): void { |
77 | 65 | $selector = Selector::getByTitleSelector('Information', false); |
78 | 66 |
|
79 | | - expect($selector)->toBe('attr=[title="Information"i]'); |
| 67 | + expect($selector)->toBe('internal:attr=[title="Information"i]'); |
80 | 68 | }); |
81 | 69 |
|
82 | 70 | it('returns correct selector with exact match', function (): void { |
83 | 71 | $selector = Selector::getByTitleSelector('Information', true); |
84 | 72 |
|
85 | | - expect($selector)->toBe('attr=[title="Information"]'); |
| 73 | + expect($selector)->toBe('internal:attr=[title="Information"]'); |
86 | 74 | }); |
87 | 75 | }); |
88 | 76 |
|
89 | 77 | describe('getByPlaceholderSelector', function (): void { |
90 | 78 | it('returns correct selector without exact match', function (): void { |
91 | 79 | $selector = Selector::getByPlaceholderSelector('Search...', false); |
92 | 80 |
|
93 | | - expect($selector)->toBe('attr=[placeholder="Search..."i]'); |
| 81 | + expect($selector)->toBe('internal:attr=[placeholder="Search..."i]'); |
94 | 82 | }); |
95 | 83 |
|
96 | 84 | it('returns correct selector with exact match', function (): void { |
97 | 85 | $selector = Selector::getByPlaceholderSelector('Search...', true); |
98 | 86 |
|
99 | | - expect($selector)->toBe('attr=[placeholder="Search..."]'); |
| 87 | + expect($selector)->toBe('internal:attr=[placeholder="Search..."]'); |
100 | 88 | }); |
101 | 89 | }); |
102 | 90 |
|
103 | 91 | describe('getByTextSelector', function (): void { |
104 | 92 | it('returns correct selector without exact match', function (): void { |
105 | 93 | $selector = Selector::getByTextSelector('Submit form', false); |
106 | 94 |
|
107 | | - expect($selector)->toBe('text="Submit form"i'); |
| 95 | + expect($selector)->toBe('internal:text="Submit form"i'); |
108 | 96 | }); |
109 | 97 |
|
110 | 98 | it('returns correct selector with exact match', function (): void { |
111 | 99 | $selector = Selector::getByTextSelector('Submit form', true); |
112 | 100 |
|
113 | | - expect($selector)->toBe('text="Submit form"s'); |
| 101 | + expect($selector)->toBe('internal:text="Submit form"s'); |
114 | 102 | }); |
115 | 103 | }); |
116 | 104 |
|
|
178 | 166 | it('returns basic role selector without options', function (): void { |
179 | 167 | $selector = Selector::getByRoleSelector('button'); |
180 | 168 |
|
181 | | - expect($selector)->toBe('role=button'); |
| 169 | + expect($selector)->toBe('internal:role=button'); |
182 | 170 | }); |
183 | 171 |
|
184 | 172 | it('handles boolean options correctly', function (): void { |
|
187 | 175 | 'disabled' => false, |
188 | 176 | ]); |
189 | 177 |
|
190 | | - expect($selector)->toBe('role=checkbox[checked=true][disabled=false]'); |
191 | | - }); |
192 | | - |
193 | | - it('handles name option without exact flag', function (): void { |
| 178 | + expect($selector)->toBe('internal:role=checkbox[checked=true][disabled=false]'); |
| 179 | + }); it('handles name option without exact flag', function (): void { |
194 | 180 | $selector = Selector::getByRoleSelector('button', [ |
195 | 181 | 'name' => 'Submit form', |
196 | 182 | ]); |
197 | 183 |
|
198 | | - expect($selector)->toBe('role=button[name="Submit form"i]'); |
| 184 | + expect($selector)->toBe('internal:role=button[name="Submit form"i]'); |
199 | 185 | }); |
200 | 186 |
|
201 | 187 | it('handles name option with exact flag', function (): void { |
|
204 | 190 | 'exact' => true, |
205 | 191 | ]); |
206 | 192 |
|
207 | | - expect($selector)->toBe('role=button[name="Submit form"]'); |
208 | | - }); |
209 | | - |
210 | | - it('handles all possible options', function (): void { |
| 193 | + expect($selector)->toBe('internal:role=button[name="Submit form"]'); |
| 194 | + }); it('handles all possible options', function (): void { |
211 | 195 | $selector = Selector::getByRoleSelector('combobox', [ |
212 | 196 | 'checked' => true, |
213 | 197 | 'disabled' => false, |
|
219 | 203 | 'pressed' => false, |
220 | 204 | ]); |
221 | 205 |
|
222 | | - expect($selector)->toBe('role=combobox[checked=true][disabled=false][selected=true][expanded=true][include-hidden=false][level=2][name="Country selector"i][pressed=false]'); |
223 | | - }); |
224 | | - |
225 | | - it('escapes special characters in name option', function (): void { |
| 206 | + expect($selector)->toBe('internal:role=combobox[checked=true][disabled=false][selected=true][expanded=true][include-hidden=false][level=2][name="Country selector"i][pressed=false]'); |
| 207 | + }); it('escapes special characters in name option', function (): void { |
226 | 208 | $selector = Selector::getByRoleSelector('button', [ |
227 | 209 | 'name' => 'Button "with" quotes\\backslashes', |
228 | 210 | ]); |
229 | 211 |
|
230 | | - expect($selector)->toBe('role=button[name="Button \"with\" quotes\\\\backslashes"i]'); |
| 212 | + expect($selector)->toBe('internal:role=button[name="Button \"with\" quotes\\\\backslashes"i]'); |
231 | 213 | }); |
232 | 214 | }); |
0 commit comments