Skip to content
프로젝트

소개

Cross-browser screenshot testing tool for Storybook with fancy UI Runner.

웹 및 앱 개발

이 수치를 측정하는 방법

What you can do

  • 📚 Integrates with Storybook
  • 📜 Uses stories as tests
  • ✏️ Allows write interaction tests
  • ✨ Has fancy UI Runner

측정된 스타 증가

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
기록 수집 중

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original

Creevey

Cross-browser screenshot testing tool for Storybook with fancy UI Runner.

Creevey downloads Commitizen friendly FOSSA Status

Creevey Demo

Core features

  • 📚 Integrates with Storybook
  • 📜 Uses stories as tests
  • ✏️ Allows write interaction tests
  • ✨ Has fancy UI Runner
  • 🐳 Supports Docker
  • ⚔️ Cross-browsers testing
  • 🔥 Tests hot-reloading
  • ⚙️ CI Ready

It named after Colin Creevey character from the Harry Potter universe.

Contents

Pre-requisites

  • Make sure you have installed Docker. If you are going to use Selenium Grid or run screenshot tests exclusively in CI you don't need Docker in that case.
  • Supported Storybook versions: >= 7.x.x
  • Supported Node.js versions: >= 18.x.x

How to start

  • Install creevey package
yarn add -D creevey
  • Start Creevey Web UI Runner. With -s flag Creevey will start Storybook automatically. (To run headless from CLI, omit the --ui flag)
yarn creevey test -s --ui

NOTE: In first run you may noticed, that all your tests are failing, it because you don't have source screenshot images yet. If you think, that all images are acceptable, you can approve them all from UI.

NOTE: Creevey captures screenshot of the #storybook-root element and sometimes you need to capture a whole browser viewport. To achieve this you could define captureElement Creevey parameter for story or kind. Or you may pass any different css selector. No Storybook addon is required — Creevey reads parameters directly from your stories/config.

// stories/MyModal.stories.tsx
export default {
  title: 'MyModal',
  component: MyModal,
};

export const MyModalStory = { creevey: { captureElement: null } };

Comparison with other tools

Features\Tools Creevey Loki Storyshots Hermione BackstopJS Percy/Happo Chromatic
Easy-to-Setup :heavy_check_mark: :heavy_check_mark: :warning: :no_entry: :no_entry: :heavy_check_mark: :heavy_check_mark:
Storybook Support :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :no_entry: :no_entry: :heavy_check_mark: :heavy_check_mark:
Run tests from Web UI :heavy_check_mark: :no_entry: :no_entry: :no_entry: :no_entry: :no_entry: :no_entry:
Cross-browser :heavy_check_mark: :warning: :no_entry: :heavy_check_mark: :no_entry: :heavy_check_mark: :heavy_check_mark:
Test Interaction :heavy_check_mark: :no_entry: :warning: :heavy_check_mark: :heavy_check_mark: :no_entry: :no_entry:
UI Test Runner :heavy_check_mark: :no_entry: :no_entry: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark: :heavy_check_mark:
Built-in Docker :heavy_check_mark: :heavy_check_mark: :no_entry: :no_entry: :heavy_check_mark: :warning: :warning:
Tests hot-reload :heavy_check_mark: :no_entry: :no_entry: :no_entry: :no_entry: :no_entry: :no_entry:
OSS/SaaS OSS OSS OSS OSS OSS SaaS SaaS

Selenium idle sessions and recovery

Creevey does not keep Selenium sessions alive while a worker is idle. In UI mode, once a worker finishes its runs, the grid reaps the idle session after its own idle timeout (Selenoid ~60s, Selenium Grid 4 ~300s). When you trigger the next run, Creevey detects the reaped session and recreates it transparently — you just see a short delay on the first test after inactivity, then tests continue normally. No keep-alive traffic is sent while idle, so metered grids only bill for active runs plus the short idle window.

You can tune how long an idle session lives before it ends by setting the grid's idle timeout through seleniumCapabilities. Keep it above Creevey's internal probe threshold of 30s; a shorter value lets the grid reap a session inside the window where Creevey skips its liveness check:

// creevey.config.ts
import { CreeveyConfig } from 'creevey';
import { SeleniumWebdriver } from 'creevey/selenium';

const config: CreeveyConfig = {
  webdriver: SeleniumWebdriver,
  gridUrl: 'http://selenium-hub:4444/wd/hub',
  browsers: {
    chrome: {
      browserName: 'chrome',
      seleniumCapabilities: {
        // Selenoid (default docker grid): duration string, keep > 30s
        sessionTimeout: '60s',
      },
    },
  },
};

export default config;

Note Selenium Grid 4 sets its session timeout on the server (--session-timeout), not via a capability. See Use your Selenium Grid for more on idle sessions and billing.

Future plans

  • Allow to define different viewport sizes for specific stories or capture story with different args.
  • And more, check TODO for more details. Also feel free to ask about feature that you want

Known issues

Docker-in-Docker

Currently it's not possible to run Creevey in this configuration. I'll fix this in later versions. If you use CircleCI or another CI that use docker to run jobs. Try to configure to use virtual machine executor

Update I added support to use local browsers. So it should be possible run Creevey inside docker. The only issue, that you need to find or build docker image with node, browser and selenium-webdriver. I'll add special images for Creevey later.

Chrome webdriver + 1px border with border-radius.

This cause to flaky screenshots. Possible solutions:

  • Increase threshold ratio in Creevey config diffOptions: { threshold: 0.1 }
  • Replace border to box-shadow border: 1px solid red -> box-shadow: 0 0 0 1px red
  • Set max retries to more than 5

Used by

Whisk SKB Kontur ABBYY

License

FOSSA Status

관련 프로젝트 살펴보기

불러오는 중…