Commit Graph

25 Commits

Author SHA1 Message Date
Pavel Feldman
33d62d9a97
chore: do not use relative xpath when querying from document (#24405)
Fixes https://github.com/microsoft/playwright/issues/24399
2023-07-25 12:55:35 -07:00
Dmitry Gozman
97d55e275d
fix(locator): locator(locator) method uses internal:chain instead of >> (#24235)
Usually, we can just chain two locators with `>>` to implement
`Locator.locator(locator)`. However, this does not play nicely with more
advanced inner locators like `or` and `and`:

```ts
const child = page.locator('input').or(page.locator('button'));
page.locator('parent').locator(child);
```

One would expect the above to locate "input or button" inside a
"parent". However, currently it locates "input inside a parent" or
"button", because it's translated to `parent >> input >>
internal:or="button"`.

To fix this, we have to wrap inner locator into `internal:chain` and
query it separately from the parent.

Fixes #23724.
2023-07-14 12:21:45 -07:00
Dmitry Gozman
160888df99
feat(locators): reland locator.and(locator) (#22850)
Removed in #22223.
Fixes #22585.
2023-05-05 11:14:01 -07:00
Dmitry Gozman
08cef43e82
feat(locator): remove locator.and and locator.not (#22223)
Not shipping for now, after API review.
2023-04-05 16:28:13 -07:00
Dmitry Gozman
bc1de5f28d
feat(locator): filter({ hasNot }) (#22219)
This is the opposite of `filter({ has })`.
2023-04-05 12:45:46 -07:00
Dmitry Gozman
e6148bb725
feat: Locator.not(locator) (#22066) 2023-03-30 08:52:30 -07:00
Dmitry Gozman
525097d465
feat: Locator.filter(locator) (#21975)
Produces a locator that matches both locators.
Implemented through `internal:and` selector.

Fixes #19551.
2023-03-27 14:29:30 -07:00
Dmitry Gozman
d10fac4f6a
feat: Locator.or(locator) (#21884) 2023-03-22 15:28:59 -07:00
Dmitry Gozman
821949d580
test: update stale test expectations (#20423) 2023-01-27 21:52:34 -08: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
Max Schmitt
a2fc636f8e
test: unskip working Android tests (#16171) 2022-08-02 22:51:10 +02:00
Max Schmitt
6482ff7a7f
chore: roll Electron to 16.2.8 (#16017) 2022-07-28 15:41:32 +02:00
Dmitry Gozman
f0b3b280a5
test: increase small timeouts to accomodate two workers (#15257) 2022-06-30 09:05:39 -07:00
Dmitry Gozman
0e2855348c
feat(locators): remove layout locators (#14129) 2022-05-12 18:50:19 +01:00
Dmitry Gozman
c3cf7ee4a7
feat(layout locators): remove maxDistance option (#14013) 2022-05-08 07:18:16 +01:00
Dmitry Gozman
54dd6d01e5
feat(locator): layout options (leftOf, rightOf, above, below, near) (#13821)
This also includes corresponding selector engines `left-of` and others,
modeled after existing `has` selector engine.
2022-05-03 10:33:33 +01:00
Dmitry Gozman
38fdc5fe24
fix(selectors): refactor chaining logic (#13764)
This fixes a few issues:
- strict mode was producing false negatives if multiple query paths
  lead to the same element being picked;
- in some cases the number of intermediate items in the list was
  exponential and crashed quickly.

What changed:
- `visible` engine is a real engine now;
- `capture` selectors are transformed to `has=` selectors for
  easier implementation;
- chained querying switched from a list to a set to avoid
  exponential size.
2022-04-27 20:51:57 +01:00
Dmitry Gozman
f587a43932
feat(locator): "has" option (#11411)
This introduces `locator('div', { has: locator })` syntax that matches elements containing other elements.
Can be used together with `hasText`.

Internally, has selector engine takes an inner selector escaped with double-quotes:
`div >> has="li >> span >> text=Foo" >> span`.
2022-02-02 16:55:50 -08:00
Dmitry Gozman
be896848bb
fix(selectors): properly determine visibility of display:contents (#11212) 2022-01-05 16:54:15 -08:00
Pavel Feldman
913c9ab59f
test: add a failing test for #11202 (#11206) 2022-01-05 15:53:53 -08:00
Yury Semikhatsky
c5cb73003f
docs: OR for css and xpath selectors (#10285) 2021-11-15 13:54:12 -08:00
Max Schmitt
cd22072685
chore: enable object-curly-spacing in ESLint (#9168) 2021-09-27 18:58:08 +02:00
Pavel Feldman
1d4e2fe98c
feat(nth): make nth and visible selectors public (#8142) 2021-08-11 11:06:09 -07:00
Dmitry Gozman
217cbe3e21
test: cleanup bad usages of pageTest (#6430) 2021-05-06 07:08:22 -07:00
Dmitry Gozman
9433cae4fe
test: move all page tests to a subdirectory (#6427) 2021-05-05 19:10:28 -07:00