diff --git a/.github/assets/Correct.png b/.github/assets/Correct.png new file mode 100644 index 0000000..4e93667 Binary files /dev/null and b/.github/assets/Correct.png differ diff --git a/.github/assets/Error.png b/.github/assets/Error.png new file mode 100644 index 0000000..5ee573e Binary files /dev/null and b/.github/assets/Error.png differ diff --git a/.npmignore b/.npmignore index 16a2599..6aed89d 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,4 @@ cypress/ cypress.config.js -.github/workflows/ \ No newline at end of file +.github/workflows/ +.vscode/ \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 7a73a41..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,2 +0,0 @@ -{ -} \ No newline at end of file diff --git a/README.md b/README.md index bf020e6..7e36e12 100644 --- a/README.md +++ b/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. -> 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 -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 ```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}/---.json {fixtureFolder}////.json ``` -If a step wasn't named, it will instead use the ``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. ![](./.github/assets/Error.png) +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 + +![](./.github/assets/Correct.png) diff --git a/package.json b/package.json index e66eac3..d94f1ce 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "@datashard/snapshot", - "description": "Adds value / object / DOM element snapshot testing support to Cypress test runner", - "version": "2.3.2", - "author": "Joshua , Gleb Bahmutov ", + "description": "Adds JSON Snapshot testing support to Cypress", + "version": "3.0.0-beta", + "author": "Joshua ", "bugs": "https://github.com/datashard/snapshot/issues", "engines": { "node": ">=6" @@ -13,13 +13,13 @@ "src/*/**", "!src/*-spec.js" ], - "homepage": "https://github.com/datashard/snapshot#readme", + "homepage": "https://shard.wtf/snapshot", "keywords": [ "cypress", "cypress-io", "plugin", "snapshot", - "testing" + "testing", "json" ], "license": "MIT", "main": "src/index.js",