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

Method seeCssPropertiesOnElements

lib/helper/WebDriver.js:1757–1786  ·  view source on GitHub ↗

* {{> seeCssPropertiesOnElements }}

(locator, cssProperties)

Source from the content-addressed store, hash-verified

1755 * {{> seeCssPropertiesOnElements }}
1756 */
1757 async seeCssPropertiesOnElements(locator, cssProperties) {
1758 const res = await this._locate(locator)
1759 assertElementExists(res, locator)
1760
1761 const cssPropertiesCamelCase = convertCssPropertiesToCamelCase(cssProperties)
1762 const elemAmount = res.length
1763 let props = []
1764
1765 for (const element of res) {
1766 for (const prop of Object.keys(cssProperties)) {
1767 const cssProp = await this.grabCssPropertyFrom(locator, prop)
1768 if (isColorProperty(prop)) {
1769 props.push(convertColorToRGBA(cssProp))
1770 } else {
1771 props.push(cssProp)
1772 }
1773 }
1774 }
1775
1776 const values = Object.keys(cssPropertiesCamelCase).map(key => cssPropertiesCamelCase[key])
1777 if (!Array.isArray(props)) props = [props]
1778 let chunked = chunkArray(props, values.length)
1779 chunked = chunked.filter(val => {
1780 for (let i = 0; i < val.length; ++i) {
1781 if (val[i] != values[i]) return false
1782 }
1783 return true
1784 })
1785 return equals(`all elements (${new Locator(locator)}) to have CSS property ${JSON.stringify(cssProperties)}`).assert(chunked.length, elemAmount)
1786 }
1787
1788 /**
1789 * {{> 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