Image comparison / visual regression testing for WebdriverIO
logLevel
property from the service options diff image are not stored if the logLevel
is set to debug
. To still get the Image Diffs for all checks you can provide the option --store-all-diffs
through the cli like thisnpm run wdio wdio.conf.ts -- --store-all-diffs
logLevel
property from the service options diff image are not stored if the logLevel
is set to debug
. To still get the Image Diffs for all checks you can provide the option --store-all-diffs
through the cli like thisnpm run wdio wdio.conf.ts -- --store-all-diffs
f878cab: # π Feature
npx wdio tests/configs/wdio.local.desktop.storybook.conf.ts --storybook --devices="iPhone 14 Pro Max","Pixel 3 XL"
f878cab: # π Feature
npx wdio tests/configs/wdio.local.desktop.storybook.conf.ts --storybook --devices="iPhone 14 Pro Max","Pixel 3 XL"
Updated dependencies [f878cab]
b717d9a: # π₯ Breaking changes
Automatically scan local/remote storybook instances to create element screenshots of each component by adding
export const config: Options.Testrunner = {
// ...
services: ["visual"],
// ....
};
to your services
and running npx wdio tests/configs/wdio.local.desktop.storybook.conf.ts --storybook
through the command line.
It will automatically use Chrome. The following options can be provided through the command line
--headless
, defaults to true
--numShards {number}
, this will be the amount of parallel instances that will be used to run the stories. This will be limited by the maxInstances
in your wdio.conf
-file. When running in headless
-mode then do not increase the number to more than 20 to prevent flakiness
--clip {boolean}
, try to take an element instead of a viewport screenshot, defaults to true
--clipSelector {string}
, this is the selector that will be used to:
defaults to #storybook-root > :first-child
for V7 and #root > :first-child:not(script):not(style)
for V6
--version
, the version of storybook, defaults to 7. This is needed to know if the V6 clipSelector
needs to be used.
--browsers {edge,chrome,safari,firefox}
, defaults to Chrome
--skipStories
, this can be:
example-button--secondary,example-button--small
)"/.*button.*/gm"
) to skip certain storiesYou can also provide service options
export const config: Options.Testrunner = {
// ...
services: [
[
'visual',
{
// Some default options
baselineFolder: join(process.cwd(), './__snapshots__/'),
debug: true,
// The storybook options
storybook: {
clip: false,
clipSelector: ''#some-id,
numShards: 4,
skipStories: ['example-button--secondary', 'example-button--small'],
url: 'https://www.bbc.co.uk/iplayer/storybook/',
version: 6,
},
},
],
],
// ....
}
The baseline images will be stored in the following structure:
{projectRoot}
|_`__snapshots__`
|_`{category}`
|_`{componentName}`
|_{browserName}
|_`{{component-id}-element-{browser}-{resolution}-dpr-{dprValue}}.png`
which will look like this
[!NOTE] Storybook 6.5 or higher is supported
hideScrollBars
is disabled by default when using the Storybook runner
The element has no width or height. We defaulted to the viewport screen size of width: ${width} and height: ${height}.
b717d9a: # π₯ Breaking changes
Automatically scan local/remote storybook instances to create element screenshots of each component by adding
export const config: Options.Testrunner = {
// ...
services: ["visual"],
// ....
};
to your services
and running npx wdio tests/configs/wdio.local.desktop.storybook.conf.ts --storybook
through the command line.
It will automatically use Chrome. The following options can be provided through the command line
--headless
, defaults to true
--numShards {number}
, this will be the amount of parallel instances that will be used to run the stories. This will be limited by the maxInstances
in your wdio.conf
-file. When running in headless
-mode then do not increase the number to more than 20 to prevent flakiness
--clip {boolean}
, try to take an element instead of a viewport screenshot, defaults to true
--clipSelector {string}
, this is the selector that will be used to:
defaults to #storybook-root > :first-child
for V7 and #root > :first-child:not(script):not(style)
for V6
--version
, the version of storybook, defaults to 7. This is needed to know if the V6 clipSelector
needs to be used.
--browsers {edge,chrome,safari,firefox}
, defaults to Chrome
--skipStories
, this can be:
example-button--secondary,example-button--small
)"/.*button.*/gm"
) to skip certain storiesYou can also provide service options
export const config: Options.Testrunner = {
// ...
services: [
[
'visual',
{
// Some default options
baselineFolder: join(process.cwd(), './__snapshots__/'),
debug: true,
// The storybook options
storybook: {
clip: false,
clipSelector: ''#some-id,
numShards: 4,
skipStories: ['example-button--secondary', 'example-button--small'],
url: 'https://www.bbc.co.uk/iplayer/storybook/',
version: 6,
},
},
],
],
// ....
}
The baseline images will be stored in the following structure:
{projectRoot}
|_`__snapshots__`
|_`{category}`
|_`{componentName}`
|_{browserName}
|_`{{component-id}-element-{browser}-{resolution}-dpr-{dprValue}}.png`
which will look like this
[!NOTE] Storybook 6.5 or higher is supported
hideScrollBars
is disabled by default when using the Storybook runner
The element has no width or height. We defaulted to the viewport screen size of width: ${width} and height: ${height}.
waitForFontsLoaded
so the module automatically waits for all fonts to be loaded, enabled by defaultenableLayoutTesting
so all text will become transparent so
waitForFontsLoaded
so the module automatically waits for all fonts to be loaded, enabled by defaultenableLayoutTesting
so all text will become transparent so
import { remote } from 'webdriverio'
import VisualService from '@wdio/visual-service'
const visualService = new VisualService({
autoSaveBaseline: true
})
const browser = await remote({
logLevel: 'silent',
capabilities: {
browserName: 'firefox',
}
})
// Add this to "Start" the service
visualService.remoteSetup(browser)
await browser.url('https://webdriver.io/')
await browser.checkScreen('examplePaged', {})
await browser.deleteSession()