An open API service indexing awesome lists of open source software.

https://github.com/bahmutov/next-state-overwrite-example

Example overwriting NEXT_STATE from a Cypress test
https://github.com/bahmutov/next-state-overwrite-example

cypress-example

Last synced: 9 months ago
JSON representation

Example overwriting NEXT_STATE from a Cypress test

Awesome Lists containing this project

README

          

# next-state-overwrite-example
[![ci status][ci image]][ci url] [![badges status][badges image]][badges url] [![next-state-overwrite-example](https://img.shields.io/endpoint?url=https://dashboard.cypress.io/badge/detailed/onn62n/main&style=flat&logo=cypress)](https://dashboard.cypress.io/projects/onn62n/runs)
[![renovate-app badge][renovate-badge]][renovate-app] ![cypress version](https://img.shields.io/badge/cypress-7.7.0-brightgreen)
> Example overwriting Next.js variable NEXT_STATE from a Cypress test

Read the blog post [Control Next.js Server-Side Data During Cypress Tests
](https://glebbahmutov.com/blog/control-nextjs-data-during-tests/)

![Example test](./images/no-warning.png)

See [cypress/integration/spec.js](./cypress/integration/spec.js)

## Install and start

```shell
$ yarn
$ yarn local
```

Should start the application and open Cypress test runner

[renovate-badge]: https://img.shields.io/badge/renovate-app-blue.svg
[renovate-app]: https://renovateapp.com/
[ci image]: https://github.com/bahmutov/next-state-overwrite-example/workflows/ci/badge.svg?branch=main
[ci url]: https://github.com/bahmutov/next-state-overwrite-example/actions
[badges image]: https://github.com/bahmutov/next-state-overwrite-example/workflows/badges/badge.svg?branch=main
[badges url]: https://github.com/bahmutov/next-state-overwrite-example/actions