本文へスキップ

テスト出力

情報

このWebdriverIOデモサイトは、サンプル画像出力に使用されています。

enableLayoutTesting

これはサービスオプションメソッドレベルの両方で設定できます。

// wdio.conf.(js|ts)
export const config = {
// ...
// =====
// Setup
// =====
services: [
[
'visual',
{
enableLayoutTesting: true
}
]
]
// ...
}

サービスオプションの画像出力はメソッドと等しくなります。以下を参照してください。

画像出力

await browser.saveElement(".features_vqN4", "example-element-tag", {enableLayoutTesting: true})
// Or
await browser.checkElement(".features_vqN4", "example-element-tag", {enableLayoutTesting: true})

saveElement Desktop

save(Screen/Element/FullPageScreen)

コンソール出力

save(Screen/Element/FullPageScreen)メソッドは、メソッドの実行後に以下の情報を提供します。

const saveResult = await browser.saveFullPageScreen({ ... })
console.log(saveResults)
/**
* {
* // The device pixel ratio of the instance that has run
* devicePixelRatio: 1,
* // The formatted filename, this depends on the options `formatImageName`
* fileName: "examplePage-chrome-latest-1366x768.png",
* // The path where the actual screenshot file can be found
* path: "/path/to/project/.tmp/actual/desktop_chrome",
* };
*/

画像出力

await browser.saveElement(".hero__title-logo", "example-element-tag")

saveElement Desktop

check(Screen/Element/FullPageScreen)

コンソール出力

デフォルトでは、check(Screen/Element/FullPageScreen)メソッドは1.23のような不一致率のみを提供しますが、プラグインにreturnAllCompareData: trueオプションがある場合、メソッドの実行後に以下の情報が提供されます。

const checkResult = await browser.checkFullPageScreen({ ... })
console.log(checkResult)
/**
* {
* // The formatted filename, this depends on the options `formatImageName`
* fileName: "examplePage-chrome-headless-latest-1366x768.png",
* folders: {
* // The actual folder and the file name
* actual: "/path/to/project/.tmp/actual/desktop_chrome/examplePage-chrome-headless-latest-1366x768.png",
* // The baseline folder and the file name
* baseline:
* "/path/to/project/localBaseline/desktop_chrome/examplePage-chrome-headless-latest-1366x768.png",
* // This following folder is optional and only if there is a mismatch
* // The folder that holds the diffs and the file name
* diff: "/path/to/project/.tmp/diff/desktop_chrome/examplePage-chrome-headless-latest-1366x768.png",
* },
* // The mismatch percentage
* misMatchPercentage: 2.34,
* };
*/

画像出力

情報

以下の画像は、checkコマンドを実行した結果の差異のみを示しています。ブラウザでの差異のみが表示されますが、AndroidとiOSの出力が同じであることに注意してください。

await browser.checkElement("#__docusaurus_skipToContent_fallback > header > div > div.buttons_pzbO > a:nth-child(1)", "example-element-tag")
情報

ボタンのテキストが「Get Started」から「Getting Started!」に変更され、変更として検出されました。

Button Check Result

ブロックアウト

ここでは、Android NativeWebScreenshotとiOSでのブロックアウトの出力例を示します。ステータスとアドレス、ツールバーがブロックアウトされています。

Blockouts Android

ようこそ!お手伝いできることはありますか?

WebdriverIO AI Copilot