Loki

Loki

  • Getting Started
  • Configuration
  • Command Line Arguments

›API Reference

Introduction

  • Getting started

API Reference

  • Configuration
  • Command line arguments

Guides

  • Continuous Integration
  • Serverless renderer
  • Handling Flaky Tests

Command line arguments

If you run loki via yarn or npm, you need to make sure to prepend your argument list with -- so that yarn passes them though to loki. You can also add ./node_modules/.bin to your PATH to be able to run loki directly.

loki test

Capture screenshots and compare them against the reference files.

yarn loki test -- --port 9009
FlagDescriptionDefault
--hostStorybook hostlocalhost
--portStorybook portNone
--reactUriURI to base of React Storybook. For static build use file:./storybook-static.None
--reactPortReact Storybook port6006
--reactNativePortReact Native Storybook port7007
--referencePath to screenshot reference folder./.loki/reference
--outputPath to screenshot output folder./.loki/current
--differencePath to image diff folder./.loki/difference
--diffingEngineWhat diffing engine to use, currently supported are pixelmatch, looks-same and gmpixelmatch
--chromeAwsLambdaBatchSizeNumber of stories to test per lambda invocation.1
--chromeAwsLambdaBatchConcurrencyNumber of stories to test in parallel per lambda invocation.1
--chromeAwsLambdaFunctionNameName of the use to capture screenshots.loki
--chromeAwsLambdaRetriesThe number of retries for invoking the lambda, in case of failure.0
--chromeConcurrencyHow many stories to test in parallel when using chrome4
--chromeDockerImageWhat docker image to use when running chromeyukinying/chrome-headless-browser-stable:100.0.4896.127
--chromeDockerWithoutSeccompRun chrome docker without custom seccomp settings.false
--chromeDockerUseCopyUse docker copy instead of volume mount for local storiesfalse
--chromeEnableAnimationsEnable CSS transitions and animations.false
--chromeFlagsCustom chrome flags.--headless --disable-gpu --hide-scrollbars
--chromeLoadTimeoutHow many milliseconds loki will wait for the page to load before taking as screenshot.60000
--chromeRetriesThe number of retries for taking the screenshot, in case of failure.0
--chromeSelectorCSS selector to the part of the DOM to screenshot. Useful you have decorators that should be excluded.#root > *
--chromeToleranceHow many percent tolerated difference compared to reference image. Behaviour of tolerance depends on diffingEngine.0
--chromeEmulatedMediaEmulates the given media for CSS media queries. Set to print to test print styles.None
--skipStoriesDEPRECATED Regular expression for stories that should not be tested, it will be tested against a string with the format ${kind} ${story}.None
--storiesFilterOpposite of --skipStories.None
--configurationFilterRegular expression for targets that should be tested.None
--targetFilterRegular expression for targets that should be tested.None
--requireReferenceFail stories without reference image, useful for CI.False, true for CI
--passWithNoStoriesIf no stories are detected consider this a success.False
--verboseRendererPlain text renderer, useful for CI.False, true for CI
--silentPlain text renderer that will only output errors.false
--dockerWithSudoRun docker commands with sudo.false
--dockerNetArgument to pass to docker --net, e.g. host or bridge.None
--deviceDevice/emulator ID to target for screenshots. Useful when running multiple devices on a single machine.None

loki update

Capture screenshots and update the reference files.

Takes same arguments as loki test.

loki approve

Prunes old and updates reference files with the images generated in the last run.

FlagDescriptionDefault
--referencePath to screenshot reference folder./.loki/reference
--outputPath to screenshot output folder./.loki/current

loki init

yarn run loki init path/to/storybook -- --force
FlagDescriptionDefault
--configPath to storybook folder.storybook & storybook
--forceOverwrite loki configurationfalse
Last updated on 3/15/2023
← ConfigurationContinuous Integration →
  • loki test
  • loki update
  • loki approve
  • loki init
Loki
Docs
Getting StartedAPI ReferenceGuides
Community
User Showcase
More
GitHubStar
Follow @trastknast
Copyright © 2023 Joel Arvidsson