File tree 5 files changed +25
-2
lines changed
5 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -2188,6 +2188,8 @@ class Playwright extends Helper {
2188
2188
let chunked = chunkArray ( attrs , values . length ) ;
2189
2189
chunked = chunked . filter ( ( val ) => {
2190
2190
for ( let i = 0 ; i < val . length ; ++ i ) {
2191
+ // the attribute could be a boolean
2192
+ if ( typeof val [ i ] === 'boolean' ) return val [ i ] === values [ i ] ;
2191
2193
// if the attribute doesn't exist, returns false as well
2192
2194
if ( ! val [ i ] || ! val [ i ] . includes ( values [ i ] ) ) return false ;
2193
2195
}
Original file line number Diff line number Diff line change @@ -1842,6 +1842,8 @@ class Puppeteer extends Helper {
1842
1842
for ( let i = 0 ; i < val . length ; ++ i ) {
1843
1843
const _actual = Number . isNaN ( val [ i ] ) || ( typeof values [ i ] ) === 'string' ? val [ i ] : Number . parseInt ( values [ i ] , 10 ) ;
1844
1844
const _expected = Number . isNaN ( values [ i ] ) || ( typeof values [ i ] ) === 'string' ? values [ i ] : Number . parseInt ( values [ i ] , 10 ) ;
1845
+ // the attribute could be a boolean
1846
+ if ( typeof _actual === 'boolean' ) return _actual === _expected ;
1845
1847
// if the attribute doesn't exist, returns false as well
1846
1848
if ( ! _actual || ! _actual . includes ( _expected ) ) return false ;
1847
1849
}
Original file line number Diff line number Diff line change @@ -1631,6 +1631,8 @@ class WebDriver extends Helper {
1631
1631
for ( let i = 0 ; i < val . length ; ++ i ) {
1632
1632
const _actual = Number . isNaN ( val [ i ] ) || ( typeof values [ i ] ) === 'string' ? val [ i ] : Number . parseInt ( val [ i ] , 10 ) ;
1633
1633
const _expected = Number . isNaN ( values [ i ] ) || ( typeof values [ i ] ) === 'string' ? values [ i ] : Number . parseInt ( values [ i ] , 10 ) ;
1634
+ // the attribute could be a boolean
1635
+ if ( typeof _actual === 'boolean' ) return _actual === _expected ;
1634
1636
if ( _actual !== _expected ) return false ;
1635
1637
}
1636
1638
return true ;
Original file line number Diff line number Diff line change 25
25
<a href="/spinner" qa-id = "test" qa-link = "test">Spinner</a>
26
26
</div>
27
27
28
+ <div id="area5" qa-id = "test">
29
+ <input qa-id = "test" qa-link = "test" disabled>Hidden input</a>
30
+ </div>
31
+
28
32
A wise man said: "debug!"
29
33
30
34
<?php print_r ($ _POST ); ?>
Original file line number Diff line number Diff line change @@ -1319,8 +1319,8 @@ module.exports.tests = function () {
1319
1319
} ) ;
1320
1320
1321
1321
describe ( '#seeAttributesOnElements' , ( ) => {
1322
- it . skip ( 'should check attributes values for given element' , async function ( ) {
1323
- if ( isHelper ( 'TestCafe' ) ) this . skip ( ) ;
1322
+ it ( 'should check attributes values for given element' , async function ( ) {
1323
+ if ( isHelper ( 'TestCafe' ) || isHelper ( 'WebDriver' ) ) this . skip ( ) ;
1324
1324
1325
1325
try {
1326
1326
await I . amOnPage ( '/info' ) ;
@@ -1387,6 +1387,19 @@ module.exports.tests = function () {
1387
1387
e . message . should . include ( 'expected all elements ({css: a[href="/team"]}) to have attributes {"disable":true} "0" to equal "1"' ) ;
1388
1388
}
1389
1389
} ) ;
1390
+
1391
+ it ( 'should verify the boolean attribute' , async function ( ) {
1392
+ if ( isHelper ( 'TestCafe' ) || isHelper ( 'WebDriver' ) ) this . skip ( ) ;
1393
+
1394
+ try {
1395
+ await I . amOnPage ( '/' ) ;
1396
+ await I . seeAttributesOnElements ( 'input' , {
1397
+ disabled : true ,
1398
+ } ) ;
1399
+ } catch ( e ) {
1400
+ e . message . should . include ( 'expected all elements (input) to have attributes {"disabled":true} "0" to equal "1"' ) ;
1401
+ }
1402
+ } ) ;
1390
1403
} ) ;
1391
1404
1392
1405
describe ( '#seeCssPropertiesOnElements' , ( ) => {
You can’t perform that action at this time.
0 commit comments