MCPcopy Index your code
hub / github.com/codeceptjs/CodeceptJS / seeCssPropertiesOnElements

Method seeCssPropertiesOnElements

lib/helper/Playwright.js:2807–2836  ·  view source on GitHub ↗

* {{> seeCssPropertiesOnElements }} *

(locator, cssProperties)

Source from the content-addressed store, hash-verified

2805 *
2806 */
2807 async seeCssPropertiesOnElements(locator, cssProperties) {
2808 const res = await this._locate(locator)
2809 assertElementExists(res, locator)
2810
2811 const cssPropertiesCamelCase = convertCssPropertiesToCamelCase(cssProperties)
2812 const elemAmount = res.length
2813 let props = []
2814
2815 for (const element of res) {
2816 for (const prop of Object.keys(cssProperties)) {
2817 const cssProp = await this.grabCssPropertyFrom(locator, prop)
2818 if (isColorProperty(prop)) {
2819 props.push(convertColorToRGBA(cssProp))
2820 } else {
2821 props.push(cssProp)
2822 }
2823 }
2824 }
2825
2826 const values = Object.keys(cssPropertiesCamelCase).map(key => cssPropertiesCamelCase[key])
2827 if (!Array.isArray(props)) props = [props]
2828 let chunked = chunkArray(props, values.length)
2829 chunked = chunked.filter(val => {
2830 for (let i = 0; i < val.length; ++i) {
2831 if (val[i] != values[i]) return false
2832 }
2833 return true
2834 })
2835 return equals(`all elements (${new Locator(locator)}) to have CSS property ${JSON.stringify(cssProperties)}`).assert(chunked.length, elemAmount)
2836 }
2837
2838 /**
2839 * {{> seeAttributesOnElements }}

Callers

nothing calls this directly

Calls 11

_locateMethod · 0.95
grabCssPropertyFromMethod · 0.95
isColorPropertyFunction · 0.90
convertColorToRGBAFunction · 0.90
chunkArrayFunction · 0.90
equalsFunction · 0.90
pushMethod · 0.80
filterMethod · 0.80
assertMethod · 0.80
assertElementExistsFunction · 0.70

Tested by

no test coverage detected