File tree Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Expand file tree Collapse file tree 4 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ const {
13
13
ucfirst,
14
14
fileExists,
15
15
chunkArray,
16
+ toCamelCase,
16
17
convertCssPropertiesToCamelCase,
17
18
screenshotOutputFolder,
18
19
getNormalizedKeyAttributeValue,
@@ -1462,7 +1463,7 @@ class Puppeteer extends Helper {
1462
1463
async grabCssPropertyFrom ( locator , cssProperty ) {
1463
1464
const els = await this . _locate ( locator ) ;
1464
1465
const res = await Promise . all ( els . map ( el => el . executionContext ( ) . evaluate ( el => JSON . parse ( JSON . stringify ( getComputedStyle ( el ) ) ) , el ) ) ) ;
1465
- const cssValues = res . map ( props => props [ cssProperty ] ) ;
1466
+ const cssValues = res . map ( props => props [ toCamelCase ( cssProperty ) ] ) ;
1466
1467
1467
1468
if ( res . length > 0 ) {
1468
1469
return cssValues ;
Original file line number Diff line number Diff line change @@ -210,6 +210,7 @@ function toCamelCase(name) {
210
210
return letter . toUpperCase ( ) ;
211
211
} ) ;
212
212
}
213
+ module . exports . toCamelCase = toCamelCase ;
213
214
214
215
function convertFontWeightToNumber ( name ) {
215
216
const fontWeightPatterns = [
Original file line number Diff line number Diff line change 9
9
color : white ;
10
10
height : 100px ;
11
11
width : 150px ;
12
+ user - select : text ;
12
13
}
13
14
div.dbl {
14
15
background : yellow ;
Original file line number Diff line number Diff line change @@ -1143,6 +1143,15 @@ module.exports.tests = function () {
1143
1143
const css = await I . grabCssPropertyFrom ( '#block' , 'height' ) ;
1144
1144
assert . equal ( css , '100px' ) ;
1145
1145
} ) ;
1146
+
1147
+ it ( 'should grab camelcased css properies' , async ( ) => {
1148
+ if ( isHelper ( 'Nightmare' ) ) return ;
1149
+ if ( isHelper ( 'TestCafe' ) ) return ;
1150
+
1151
+ await I . amOnPage ( '/form/doubleclick' ) ;
1152
+ const css = await I . grabCssPropertyFrom ( '#block' , 'user-select' ) ;
1153
+ assert . equal ( css , 'text' ) ;
1154
+ } ) ;
1146
1155
} ) ;
1147
1156
1148
1157
describe ( '#seeAttributesOnElements' , ( ) => {
You can’t perform that action at this time.
0 commit comments