टेस्ट आउटपुट
जानकारी
इस WebdriverIO डेमो साइट का उपयोग उदाहरण इमेज आउटपुट के लिए किया गया है।
enableLayoutTesting
इसे सर्विस ऑप्शंस के साथ-साथ मेथड लेवल पर भी सेट किया जा सकता है।
// wdio.conf.(js|ts)
export const config = {
// ...
// =====
// Setup
// =====
services: [
[
'visual',
{
enableLayoutTesting: true
}
]
]
// ...
}
सर्विस ऑप्शंस के लिए इमेज आउटपुट मेथड के समान है, नीचे देखें।
इमेज आउटपुट
- saveElement | checkElement
- saveScreen | checkScreen
- saveFullPageScreen | checkFullPageScreen
- saveTabbablePage | checkTabbablePage
await browser.saveElement(".features_vqN4", "example-element-tag", {enableLayoutTesting: true})
// Or
await browser.checkElement(".features_vqN4", "example-element-tag", {enableLayoutTesting: true})
await browser.saveScreen("example-page-tag")
await browser.saveFullPageScreen("full-page-tag")
// Or
await browser.checkFullPageScreen("full-page-tag", {enableLayoutTesting: true})
await browser.saveTabbablePage("tabbable-page-tag")
// Or
await browser.checkTabbablePage("tabbable-page-tag", {enableLayoutTesting: true})
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",
* };
*/
इमेज आउटपुट
- saveElement
- saveScreen
- saveFullPageScreen
await browser.saveElement(".hero__title-logo", "example-element-tag")
- Desktop
- Android
- iOS
await browser.saveScreen("example-page-tag")
- Desktop
- Android ChromeDriver
- Android nativeWebScreenshot
- iOS
TIP
iOS saveScreen
क्रियान्वयन डिफ़ॉल्ट रूप से डिवाइस बेज़ेल कॉर्नर्स के साथ नहीं होते हैं। इसे प्राप्त करने के लिए सर्विस को इंस्टेंटिएट करते समय addIOSBezelCorners:true
विकल्प जोड़ें, यहाँ देखें
await browser.saveFullPageScreen("full-page-tag")
- Desktop
- Android
- iOS