Commit Graph

37 Commits

Author SHA1 Message Date
Dmitry Gozman
bb4268d165
fix(locators): do not escape regular expressions with u or v flag (#27188)
Fixes #27163.
2023-09-19 13:16:50 -07:00
Dmitry Gozman
d9eabda09d
fix(locators): escape quotes in regular expressions (#27002)
Fixes #26974.
2023-09-11 15:49:04 -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
fe5c9dad4d
fix(locators): allow identical frameLocators inside and/or/has (#23740)
So, the following will work:

```
page.frameLocator('iframe').locator('span').or(page.frameLoactor('iframe').locator('div'))
```

The following will not work, because frame locators are not exactly the
same:

```
page.frameLocator('#iframe1').locator('span').or(page.frameLoactor('#iframe2').locator('div'))
```

Also improve the error message to be more readable and include the
locator.

Fixes #23697.
2023-06-19 15:22:26 -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
35afb056ea
feat(locator): filter({ hasNotText }) (#22222)
The opposite of `filter({ hasText })`.
2023-04-05 14:13:28 -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
539d9873c2
feat: rename Locator.filter(locator) to Locator.and (#22101) 2023-03-30 14:41:30 -07:00
Dmitry Gozman
e6148bb725
feat: Locator.not(locator) (#22066) 2023-03-30 08:52:30 -07:00
Pavel Feldman
968abd27d5
chore: do not use attributes for trace target annotation (#22075)
Fixes: https://github.com/microsoft/playwright/issues/22004
2023-03-29 23:17:17 -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
Pavel Feldman
c45d8749b0
chore: split trace events into phases (#21696) 2023-03-15 22:33:40 -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
b4ee84fb0c
chore(api): remove locator.get() (#17709) 2022-09-29 12:50:52 -07:00
Pavel Feldman
d9a28bd244
feat(api): introduce get/getByText/getByRole (#17577) 2022-09-27 16:13:56 -07:00
Yury Semikhatsky
cb81d23ad6
fix(selectors): max hasText regex against nested nodes (#15638) 2022-07-14 08:23:11 -07:00
Yury Semikhatsky
87531289e2
test: case insensitive regex in hasText (#15540) 2022-07-11 14:24:08 -07:00
Dmitry Gozman
0e2855348c
feat(locators): remove layout locators (#14129) 2022-05-12 18:50:19 +01:00
Dmitry Gozman
6931d89eaf
feat(locators): rename locator.that to locator.filter (#14025) 2022-05-08 21:59:40 +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
97750ccf9a
feat: locator.that (#13731)
Filters existing locator by options, currently `has` and `hasText`.
2022-04-25 20:06:18 +01:00
Max Schmitt
90e76f9adb
test: rename #smoke to @smoke as test tags (#12652) 2022-03-10 19:42:52 +01:00
Dmitry Gozman
af4944388f
test: skip "should support has:locator" on tracing bots (#11876) 2022-02-04 15:34:33 -08: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
Andrey Lushnikov
b6c2b32b53
test: introduce #smoke tests (#11135)
This patch introduces 109 "#smoke" tests - a subset of tests that makes
sure that basic Playwright functionality works. This set is loosely
defined; feel free to add/remove tests to the set. The only goal is to
keep this set minimal & fast to run.

I tried to pick tests so that various parts of Playwright functionality
are exercised.
2021-12-29 18:51:28 -08:00
Pavel Feldman
04e82ce71c
feat(api): make withText an option (#10922) 2021-12-14 15:37:31 -08:00
Max Schmitt
fdb633dc8b
fix: support regexp flags with locator.withText() (#10779) 2021-12-07 19:33:04 -08:00
Pavel Feldman
f583f1604c
feat(locator.withText): allow narrowing locators to those with text (#10688) 2021-12-03 09:27:06 -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
Pavel Feldman
3187ffdebf
feat(expect): add more matchers (#7891) 2021-07-28 15:44:44 -07:00
Pavel Feldman
cc43f9339f
feat(locators): implement last,nth (#7870) 2021-07-27 15:58:18 -07:00
Pavel Feldman
b9aad5eb86
chore: move locators to strict selectors (#7866) 2021-07-27 15:27:36 -07:00