Skip to content

Commit e7d9d6a

Browse files
authored
Merge branch 'main' into zjh-cypress-load-balancer
2 parents 58127f5 + 59615cc commit e7d9d6a

File tree

10 files changed

+145
-427
lines changed

10 files changed

+145
-427
lines changed

docs/api/cypress-api/element-selector-api.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: 'Cypress.ElementSelector | Cypress Documentation'
3-
description: 'Customize how Cypress chooses selectors in Studio and Selector Playground by setting your preferred selector strategy.'
3+
description: 'Customize how Cypress chooses selectors in Studio and cy.prompt() by setting your preferred selector strategy.'
44
sidebar_label: ElementSelector
55
sidebar_position: 105
66
---
@@ -9,7 +9,7 @@ sidebar_position: 105
99

1010
# Cypress.ElementSelector
1111

12-
The ElementSelector API lets you define how Cypress selects elements in tools like [Cypress Studio](/app/guides/cypress-studio) and the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground) (which will be replaced by Cypress Studio once it is no longer experimental).
12+
The ElementSelector API lets you define how Cypress selects elements in tools like [Cypress Studio](/app/guides/cypress-studio) and [cy.prompt()](/api/commands/prompt).
1313

1414
By setting your own selector strategy, you can control which attributes Cypress prioritizes (like `data-*`, `id`, or `aria-label`) when generating selectors. This helps you enforce consistency, improve test readability, and make generated tests more resilient to changes in your HTML.
1515

@@ -72,7 +72,7 @@ The [jQuery element](http://api.jquery.com/Types/#jQuery) for which you want to
7272

7373
### Set custom selector priority
7474

75-
You can customize how Cypress generates selectors by defining a priority order for which attributes to prefer. This affects the selectors you see in tools like [Cypress Studio](/app/guides/cypress-studio) and the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground) (which will be replaced by Cypress Studio once it is no longer experimental).
75+
You can customize how Cypress generates selectors by defining a priority order for which attributes to prefer. This affects the selectors you see in tools like [Cypress Studio](/app/guides/cypress-studio) and [cy.prompt()](/api/commands/prompt)
7676

7777
For example, this config tells Cypress to prefer semantic and accessibility attributes before falling back to styling details like class names.
7878

@@ -158,4 +158,4 @@ Cypress.ElementSelector.defaults({
158158
## See also
159159

160160
- [Cypress Studio](/app/guides/cypress-studio)
161-
- [Selector Playground](/app/core-concepts/open-mode#Selector-Playground)
161+
- [cy.prompt()](/api/commands/prompt)

docs/api/table-of-contents.mdx

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -191,29 +191,29 @@ The _key_ difference between Cypress APIs and Cypress commands is that Cypress
191191
APIs execute the moment they are invoked and are **not** enqueued to run at a
192192
later time.
193193

194-
| Property | Usage |
195-
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
196-
| [`Cypress.arch`](/api/cypress-api/arch) | CPU architecture name of the underlying OS, as returned from Node's `os.arch()`. |
197-
| [`Cypress.browser`](/api/cypress-api/browser) | Information about the current browser, such as browser family and version. |
198-
| [`Cypress.Commands`](/api/cypress-api/custom-commands) | Create new custom commands and extend or override existing ones. |
199-
| [`Cypress.config()`](/api/cypress-api/config) | Get and set Cypress configuration from inside your tests. |
200-
| [`Cypress.Cookies.debug()`](/api/cypress-api/cookies) | Generate console logs whenever a cookie is modified. |
201-
| [`Cypress.currentRetry`](/api/cypress-api/currentretry) | A number representing the current test retry count. |
202-
| [`Cypress.currentTest`](/api/cypress-api/currenttest) | An object with information about the currently executing test. |
203-
| [`Cypress.log`](/api/cypress-api/cypress-log) | This is the internal API for controlling what gets printed to the Command Log. Useful when writing your own custom commands. |
204-
| [`Cypress.dom`](/api/cypress-api/dom) | A collection of DOM related helper methods. |
205-
| [`Cypress.ElementSelector`](/api/cypress-api/element-selector-api) | Configure selector priority used by [Cypress Studio](/app/guides/cypress-studio) and [Selector Playground](/app/core-concepts/open-mode#Selector-Playground). |
206-
| [`Cypress.env`](/api/cypress-api/env) | Get environment variables from inside your tests. |
207-
| [`Cypress.isBrowser()`](/api/cypress-api/isbrowser) | Checks if the current browser matches the given name or filter. |
208-
| [`Cypress.isCy()`](/api/cypress-api/iscy) | checks if a variable is a valid instance of cy or a cy chainable. |
209-
| [`Cypress.Keyboard.defaults()`](/api/cypress-api/keyboard-api) | Set default values for how the `.type()` command is executed. |
210-
| [`Cypress.platform`](/api/cypress-api/platform) | The underlaying OS name, as returned by Node's `os.platform()`. |
211-
| [`Cypress.require`](/api/cypress-api/require) | Enables utilizing dependencies within the [cy.origin()](/api/commands/origin) callback function. |
212-
| [`Cypress.Screenshot.defaults()`](/api/cypress-api/screenshot-api) | Set defaults for screenshots captured by the `.screenshot()` command and the automatic screenshots taken during test failures. |
213-
| [`Cypress.session`](/api/cypress-api/session) | A collection of helper methods related to the `.session()` command. |
214-
| [`Cypress.spec`](/api/cypress-api/spec) | An object with information about the currently executing spec file. |
215-
| [`Cypress.testingType`](/api/cypress-api/testing-type) | The current testing type, eg. `"e2e"` or `"component". |
216-
| [`Cypress.version`](/api/cypress-api/version) | The current Cypress version. |
194+
| Property | Usage |
195+
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
196+
| [`Cypress.arch`](/api/cypress-api/arch) | CPU architecture name of the underlying OS, as returned from Node's `os.arch()`. |
197+
| [`Cypress.browser`](/api/cypress-api/browser) | Information about the current browser, such as browser family and version. |
198+
| [`Cypress.Commands`](/api/cypress-api/custom-commands) | Create new custom commands and extend or override existing ones. |
199+
| [`Cypress.config()`](/api/cypress-api/config) | Get and set Cypress configuration from inside your tests. |
200+
| [`Cypress.Cookies.debug()`](/api/cypress-api/cookies) | Generate console logs whenever a cookie is modified. |
201+
| [`Cypress.currentRetry`](/api/cypress-api/currentretry) | A number representing the current test retry count. |
202+
| [`Cypress.currentTest`](/api/cypress-api/currenttest) | An object with information about the currently executing test. |
203+
| [`Cypress.log`](/api/cypress-api/cypress-log) | This is the internal API for controlling what gets printed to the Command Log. Useful when writing your own custom commands. |
204+
| [`Cypress.dom`](/api/cypress-api/dom) | A collection of DOM related helper methods. |
205+
| [`Cypress.ElementSelector`](/api/cypress-api/element-selector-api) | Configure selector priority used by [Cypress Studio](/app/guides/cypress-studio) and [cy.prompt()](/api/commands/prompt). |
206+
| [`Cypress.env`](/api/cypress-api/env) | Get environment variables from inside your tests. |
207+
| [`Cypress.isBrowser()`](/api/cypress-api/isbrowser) | Checks if the current browser matches the given name or filter. |
208+
| [`Cypress.isCy()`](/api/cypress-api/iscy) | checks if a variable is a valid instance of cy or a cy chainable. |
209+
| [`Cypress.Keyboard.defaults()`](/api/cypress-api/keyboard-api) | Set default values for how the `.type()` command is executed. |
210+
| [`Cypress.platform`](/api/cypress-api/platform) | The underlaying OS name, as returned by Node's `os.platform()`. |
211+
| [`Cypress.require`](/api/cypress-api/require) | Enables utilizing dependencies within the [cy.origin()](/api/commands/origin) callback function. |
212+
| [`Cypress.Screenshot.defaults()`](/api/cypress-api/screenshot-api) | Set defaults for screenshots captured by the `.screenshot()` command and the automatic screenshots taken during test failures. |
213+
| [`Cypress.session`](/api/cypress-api/session) | A collection of helper methods related to the `.session()` command. |
214+
| [`Cypress.spec`](/api/cypress-api/spec) | An object with information about the currently executing spec file. |
215+
| [`Cypress.testingType`](/api/cypress-api/testing-type) | The current testing type, eg. `"e2e"` or `"component". |
216+
| [`Cypress.version`](/api/cypress-api/version) | The current Cypress version. |
217217

218218
## Utilities
219219

docs/app/core-concepts/best-practices.mdx

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -144,21 +144,6 @@ meaning it's not coupled to the **behavior** or **styling** of an element.
144144
Additionally, it makes it clear to everyone that this element is used directly
145145
by test code.
146146

147-
:::info
148-
149-
<strong>Did you know?</strong>
150-
151-
The [Selector Playground](/app/core-concepts/open-mode#Selector-Playground)
152-
automatically follows these best practices.
153-
154-
When determining a unique selector, it will automatically prefer elements with:
155-
156-
- `data-cy`
157-
- `data-test`
158-
- `data-testid`
159-
160-
:::
161-
162147
#### <Icon name="graduation-cap" /> Real World Example
163148

164149
The <Icon name="github" inline="true" contentType="rwa" /> uses two useful

0 commit comments

Comments
 (0)