Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eWert-Online/osnap
OSnap is a snapshot testing tool, which mainly focuses on speed and ease of use.
https://github.com/eWert-Online/osnap
diff image-comparison image-snapshots snapshot snapshot-testing testing visual-comparison-testing visual-regression-testing
Last synced: 3 months ago
JSON representation
OSnap is a snapshot testing tool, which mainly focuses on speed and ease of use.
- Host: GitHub
- URL: https://github.com/eWert-Online/osnap
- Owner: eWert-Online
- Created: 2021-02-28T19:11:27.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-07-21T16:23:00.000Z (4 months ago)
- Last Synced: 2024-07-22T15:55:37.479Z (4 months ago)
- Topics: diff, image-comparison, image-snapshots, snapshot, snapshot-testing, testing, visual-comparison-testing, visual-regression-testing
- Language: OCaml
- Homepage: https://ewert-online.github.io/OSnap/
- Size: 40.3 MB
- Stars: 149
- Watchers: 1
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-regression-testing - OSnap - The speedy and easy to use Snapshot Testing tool for your project (1200 snapshots will run in under 3 minutes). (Tools and frameworks)
README
The speedy and easy to use Snapshot Testing tool for your project!
A Project with around 1200 snapshots will run in under 3 minutes*,
compared to around 18 minutes it takes other popular snapshot tools to run the same test suite.
* with 20 parallel runners on a 2017 15-inch MacBook Pro.
# Table of contents
- [How do I install it?](#how-do-i-install-it)
- [How do I use it?](#how-do-i-use-it)
- [Credits](#credits)
- [Contributing](#contributing)
# How do I install it?
## Docker (recommended)
Use one of the official Docker images at https://hub.docker.com/u/osnap.
**NOTICE:**
We do recommend using a Docker Container to run the tests, because snapshot tests are by nature pretty susceptible to the smallest changes in rendering.
The biggest problem is, that Browsers render (mainly fonts and images) differently on different devices and operating systems. For the human eye, this is mostly not noticeable, but for an diffing algorithm, these changes are noticeable and will fail the test.
So it is important to always run the tests in the same environment.
## npm / yarn
OSnap may be installed with yarn or npm using one of the following commands:
```bash
yarn add @space-labs/osnap --dev
```or
```bash
npm install @space-labs/osnap --save-dev
```
# How do I use it?
Before you can run your first test suite, OSnap needs to be configured. To do this, you need at least two files. The global config file and one test file.
After you have created them you have to run `yarn osnap`, `npx osnap` or create a npm script running `osnap` with the optional [cli flags](https://ewert-online.github.io/OSnap/cli) available.
In in-depth documentation with configuration options and examples can be found at:
### **https://ewert-online.github.io/OSnap**
# Credits
**[ODiff](https://github.com/dmtrKovalenko/odiff):**
ODiff inspired the name of this library and is used as the underlying diffing algorithm.
Thank you for your work [@dmtrKovalenko](https://github.com/dmtrKovalenko)!
# Contributing
Contributions are always welcome. Here's how to set up the project locally.
**Install opam**
https://opam.ocaml.org/doc/Install.html
**Install dependencies**
```sh
make install
```**Build the project**
```sh
make
```# Some things we may want to add:
In decending order of priority (top ones are more important):
- [ ] **A built in static webserver**:
The speed of the server used to serve the website being tested influences the speed of OSnap a lot. So we want to control that a bit more and provide a built in static web server.
This also makes it easier to run tests, as you don't have to explicitly wait for the server to be up and running before running osnap.
- [ ] **Listen for network requests**:
Wait for specific network requests to finish, before taking the screenshot. For example: Wait for a failed login attempt to come back, to screenshot the error state
- [ ] **Wait for dom events**:
Maybe we can find a way, to wait for specific events to be triggered on the page. For example: Wait for all animations on the page to complete before taking the screenshot.
### If you find a bug or think some feature is missing, feel free to submit an issue :)