diff --git a/Browser/base/librarycomponent.py b/Browser/base/librarycomponent.py index a19374c67..0b7dfcf28 100644 --- a/Browser/base/librarycomponent.py +++ b/Browser/base/librarycomponent.py @@ -311,6 +311,8 @@ def _replace_placeholder_variable(self, placeholder): if value is NOT_FOUND: logger.warn("Given variable placeholder could not be resolved.") return placeholder + if isinstance(value, Secret): + return value.value return value @property diff --git a/atest/test/02_Content_Keywords/secret.robot b/atest/test/02_Content_Keywords/secret.robot index ce3f86bf5..d8450a8cf 100644 --- a/atest/test/02_Content_Keywords/secret.robot +++ b/atest/test/02_Content_Keywords/secret.robot @@ -9,16 +9,52 @@ Test Setup Ensure Open Page ${LOGIN_URL} Test Tags require-rf-7.4+ *** Test Cases *** -Type Secret +Type Secret And Verify ${secret} = Get Secret Value Type Secret input#username_field ${secret} Get Text input#username_field == Joulupukki -Fill Secret +Fill Secret And Verify ${secret} = Get Secret Value Fill Secret input#username_field ${secret} Get Text input#username_field == Joulupukki +Type Secret And Fails With Curly Brackets + Set Browser Timeout 500ms scope=Test + ${secret} = Get Secret Value + TRY + Type Secret notHere ${secret} + EXCEPT * type=GLOB AS ${error} + Should Contain ${error} notHere + END + +Fill Secret And Fails With Curly Brackets + Set Browser Timeout 500ms scope=Test + ${secret} = Get Secret Value + TRY + Fill Secret notHere ${secret} + EXCEPT * type=GLOB AS ${error} + Should Contain ${error} notHere + END + +Type Secret And Fails Without Curly Brackets + Set Browser Timeout 500ms scope=Test + ${secret} = Get Secret Value + TRY + Type Secret notHere $secret + EXCEPT * type=GLOB AS ${error} + Should Contain ${error} notHere + END + +Fill Secret And Fails Without Curly Brackets + Set Browser Timeout 500ms scope=Test + ${secret} = Get Secret Value + TRY + Fill Secret notHere $secret + EXCEPT * type=GLOB AS ${error} + Should Contain ${error} notHere + END + New Context With Secret As Literal In httpCredentials Is Not Supported ${secret} = Get Secret Value TRY