Skip to content

Commit e63f824

Browse files
committed
fix: fix secret handling without curly braces
1 parent 88e29c7 commit e63f824

2 files changed

Lines changed: 40 additions & 2 deletions

File tree

Browser/base/librarycomponent.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,8 @@ def _replace_placeholder_variable(self, placeholder):
311311
if value is NOT_FOUND:
312312
logger.warn("Given variable placeholder could not be resolved.")
313313
return placeholder
314+
if isinstance(value, Secret):
315+
return value.value
314316
return value
315317

316318
@property

atest/test/02_Content_Keywords/secret.robot

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,52 @@ Test Setup Ensure Open Page ${LOGIN_URL}
99
Test Tags require-rf-7.4+
1010

1111
*** Test Cases ***
12-
Type Secret
12+
Type Secret And Verify
1313
${secret} = Get Secret Value
1414
Type Secret input#username_field ${secret}
1515
Get Text input#username_field == Joulupukki
1616

17-
Fill Secret
17+
Fill Secret And Verify
1818
${secret} = Get Secret Value
1919
Fill Secret input#username_field ${secret}
2020
Get Text input#username_field == Joulupukki
2121

22+
Type Secret And Fails With Curly Brackets
23+
Set Browser Timeout 500ms scope=Test
24+
${secret} = Get Secret Value
25+
TRY
26+
Type Secret notHere ${secret}
27+
EXCEPT * type=GLOB AS ${error}
28+
Should Contain ${error} notHere
29+
END
30+
31+
Fill Secret And Fails With Curly Brackets
32+
Set Browser Timeout 500ms scope=Test
33+
${secret} = Get Secret Value
34+
TRY
35+
Fill Secret notHere ${secret}
36+
EXCEPT * type=GLOB AS ${error}
37+
Should Contain ${error} notHere
38+
END
39+
40+
Type Secret And Fails Without Curly Brackets
41+
Set Browser Timeout 500ms scope=Test
42+
${secret} = Get Secret Value
43+
TRY
44+
Type Secret notHere $secret
45+
EXCEPT * type=GLOB AS ${error}
46+
Should Contain ${error} notHere
47+
END
48+
49+
Fill Secret And Fails Without Curly Brackets
50+
Set Browser Timeout 500ms scope=Test
51+
${secret} = Get Secret Value
52+
TRY
53+
Fill Secret notHere $secret
54+
EXCEPT * type=GLOB AS ${error}
55+
Should Contain ${error} notHere
56+
END
57+
2258
New Context With Secret As Literal In httpCredentials Is Not Supported
2359
${secret} = Get Secret Value
2460
TRY

0 commit comments

Comments
 (0)