Skip to content

Commit

Permalink
fix: seeCssPropertiesOnElements failed when font-wieght is a numberfi…
Browse files Browse the repository at this point in the history
…x: seeCssPropertiesOnElements failed when font-wieght is a number
  • Loading branch information
kobenguyent committed Nov 24, 2023
1 parent 1e5dd80 commit b616ec5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 5 deletions.
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
4 changes: 3 additions & 1 deletion lib/helper/Puppeteer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1815,7 +1815,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
4 changes: 3 additions & 1 deletion lib/helper/WebDriver.js
Original file line number Diff line number Diff line change
Expand Up @@ -1535,7 +1535,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

0 comments on commit b616ec5

Please sign in to comment.