mirror of
https://github.com/datashard/snapshot.git
synced 2025-05-09 17:47:21 +00:00
Expand Readme, remove Gleb, up version number
This commit is contained in:
parent
a12634c9a3
commit
71fe145047
6 changed files with 17 additions and 14 deletions
BIN
.github/assets/Correct.png
vendored
Normal file
BIN
.github/assets/Correct.png
vendored
Normal file
Binary file not shown.
After ![]() (image error) Size: 9 KiB |
BIN
.github/assets/Error.png
vendored
Normal file
BIN
.github/assets/Error.png
vendored
Normal file
Binary file not shown.
After ![]() (image error) Size: 14 KiB |
|
@ -1,3 +1,4 @@
|
||||||
cypress/
|
cypress/
|
||||||
cypress.config.js
|
cypress.config.js
|
||||||
.github/workflows/
|
.github/workflows/
|
||||||
|
.vscode/
|
2
.vscode/settings.json
vendored
2
.vscode/settings.json
vendored
|
@ -1,2 +0,0 @@
|
||||||
{
|
|
||||||
}
|
|
16
README.md
16
README.md
|
@ -34,11 +34,9 @@ Alternatively, you can also add `snapshotUpdate` as an Environment Variable to u
|
||||||
|
|
||||||
Simply pass `--env updateSnapshots=true` when running Cypress.
|
Simply pass `--env updateSnapshots=true` when running Cypress.
|
||||||
|
|
||||||
> If you don't use the default fixture folder, you will also need to add `snapshotPath` to this module's config with the same path you use for `fixtureFolder`.
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
If properly added, usage of this plugin is rather simple, simply add `.snapshot()` to cypress functions that return valid JSON.
|
If properly added, usage of this plugin is rather simple, just add `.snapshot()` to cypress functions that return valid JSON. (i.e. `cy.wrap`)
|
||||||
|
|
||||||
### Example
|
### Example
|
||||||
```js
|
```js
|
||||||
|
@ -64,16 +62,22 @@ cypress/fixtures/snapshots/my-tests/works/bar.json
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Snapshots will generally be saved using this convention, provided by Cypress:
|
Snapshots will generally be saved using this convention, provided by the Cypress Test Steps:
|
||||||
|
Passing a name to the Snapshot function is required, but not checked, if you want to take multiple snapshots in the same block.
|
||||||
|
|
||||||
|
If you have two Snapshots in the same Block, the last one ***WILL*** overwrite the previous one while updating and the then updated Test will fail on the first snapshot.
|
||||||
```
|
```
|
||||||
{fixtureFolder}/<Context>-<Describe>-<It>-<Name?>.json
|
{fixtureFolder}/<Context>-<Describe>-<It>-<Name?>.json
|
||||||
{fixtureFolder}/<Context>/<Describe>/<It>/<Name?>.json
|
{fixtureFolder}/<Context>/<Describe>/<It>/<Name?>.json
|
||||||
```
|
```
|
||||||
|
|
||||||
If a step wasn't named, it will instead use the `<It>`for the file name, though this means that you will not be able to have more than 1 Snapshot in your It Block, as it would overwrite the previously created Snapshot files.
|
|
||||||
|
|
||||||
|
While running your Tests, if a value changed, it will, of course, no longer match the snapshot and throw an Error.
|
||||||
|
|
||||||
|
Which looks like this:
|
||||||
|
|
||||||
Of course, if a value changed, it will no longer match the snapshot and throw an Error.
|
|
||||||

|

|
||||||
|
|
||||||
|
When the Test succeeds, it will instead log a Success in the Log and let you know where the File has been saved to, relative to the Fixture Snapshot Folder
|
||||||
|
|
||||||
|

|
||||||
|
|
10
package.json
10
package.json
|
@ -1,8 +1,8 @@
|
||||||
{
|
{
|
||||||
"name": "@datashard/snapshot",
|
"name": "@datashard/snapshot",
|
||||||
"description": "Adds value / object / DOM element snapshot testing support to Cypress test runner",
|
"description": "Adds JSON Snapshot testing support to Cypress",
|
||||||
"version": "2.3.2",
|
"version": "3.0.0-beta",
|
||||||
"author": "Joshua <data@shard.wtf>, Gleb Bahmutov <gleb@cypress.io>",
|
"author": "Joshua <data@shard.wtf>",
|
||||||
"bugs": "https://github.com/datashard/snapshot/issues",
|
"bugs": "https://github.com/datashard/snapshot/issues",
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6"
|
"node": ">=6"
|
||||||
|
@ -13,13 +13,13 @@
|
||||||
"src/*/**",
|
"src/*/**",
|
||||||
"!src/*-spec.js"
|
"!src/*-spec.js"
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/datashard/snapshot#readme",
|
"homepage": "https://shard.wtf/snapshot",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"cypress",
|
"cypress",
|
||||||
"cypress-io",
|
"cypress-io",
|
||||||
"plugin",
|
"plugin",
|
||||||
"snapshot",
|
"snapshot",
|
||||||
"testing"
|
"testing", "json"
|
||||||
],
|
],
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"main": "src/index.js",
|
"main": "src/index.js",
|
||||||
|
|
Loading…
Add table
Reference in a new issue