Skip to content

Commit

Permalink
Merge branch 'main' into adding-descope-testing-strat-guide
Browse files Browse the repository at this point in the history
  • Loading branch information
allenzhou101 authored Sep 3, 2024
2 parents 6f2057d + b5fcbc6 commit 298950d
Show file tree
Hide file tree
Showing 132 changed files with 3,539 additions and 1,240 deletions.
10 changes: 5 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ Each plugin submitted to the plugins list should have the following:
2. CI pipeline
3. Compatibility with at least the latest major version of Cypress

Plugins are listed in in the following order to for users:
Plugins are listed in the following order:

- official
- verified
- community
- experimental
- official (Cypress owned)
- verified (community owned and verified by Cypress)
- community (community owned and unverified)
- deprecated (npm registry missing, source repo archived or incompatible with v10+)

### Adding Pages

Expand Down
4 changes: 2 additions & 2 deletions docs/api/actions/clear.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ chain further commands that rely on the subject after `.clear()`.

:::info

An alias for [`.type('{selectall}{backspace}')`](/api/commands/type)
An alias for [`.type('{selectall}{del}')`](/api/commands/type)

:::

Expand Down Expand Up @@ -82,7 +82,7 @@ cy.get('textarea').clear().type('Hello, World')
### Documentation

`.clear()` is an alias for
[`.type({selectall}{backspace})`](/api/commands/type).
[`.type({selectall}{del})`](/api/commands/type).

Please read the [`.type()`](/api/commands/type) documentation for more details.

Expand Down
49 changes: 33 additions & 16 deletions docs/api/actions/type.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ locale. `yyyy-MM-dd` is the format required by
[the W3 spec](https://www.w3.org/TR/html/infrastructure.html#dates-and-times)
and is what the input's `value` will be set to regardless of browser or locale.

`{upArrow}` and `{downArrow}` can increase and decrease the day value,
depending on "step" parameter provided. Using `.type()` with `{upArrow}` and `{downArrow}`
mimics behavior of `stepUp` and `stepDown` input methods.

Special characters (`{leftArrow}`, `{selectAll}`, etc.) are not permitted.

### Month Inputs
Expand All @@ -187,6 +191,10 @@ locale. `yyyy-MM` is the format required by
[the W3 spec](https://www.w3.org/TR/html/infrastructure.html#months) and is what
the input's `value` will be set to regardless of browser or locale.

`{upArrow}` and `{downArrow}` can increase and decrease the month value,
depending on "step" parameter provided. Using `.type()` with `{upArrow}` and `{downArrow}`
mimics behavior of `stepUp` and `stepDown` input methods.

Special characters (`{leftArrow}`, `{selectAll}`, etc.) are not permitted.

### Week Inputs
Expand All @@ -207,6 +215,10 @@ and is what the input's `value` will be set to regardless of browser or locale.

Special characters (`{leftArrow}`, `{selectAll}`, etc.) are not permitted.

`{upArrow}` and `{downArrow}` can increase and decrease the week value,
depending on "step" parameter provided. Using `.type()` with `{upArrow}` and `{downArrow}`
mimics behavior of `stepUp` and `stepDown` input methods.

### Time Inputs

Using `.type()` on a time input (`<input type="time">`) requires specifying a
Expand All @@ -218,6 +230,10 @@ valid time in the format:

Where `HH` is 00-23, `mm` is 00-59, `ss` is 00-59, and `SSS` is 000-999.

`{upArrow}` and `{downArrow}` can increase and decrease the seconds value,
depending on "step" parameter provided. Using `.type()` with `{upArrow}` and `{downArrow}`
mimics behavior of `stepUp` and `stepDown` input methods.

Special characters (`{leftArrow}`, `{selectAll}`, etc.) are not permitted.

### Key Combinations
Expand Down Expand Up @@ -618,22 +634,23 @@ following:

## History

| Version | Changes |
| --------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| [6.1.0](/guides/references/changelog#6-1-0) | Added option `scrollBehavior` |
| [5.6.0](/guides/references/changelog#5-6-0) | Support single key combination syntax |
| [5.5.0](/guides/references/changelog#5-5-0) | Support `beforeinput` event |
| [3.4.1](/guides/references/changelog#3-4-1) | Added `parseSpecialCharSequences` option |
| [3.3.0](/guides/references/changelog#3-3-0) | Added `{insert}`, `{pageup}` and `{pagedown}` character sequences |
| [3.2.0](/guides/references/changelog#3-2-0) | Added `{home}` and `{end}` character sequences |
| [0.20.0](/guides/references/changelog#0-20-0) | Supports for typing in inputs of type `date`, `time`, `month`, and `week` |
| [0.17.1](/guides/references/changelog#0-17-1) | Added `ctrl`, `cmd`, `shift`, and `alt` keyboard modifiers |
| [0.16.3](/guides/references/changelog#0-16-3) | Supports for typing in elements with `tabindex` attribute |
| [0.16.2](/guides/references/changelog#0-16-2) | Added `{downarrow}` and `{uparrow}` character sequences |
| [0.8.0](/guides/references/changelog#0-8-0) | Outputs Key Events Table to console on click |
| [0.8.0](/guides/references/changelog#0-8-0) | Added `{selectall}`, `{del}`, `{backspace}`, `{esc}`, `{{}`, `{enter}`, `{leftarrow}`, `{rightarrow}` character sequences |
| [0.8.0](/guides/references/changelog#0-8-0) | Added small delay (10ms) between each keystroke during `cy.type()` |
| [0.6.12](/guides/references/changelog#0-6-12) | Added option `force` |
| Version | Changes |
| ----------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------- |
| [13.14.0](/guides/references/changelog#13-14-0) | Added support for `.type({upArrow})` and `.type({downArrow})` to work on date, month, week, time, datetime-local and range input types |
| [6.1.0](/guides/references/changelog#6-1-0) | Added option `scrollBehavior` |
| [5.6.0](/guides/references/changelog#5-6-0) | Support single key combination syntax |
| [5.5.0](/guides/references/changelog#5-5-0) | Support `beforeinput` event |
| [3.4.1](/guides/references/changelog#3-4-1) | Added `parseSpecialCharSequences` option |
| [3.3.0](/guides/references/changelog#3-3-0) | Added `{insert}`, `{pageup}` and `{pagedown}` character sequences |
| [3.2.0](/guides/references/changelog#3-2-0) | Added `{home}` and `{end}` character sequences |
| [0.20.0](/guides/references/changelog#0-20-0) | Supports for typing in inputs of type `date`, `time`, `month`, and `week` |
| [0.17.1](/guides/references/changelog#0-17-1) | Added `ctrl`, `cmd`, `shift`, and `alt` keyboard modifiers |
| [0.16.3](/guides/references/changelog#0-16-3) | Supports for typing in elements with `tabindex` attribute |
| [0.16.2](/guides/references/changelog#0-16-2) | Added `{downarrow}` and `{uparrow}` character sequences |
| [0.8.0](/guides/references/changelog#0-8-0) | Outputs Key Events Table to console on click |
| [0.8.0](/guides/references/changelog#0-8-0) | Added `{selectall}`, `{del}`, `{backspace}`, `{esc}`, `{{}`, `{enter}`, `{leftarrow}`, `{rightarrow}` character sequences |
| [0.8.0](/guides/references/changelog#0-8-0) | Added small delay (10ms) between each keystroke during `cy.type()` |
| [0.6.12](/guides/references/changelog#0-6-12) | Added option `force` |

## See also

Expand Down
5 changes: 3 additions & 2 deletions docs/api/commands/clearlocalstorage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Pass in an options object to change the default behavior of

### Yields [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Subject-Management) {#Yields}

- `cy.clearLocalStorage()` yields `null`.
- `cy.clearLocalStorage()` yields the localStorage for the current domain.

## Examples

Expand Down Expand Up @@ -82,7 +82,8 @@ cy.clearLocalStorage(/app-/)

### Assertions [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Assertions) {#Assertions}

- `cy.clearLocalStorage()` cannot have any assertions chained.
- `cy.clearLocalStorage()` will only run assertions you have chained once, and
will not [retry](/guides/core-concepts/retry-ability).

### Timeouts [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Timeouts) {#Timeouts}

Expand Down
38 changes: 27 additions & 11 deletions docs/api/commands/intercept.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ See
[routeHandler](#routeHandler-Function)
argument

```typescript
// Specifying request and response types
type CustomRequest = {
kind: 'custom_request'
}
type CustomResponse = {
kind: 'custom_response'
}
cy.intercept<CustomRequest, CustomResponse>(url, (req) => {
req.body // .body of request will be of type CustomRequest
req.continue((res) => {
res.body // .body of request will be of type CustomResponse
})
})
```
### Usage
<Icon name="check-circle" color="green" /> **Correct Usage**
Expand Down Expand Up @@ -958,7 +974,7 @@ cy.intercept('POST', '/users', (req) => {
// requests to create a user will be fulfilled
// with a body of 'success'
cy.intercept('POST', '/users', 'success')
// { body: 'sucess' }
// { body: 'success' }
```

## Intercepted requests
Expand Down Expand Up @@ -1601,16 +1617,16 @@ information about the request and response to the console:

## History

| Version | Changes |
| --------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [12.2.0](/guides/references/changelog#12-2-0) | Added `resourceType` property to `req` and `RouteMatcher`. |
| [7.6.0](/guides/references/changelog#7-0-0) | Added `query` option to `req` (The incoming request object yielded to request handler functions). |
| [7.0.0](/guides/references/changelog#7-0-0) | Removed `matchUrlAgainstPath` option from `RouteMatcher`, reversed handler ordering, added request events, removed substring URL matching, removed `cy.route2` alias, added `middleware` RouteMatcher option, renamed `res.delay()` to `res.setDelay()` and `res.throttle()` to `res.setThrottle()`. |
| [6.4.0](/guides/references/changelog#6-4-0) | Renamed `delayMs` property to `delay` (backwards-compatible). |
| [6.2.0](/guides/references/changelog#6-2-0) | Added `matchUrlAgainstPath` option to `RouteMatcher`. |
| [6.0.0](/guides/references/changelog#6-0-0) | Renamed `cy.route2()` to `cy.intercept()`. |
| [6.0.0](/guides/references/changelog#6-0-0) | Removed `experimentalNetworkStubbing` option and made it the default behavior. |
| [5.1.0](/guides/references/changelog#5-1-0) | Added experimental `cy.route2()` command under `experimentalNetworkStubbing` option. |
| Version | Changes |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | |
| [12.2.0](/guides/references/changelog#12-2-0) | Added `resourceType` property to `req` and `RouteMatcher`. |
| [7.6.0](/guides/references/changelog#7-0-0) | Added `query` option to `req` (The incoming request object yielded to request handler functions). |
| [7.0.0](/guides/references/changelog#7-0-0) | Removed `matchUrlAgainstPath` option from `RouteMatcher`, reversed handler ordering, added request events, removed substring URL matching, removed `cy.route2` alias, added `middleware` RouteMatcher option, renamed `res.delay()` to `res.setDelay()` and `res.throttle()` to `res.setThrottle()`. |
| [6.4.0](/guides/references/changelog#6-4-0) | Renamed `delayMs` property to `delay` (backwards-compatible). |
| [6.2.0](/guides/references/changelog#6-2-0) | Added `matchUrlAgainstPath` option to `RouteMatcher`. |
| [6.0.0](/guides/references/changelog#6-0-0) | Renamed `cy.route2()` to `cy.intercept()`. |
| [6.0.0](/guides/references/changelog#6-0-0) | Removed `experimentalNetworkStubbing` option and made it the default behavior. |
| [5.1.0](/guides/references/changelog#5-1-0) | Added experimental `cy.route2()` command under `experimentalNetworkStubbing` option. |

## See also

Expand Down
7 changes: 3 additions & 4 deletions docs/api/commands/origin.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ cy.origin('example.cypress.io', () => {
})
```

Here the `baseUrl` inside the `cy.origin()` callback is set to `www.cypress.io`
Here the `baseUrl` inside the `cy.origin()` callback is set to `example.cypress.io`
and the protocol defaults to `https`. When `cy.visit()` is called with the path
`/history/founder`, the three are concatenated to make
`https://www.cypress.io/history/founder`.
`https://example.cypress.io/history/founder`.

#### Alternative navigation

Expand Down Expand Up @@ -528,8 +528,7 @@ There are other testing scenarios which are not currently covered by

- It cannot run commands
[in a different browser window](/guides/references/trade-offs#Multiple-browsers-open-at-the-same-time)
- It cannot run commands
[in a different browser tab](/guides/references/trade-offs#Multiple-tabs)
- It cannot run commands in a different browser tab
- It cannot run commands
[inside an `<iframe>` element](/faq/questions/using-cypress-faq#How-do-I-test-elements-inside-an-iframe)

Expand Down
11 changes: 11 additions & 0 deletions docs/api/commands/screenshot.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,17 @@ cy.screenshot()
cy.get('.sticky-header').invoke('css', 'position', null)
```

### Chromium-specific behavior with regard to tabs

Chromium will not capture screenshots when the renderer process for the Cypress
tab is paused. This most often happens if a new tab was opened by clicking on
an anchor with `target="_blank"`. To accommodate capturing screenshots in this
situation, Cypress will attempt to activate the Cypress tab when a screenshot is
captured. We make our best effort to activate the tab via our Chromium extension.
If the extension is disabled, Cypress will force the main tab to the front. This
will cause the browser to steal focus in open mode. To prevent Cypress from
stealing focus, [ensure that the extension is enabled](/guides/references/troubleshooting#Allow-the-Cypress-Chrome-extension).

## Rules

### Requirements [<Icon name="question-circle"/>](/guides/core-concepts/introduction-to-cypress#Chains-of-Commands) {#Requirements}
Expand Down
39 changes: 39 additions & 0 deletions docs/api/commands/wait.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,45 @@ cy.wait(alias, options)
cy.wait(aliases, options)
```

```typescript
// Specifying request and response types for aliased intercepts
type UserReq = {}
type UserRes = {}
type ActivityReq = {}
type ActivityRes = {}

cy.intercept('/users/*').as('getUsers')
cy.intercept('/activities/*').as('getActivities')

// As templated types:
cy.wait<UserReq, UserRes>('@getUsers').then(({ request, response }) => {
request.body // will be of type UserReq
response.body // will be of type UserRes
})

// As inferred types, with type `Interception` available in `cypress/types/net-stubbing`
cy.wait('@getUsers').then(
({ request, response }: Interception<UserReq, UserRes>) => {
request.body // will be of type UserReq
response.body // will be of type UserRes
}
)

// When passing an array of aliases, types must be inferred:
cy.wait(['@getUsers', 'getActivities']).then(
(
interceptions: Array<
Interception<UserReq | ActivityReq, UserRes | ActivityRes>
>
) => {
interceptions.forEach(({ request, response }) => {
request.body // will be of type UserReq | ActivityReq
response.body // will be of type UserRes | ActivityRes
})
}
)
```

### Usage

<Icon name="check-circle" color="green" /> **Correct Usage**
Expand Down
12 changes: 12 additions & 0 deletions docs/api/cypress-api/catalog-of-events.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,18 @@ Cypress.on('uncaught:exception', (err, runnable) => {
})
```

If an uncaught exception is thrown from a domain within a `cy.origin()` command, the uncaught exception handler will need to added within the `cy.origin()` command to take effect.

```javascript
cy.origin('https://example.cypress.io', () => {
Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress
// inside the cy.origin() method from failing the test
return false
})
})
```

### To conditionally turn off uncaught exception handling for a certain error

<SupportFileConfiguration />
Expand Down
Loading

0 comments on commit 298950d

Please sign in to comment.