Commit Graph

29 Commits

Author SHA1 Message Date
Yury Semikhatsky 8699d3b9c5
test(bidi): create inspected page before initializing recorder (#34323) 2025-01-14 14:57:42 -08:00
Pavel Feldman 0e2b984287
chore: prioritize role over label and placeholder (#33970) 2024-12-12 08:21:00 -08:00
Pavel Feldman 4bcf505e19
chore: prefer generating role with text to css with text (#33942) 2024-12-10 16:03:33 -08:00
Dmitry Gozman 21c4531618
fix(selector generator): do not reparent to invisible ancestor (#31590)
Fixes #31335.
2024-07-08 09:07:25 -07:00
Dmitry Gozman 8334191b94
fix(selector generator): properly escape re used in has-text (#30767)
Fixes #30499.
2024-05-13 12:40:46 -07:00
Dmitry Gozman 103ec90751
fix(role): align presentation role conflict resolution with the spec (#30408)
See
https://www.w3.org/TR/wai-aria-1.2/#conflict_resolution_presentation_none

Fixes #26809.
2024-04-18 08:53:31 -07:00
Dmitry Gozman f5de6e5538
feat(codegen): generate multiple selectors to choose from (#29154)
When possible, "pick locator" generates:
- default locator;
- locator without any text;
- locator without css `#id`.

Fixes #27875, fixes #5178.
2024-01-25 07:35:58 -08:00
Dmitry Gozman 8e607d509f
fix(recorder): disallow external imports (#29129)
Previously, new `Recorder` instance was given an existing
`InjectedScript`. However, we built a separate source for
`InjectedScript` vs `Recorder`, and both bundles contain their own copy
of all helper modules, e.g. `roleUtils`.

This resulted in two copies of helper modules, which is troublesome for
any module-level globals like a top-level cache. Depending on whether
`Recorder` or `InjectedScript` called into the helper, they would access
the different value of a module global, which lead to bugs.

To prevent this, we force any external dependencies to be imported
through the `InjectedScript.utils`.
2024-01-23 11:29:40 -08:00
Dmitry Gozman 120f0228c5
feat(selector generator): try improving text candidate with heuristics (#28074)
- Drop number-like prefixes and/or suffixes.
- Trim long texts to a word boundary around 15-25 character.
2023-11-13 11:30:16 -08:00
Dmitry Gozman 5821c547aa
fix(selector generator): use the same label definition as getByLabel (#23846)
This extracts `getElementLabels` helper function to be used both for
generating and querying.
2023-06-22 08:34:08 -07:00
Dmitry Gozman 5b2e8a6a7a
chore: optional root for generateSelector (#23692) 2023-06-13 21:25:39 -07:00
Dmitry Gozman bde2e90973
fix(selector generator): do not produce `has-text="foo"s` (#21679)
There is no locator counterpart for it. Instead, produce a regex.

Also fix locator generator to not produce incorrect locator in this
case.

Fixes #21649.
2023-03-15 13:43:42 -07:00
Pavel Feldman e61a8c6592
fix(generator): penalize for the selector length (#19672) 2022-12-22 20:54:04 -08:00
Pavel Feldman 85467d1b7d
chore: generate get by title (#19119) 2022-11-28 19:55:34 -08:00
Dmitry Gozman a7b2b04588
fix(getByRole): name and exact (#18719)
Following the `getByText()` and other methods:

- By default, matching is substring and case-insensitive. Before, it was
only case-insensitive, but not substring.
- With new option `exact: true`, matching is full string and
case-sensitive.
- Matching always normalizes whitespace.
- Codegen generates `exact: false` by default.
- `internal:role` treats `[name="foo"i]` as non-exact match.

Various fixes:
- Updated `getByRole` docs to match the reality.
- Locator generator edge cases.
2022-11-11 15:58:36 -08:00
Dmitry Gozman cafa558845
fix(codegen): update priorites in selector generator (#18688)
- prefer `role=checkbox` over `input[type=checkbox]`
- prefer `#id` over `input[type=checkbox]` and `role=checkbox`
- prefer `text=foo` over `internal:has-text=foo`
- ignore `none` and `presentation` roles
- remove non-strict support
2022-11-09 17:22:13 -08:00
Pavel Feldman 0355d8618f
chore: use provided value for the generated test id (#18631) 2022-11-08 12:04:43 -08:00
Pavel Feldman 2c3fa1b1ff
chore: add explore locator parser (#18429) 2022-10-31 12:55:35 -07:00
Dmitry Gozman 48c44f2c78
fix(selectors): hasText and getByText exact match should consider full text (#18260)
Fixes #18259.
2022-10-21 16:29:45 -07:00
Pavel Feldman 84daeafb3a
chore: use internal locator for role (#18187) 2022-10-19 19:38:47 -07:00
Pavel Feldman 304a4ee8ec
chore: migrate to the internal:text selector (#18135) 2022-10-18 13:09:54 -07:00
Pavel Feldman ec1f8d17f0
fix(generator): generate nice locators for arbitrary selectors (#18010) 2022-10-11 17:50:41 -07:00
Pavel Feldman c168f5494f
chore: generate getByLabel for inputs (#17845) 2022-10-05 12:02:15 -07:00
Dmitry Gozman 2bcd9ce9ae
chore: internal selectors (#17827)
- Rename internal selectors `has`, `control` and `attr` to
`internal:has`, `internal:control` and `internal:attr`.
- Fix `getByLabel()` to respect strictness, by introducing
`internal:label` selector.
- Move tests essential for ports to `selectors-by.spec`.
2022-10-05 08:45:10 -07:00
Dmitry Gozman a9c02b9753
fix(locators): properly escape various locator methods (#17798)
References #17604.
2022-10-04 13:21:38 -07:00
Pavel Feldman 42a4d8a829
chore(codegen): prioritize role selectors (#17750) 2022-10-03 08:44:24 -07:00
Dmitry Gozman 40bfdb0f4e
fix(codegen): use name attribute for frame elements (#14609) 2022-06-02 21:14:01 -07:00
Yury Semikhatsky aab1a746d3
fix: join individual css selectors by > in cssFallback (#13712) 2022-04-25 11:11:24 -07:00
Pavel Feldman 02cac8a066
chore: group tests under tests/ (1) (#13081) 2022-03-25 16:05:50 -07:00