Skip to content

fix: seeCssPropertiesOnElements failed when font-weight is a number #4026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion lib/helper/Playwright.js
Original file line number Diff line number Diff line change
Expand Up @@ -2116,7 +2116,9 @@ class Playwright extends Helper {
let chunked = chunkArray(props, values.length);
chunked = chunked.filter((val) => {
for (let i = 0; i < val.length; ++i) {
if (val[i] !== values[i]) return false;
const _acutal = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(val[i], 10);
const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10);
if (_acutal !== _expected) return false;
}
return true;
});
Expand Down
8 changes: 6 additions & 2 deletions lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1784,7 +1784,9 @@ class Puppeteer extends Helper {
let chunked = chunkArray(props, values.length);
chunked = chunked.filter((val) => {
for (let i = 0; i < val.length; ++i) {
if (val[i] !== values[i]) return false;
const _acutal = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(val[i], 10);
const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10);
if (_acutal !== _expected) return false;
}
return true;
});
Expand Down Expand Up @@ -1815,7 +1817,9 @@ class Puppeteer extends Helper {
let chunked = chunkArray(attrs, values.length);
chunked = chunked.filter((val) => {
for (let i = 0; i < val.length; ++i) {
if (val[i] !== values[i]) return false;
const _acutal = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(val[i], 10);
const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10);
if (_acutal !== _expected) return false;
}
return true;
});
Expand Down
8 changes: 6 additions & 2 deletions lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,9 @@ class WebDriver extends Helper {
let chunked = chunkArray(props, values.length);
chunked = chunked.filter((val) => {
for (let i = 0; i < val.length; ++i) {
if (val[i] !== values[i]) return false;
const _acutal = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(val[i], 10);
const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10);
if (_acutal !== _expected) return false;
}
return true;
});
Expand All @@ -1535,7 +1537,9 @@ class WebDriver extends Helper {
let chunked = chunkArray(attrs, values.length);
chunked = chunked.filter((val) => {
for (let i = 0; i < val.length; ++i) {
if (val[i] !== values[i]) return false;
const _acutal = Number.isNaN(val[i]) || (typeof values[i]) === 'string' ? val[i] : Number.parseInt(val[i], 10);
const _expected = Number.isNaN(values[i]) || (typeof values[i]) === 'string' ? values[i] : Number.parseInt(values[i], 10);
if (_acutal !== _expected) return false;
}
return true;
});
Expand Down
4 changes: 4 additions & 0 deletions test/data/app/view/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
.span {
height: 15px;
}
h4 {
font-weight: 300;
}
</style>
<body>

Expand All @@ -23,6 +26,7 @@
<div class="notice"><?php if (isset($notice)) echo $notice; ?></div>

<h3>Don't do that at home!</h3>
<h4>Check font-weight!</h4>

<p>Is that interesting?</p>

Expand Down
4 changes: 2 additions & 2 deletions test/helper/webapi.js
Original file line number Diff line number Diff line change
Expand Up @@ -1369,8 +1369,8 @@ module.exports.tests = function () {

try {
await I.amOnPage('/info');
await I.seeCssPropertiesOnElements('h3', {
'font-weight': 'bold',
await I.seeCssPropertiesOnElements('h4', {
'font-weight': 300,
});
await I.seeCssPropertiesOnElements('h3', {
'font-weight': 'bold',
Expand Down