---
id: api/commands/tick
title: tick | Cypress Documentation
description: >-
  Move time after overriding a native time function with `cy.clock()` in
  Cypress.
section: api
source_path: docs/api/commands/tick.mdx
version: 3cf5b86b3403f604bdf7f3e35025c3bc3865e02c
updated_at: '2026-05-07T17:44:31.931Z'
---
# tick

Move time after overriding a native time function with [`cy.clock()`](/llm/markdown/api/commands/clock.md).

[`cy.clock()`](/llm/markdown/api/commands/clock.md) must be called before `cy.tick()` in order to override native time functions first.

## Syntax

```
cy.tick(milliseconds, options)
```

### Usage

**Correct Usage**

```
cy.tick(500)
```

### Arguments

**milliseconds _(Number)_**

The number of `milliseconds` to move the clock. Any timers within the affected range of time will be called.

**options _(Object)_**

Pass in an options object to change the default behavior of `cy.tick()`.

| Option | Default | Description |
| --- | --- | --- |
| `log` | `true` | Displays the command in the [Command log](/llm/markdown/app/core-concepts/open-mode.md#Command-Log) |

### Yields [Learn about subject management](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Subject-Management)

`cy.tick()` yields a `clock` object with the following methods:

*   **`clock.tick(milliseconds)`**
    
    Move the clock a number of milliseconds. Any timers within the affected range of time will be called.
    
*   **`clock.restore()`**
    
    Restore all overridden native functions. This is automatically called between tests, so should not generally be needed.
    

You can also access the `clock` object via `this.clock` in a [`.then()`](/llm/markdown/api/commands/then.md) callback.

## Examples

### Milliseconds

#### Create a clock and move time to trigger a `setTimeout`

```
// app code loaded by index.htmlwindow.addIntro = () => {  setTimeout(() => {    document.getElementById('#header').textContent = 'Hello, World'  }, 500)}
```

```
cy.clock()cy.visit('/index.html')cy.window().invoke('addIntro')cy.tick(500)cy.get('#header').should('have.text', 'Hello, World')
```

#### Using `cy.clock()` with `cy.tick()`

[Check out our example recipe testing spying, stubbing and time](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)

### Restore clock

You can restore the clock and allow your application to resume normally without manipulating native global functions related to time. This is automatically called between tests.

```
cy.clock()cy.visit('http://localhost:3333')cy.get('#search').type('Acme Company')cy.tick(1000)// more test code here// restore the clockcy.clock().then((clock) => {  clock.restore()})// more test code here
```

You could also restore by using [.invoke()](/llm/markdown/api/commands/invoke.md) to invoke the `restore` function.

```
cy.clock().invoke('restore')
```

## Rules

### Requirements [Learn about chaining commands](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Chains-of-Commands)

*   `cy.tick()` requires being chained off of `cy`.
*   `cy.tick()` requires that `cy.clock()` be called before it.

### Assertions [Learn about assertions](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Assertions)

*   `cy.tick()` is a utility command.
*   `cy.tick()` will not run assertions. Assertions will pass through as if this command did not exist.

### Timeouts [Learn about timeouts](/llm/markdown/app/core-concepts/introduction-to-cypress.md#Timeouts)

*   `cy.tick()` cannot time out.

## Command Log

**_Create a clock and tick it 1 second_**

```
cy.clock()cy.tick(1000)
```

The command above will display in the Command Log as:

When clicking on the `tick` command within the command log, the console outputs the following:

## History

| Version | Changes |
| --- | --- |
| [7.0.0](/llm/markdown/app/references/changelog.md#7-0-0) | `log` option added to `cy.tick()` |
| [0.18.8](/llm/markdown/app/references/changelog.md#0-18-8) | `cy.tick()` command added |

## See also

*   [`cy.clock()`](/llm/markdown/api/commands/clock.md)
*   [`cy.spy()`](/llm/markdown/api/commands/spy.md)
*   [`cy.stub()`](/llm/markdown/api/commands/stub.md)
*   [Guide: Stubs, Spies and Clocks](/llm/markdown/app/guides/stubs-spies-and-clocks.md)
*   [Recipe: Stubbing, Spying](/llm/markdown/app/references/recipes.md#Stubbing-and-spying)
