I use JavaScript, Webdriver.io and Chai.
Here’s my code:
<code>async $checkCSSProperty(getElement, cssProperty, expectedValue) {
const element = await handleLocator(getElement);
const value = await element.getCSSProperty(cssProperty);
await expect(value.value).toBe(expectedValue);
}
await assertions.$checkCSSProperty(PassportPage.dateOfIssue, 'border', '1px solid rgb(250, 85, 85)');
</code>
<code>async $checkCSSProperty(getElement, cssProperty, expectedValue) {
const element = await handleLocator(getElement);
const value = await element.getCSSProperty(cssProperty);
await expect(value.value).toBe(expectedValue);
}
await assertions.$checkCSSProperty(PassportPage.dateOfIssue, 'border', '1px solid rgb(250, 85, 85)');
</code>
async $checkCSSProperty(getElement, cssProperty, expectedValue) {
const element = await handleLocator(getElement);
const value = await element.getCSSProperty(cssProperty);
await expect(value.value).toBe(expectedValue);
}
await assertions.$checkCSSProperty(PassportPage.dateOfIssue, 'border', '1px solid rgb(250, 85, 85)');
Every time I run autotest, it returns the different value of border of input: 1px solid rgb(172, 174, 153), 1px solid rgb(187, 158, 148) and 1px solid rgb(180, 166, 156) (expected – 1px solid rgb(250, 85, 85)). Why do this happen and how to fix it?
Values of border color of this input become this color after entering invalid data. When I run test I see that the color of the border matches the color I set in assertion, but it returns different color.
I tried to change function to
<code>async $haveAttr(getElement, attr, attrValue) {
const element = await handleLocator(getElement);
await expect(element).toHaveAttr(attr, attrValue);
}
</code>
<code>async $haveAttr(getElement, attr, attrValue) {
const element = await handleLocator(getElement);
await expect(element).toHaveAttr(attr, attrValue);
}
</code>
async $haveAttr(getElement, attr, attrValue) {
const element = await handleLocator(getElement);
await expect(element).toHaveAttr(attr, attrValue);
}
It returns null.
6