Skip to content

docs: Breaking: Cypress 15.0.0 #6137

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 19 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
0dd9851
chore: remove CDP deprecation notice in launching browsers related to…
AtofStryker Mar 31, 2025
bc303f2
Merge branch 'main' into release/15.0.0
jennifer-shehane Apr 7, 2025
065e567
chore: Node.js 18/23 removal (#6138)
jennifer-shehane Apr 8, 2025
becd3da
chore: update typescript docs to tsx (#6155)
AtofStryker Apr 22, 2025
4fa879e
chore: add beginning of migration guide for Cypress 15 (#6159)
AtofStryker Apr 28, 2025
061610f
chore: make the minimum version of angular 18+ (#6168)
AtofStryker May 5, 2025
7ecc261
chore: add webpack 4 migration guide / workarounds (#6164)
AtofStryker May 5, 2025
4e76d52
Merge branch 'main' of github.com:cypress-io/cypress-documentation in…
AtofStryker May 7, 2025
6af2913
chore: merge dev into 15 (#6172)
AtofStryker May 8, 2025
607b6f1
Revert "chore: merge dev into 15 (#6172)" (#6174)
AtofStryker May 8, 2025
62f2a96
Merge pull request #6175 from cypress-io/merge_dev_into_15
AtofStryker May 8, 2025
214bcf2
Merge branch 'main' into release/15.0.0
jennifer-shehane May 14, 2025
2635ffb
chore: add migration guide for`@cypress/webpack-batteries-included-pr…
AtofStryker Jun 5, 2025
1b1dc75
Merge branch 'main' into release/15.0.0
jennifer-shehane Jun 16, 2025
1353889
Merge branch 'main' into release/15.0.0
jennifer-shehane Jun 18, 2025
80a1655
Merge branch 'main' into release/15.0.0
jennifer-shehane Jun 24, 2025
9447837
Merge branch 'main' into release/15.0.0
jennifer-shehane Jun 24, 2025
b4b05f6
baseline updates for Cypress Studio updates
jennifer-shehane Jun 24, 2025
54fca6d
Updates for renaming SelectorPlayground to ElementSelector API (#6212)
jennifer-shehane Jun 27, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions docs/api/cypress-api/element-selector-api.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
---
title: 'Cypress.ElementSelector | Cypress Documentation'
description: 'The Element Selector exposes APIs that enable you to change the default selector strategy and override the selectors that are returned per element.'
sidebar_label: ElementSelector
sidebar_position: 105
---

<ProductHeading product="app" />

# Cypress.ElementSelector

The Element Selector API is used to get the selector priority for selecting elements in [Cypress Studio](/app/guides/cypress-studio) and [Selector Playground](/app/core-concepts/open-mode#Selector-Playground).

## Syntax

```javascript
Cypress.ElementSelector.defaults(options)
Cypress.ElementSelector.getSelector($el)
```

### Arguments

<Icon name="angle-right" /> **options _(Object)_**

An object containing any or all of the following options:

| Option | Accepts | Description |
| ------------------ | ------------------ | -------------------------------------------------------------------------------- |
| `selectorPriority` | `Array of strings` | Determines the order of preference for which selector is chosen for the element. |

`selectorPriority` accepts the following strings:

- `attribute:${string}`
- `attributes`
- `class`
- `data-${string}`
- `id`
- `name`
- `nth-child`
- `tag`

<DefaultSelectorPriority />

<Icon name="angle-right" /> **$el _(Object)_**

The [jQuery element](http://api.jquery.com/Types/#jQuery) that you want to get
the selector value for.

## Examples

### Selector Priority

Set the selector priority to favor role, then aria-label, then name, then classes, then attributes.

```javascript
Cypress.ElementSelector.defaults({
selectorPriority: [
'attribute:role',
'attribute:aria-label',
'name',
'class',
'attributes',
],
})
```

### Get Selector

Returns you the selector value for a given element as determined by the selector
strategy. This is useful for debugging custom selector priorities you have set.

For example, consider this HTML fragment:

```html
<button id="bingo" class="number3">Cup of tea</button>
```

With the default selector strategy, the selector value will be `'#bingo'`
because IDs have priority over classes.

```js
const $el = Cypress.$('button')
const selector = Cypress.ElementSelector.getSelector($el) // '#bingo'
```

With a custom selector strategy that favours classes, the selector value will be
`'.number3'`.

```js
Cypress.ElementSelector.defaults({
selectorPriority: ['class', 'id'],
})

const $el = Cypress.$('button')
const selector = Cypress.ElementSelector.getSelector($el) // '.number3'
```

## See also

- [Cypress Studio](/app/guides/cypress-studio)
- [Selector Playground](/app/core-concepts/open-mode#Selector-Playground)
100 changes: 0 additions & 100 deletions docs/api/cypress-api/selector-playground-api.mdx

This file was deleted.

46 changes: 23 additions & 23 deletions docs/api/table-of-contents.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -190,29 +190,29 @@ The _key_ difference between Cypress APIs and Cypress commands is that Cypress
APIs execute the moment they are invoked and are **not** enqueued to run at a
later time.

| Property | Usage |
| ------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
| [`Cypress.arch`](/api/cypress-api/arch) | CPU architecture name of the underlying OS, as returned from Node's `os.arch()`. |
| [`Cypress.browser`](/api/cypress-api/browser) | Information about the current browser, such as browser family and version. |
| [`Cypress.Commands`](/api/cypress-api/custom-commands) | Create new custom commands and extend or override existing ones. |
| [`Cypress.config()`](/api/cypress-api/config) | Get and set Cypress configuration from inside your tests. |
| [`Cypress.Cookies.debug()`](/api/cypress-api/cookies) | Generate console logs whenever a cookie is modified. |
| [`Cypress.currentRetry`](/api/cypress-api/currentretry) | A number representing the current test retry count. |
| [`Cypress.currentTest`](/api/cypress-api/currenttest) | An object with information about the currently executing test. |
| [`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. |
| [`Cypress.dom`](/api/cypress-api/dom) | A collection of DOM related helper methods. |
| [`Cypress.env`](/api/cypress-api/env) | Get environment variables from inside your tests. |
| [`Cypress.isBrowser()`](/api/cypress-api/isbrowser) | Checks if the current browser matches the given name or filter. |
| [`Cypress.isCy()`](/api/cypress-api/iscy) | checks if a variable is a valid instance of cy or a cy chainable. |
| [`Cypress.Keyboard.defaults()`](/api/cypress-api/keyboard-api) | Set default values for how the `.type()` command is executed. |
| [`Cypress.platform`](/api/cypress-api/platform) | The underlaying OS name, as returned by Node's `os.platform()`. |
| [`Cypress.require`](/api/cypress-api/require) | Enables utilizing dependencies within the [cy.origin()](/api/commands/origin) callback function. |
| [`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. |
| [`Cypress.SelectorPlayground`](/api/cypress-api/selector-playground-api) | Configure options used by the [Selector Playground](/app/core-concepts/open-mode#Selector-Playground). |
| [`Cypress.session`](/api/cypress-api/session) | A collection of helper methods related to the `.session()` command. |
| [`Cypress.spec`](/api/cypress-api/spec) | An object with information about the currently executing spec file. |
| [`Cypress.testingType`](/api/cypress-api/testing-type) | The current testing type, eg. `"e2e"` or `"component". |
| [`Cypress.version`](/api/cypress-api/version) | The current Cypress version. |
| Property | Usage |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [`Cypress.arch`](/api/cypress-api/arch) | CPU architecture name of the underlying OS, as returned from Node's `os.arch()`. |
| [`Cypress.browser`](/api/cypress-api/browser) | Information about the current browser, such as browser family and version. |
| [`Cypress.Commands`](/api/cypress-api/custom-commands) | Create new custom commands and extend or override existing ones. |
| [`Cypress.config()`](/api/cypress-api/config) | Get and set Cypress configuration from inside your tests. |
| [`Cypress.Cookies.debug()`](/api/cypress-api/cookies) | Generate console logs whenever a cookie is modified. |
| [`Cypress.currentRetry`](/api/cypress-api/currentretry) | A number representing the current test retry count. |
| [`Cypress.currentTest`](/api/cypress-api/currenttest) | An object with information about the currently executing test. |
| [`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. |
| [`Cypress.dom`](/api/cypress-api/dom) | A collection of DOM related helper methods. |
| [`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). |
| [`Cypress.env`](/api/cypress-api/env) | Get environment variables from inside your tests. |
| [`Cypress.isBrowser()`](/api/cypress-api/isbrowser) | Checks if the current browser matches the given name or filter. |
| [`Cypress.isCy()`](/api/cypress-api/iscy) | checks if a variable is a valid instance of cy or a cy chainable. |
| [`Cypress.Keyboard.defaults()`](/api/cypress-api/keyboard-api) | Set default values for how the `.type()` command is executed. |
| [`Cypress.platform`](/api/cypress-api/platform) | The underlaying OS name, as returned by Node's `os.platform()`. |
| [`Cypress.require`](/api/cypress-api/require) | Enables utilizing dependencies within the [cy.origin()](/api/commands/origin) callback function. |
| [`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. |
| [`Cypress.session`](/api/cypress-api/session) | A collection of helper methods related to the `.session()` command. |
| [`Cypress.spec`](/api/cypress-api/spec) | An object with information about the currently executing spec file. |
| [`Cypress.testingType`](/api/cypress-api/testing-type) | The current testing type, eg. `"e2e"` or `"component". |
| [`Cypress.version`](/api/cypress-api/version) | The current Cypress version. |

## Utilities

Expand Down
2 changes: 1 addition & 1 deletion docs/app/component-testing/angular/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sidebar_label: Overview

## Framework Support

Cypress Component Testing supports Angular 17.2.0+.
Cypress Component Testing supports Angular `^18.0.0` and `^19.0.0`.

## Tutorial

Expand Down
2 changes: 1 addition & 1 deletion docs/app/component-testing/get-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ following development servers and frameworks:
| [Next.js 14-15](/app/component-testing/react/overview#Nextjs) | React 18-19 | Webpack 5 |
| [Vue with Vite](/app/component-testing/vue/overview#Vue-with-Vite) | Vue 3 | Vite 4-6 |
| [Vue with Webpack](/app/component-testing/vue/overview#Vue-with-Webpack) | Vue 3 | Webpack 4-5 |
| [Angular](/app/component-testing/angular/overview#Framework-Configuration) | Angular 17-19 | Webpack 5 |
| [Angular](/app/component-testing/angular/overview#Framework-Configuration) | Angular 18-19 | Webpack 5 |
| [Svelte with Vite](/app/component-testing/svelte/overview#Svelte-with-Vite) <Badge type="info">Alpha</Badge> | Svelte 5 | Vite 4-6 |
| [Svelte with Webpack](/app/component-testing/svelte/overview#Svelte-with-Webpack) <Badge type="info">Alpha</Badge> | Svelte 5 | Webpack 4-5 |

Expand Down
13 changes: 5 additions & 8 deletions docs/app/core-concepts/open-mode.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -559,19 +559,16 @@ interactions.
title="Selector Playground demo"
/>

### Uniqueness
### How are selectors determined?

Cypress will automatically calculate a **unique selector** to use targeted
Cypress will automatically calculate a **unique selector** to use for a targeted
element by running through a series of selector strategies.

<DefaultSelectorPriority />

:::info

Cypress allows you to control how a selector is determined. Use the [Cypress.SelectorPlayground](/api/cypress-api/selector-playground-api)
API to control the selectors you want returned.

:::
Cypress allows you to control how a selector is determined. Use the
[`Cypress.ElementSelector`](/api/cypress-api/element-selector-api) API to control
the selectors you want prioritized.

### Best practices

Expand Down
4 changes: 2 additions & 2 deletions docs/app/get-started/install-cypress.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ Cypress supports running under these operating systems:

Cypress requires [Node.js](https://nodejs.org/) in order to install. We support the versions listed below:

- **Node.js** 18.x, 20.x, 22.x and above
- **Node.js** 20.x, 22.x, 24.x and above

Cypress generally aligns with
[Node's release schedule](https://github.com/nodejs/Release).
Expand Down Expand Up @@ -149,7 +149,7 @@ Cypress is [installed](#Install) using one of the following supported package ma

| Package Manager | Version | Installation instructions |
| ------------------------------------------------ | ------------------- | --------------------------------------------------------------------------------------------------------------- |
| [npm](https://docs.npmjs.com/) | `8.6.0` and above | [Downloading and installing Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) |
| [npm](https://docs.npmjs.com/) | `10.1.0` and above | [Downloading and installing Node.js and npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm) |
| [Yarn 1 (Classic)](https://classic.yarnpkg.com/) | `1.22.22` and above | [Yarn 1 (Classic) Installation](https://classic.yarnpkg.com/en/docs/install) |
| [Yarn (Modern aka berry)](https://yarnpkg.com/) | `4.x` and above | [Yarn Installation](https://yarnpkg.com/getting-started/install) |
| [pnpm](https://pnpm.io/) | `8.x` and above | [pnpm Installation](https://pnpm.io/installation) |
Expand Down
Loading