robotframework-crypto
robotframework-crypto copied to clipboard
variable_decryption = True does not automatically decrypt variables needed during Suite Setup
I have noticed that variables needed during Suite Setup are not automatically decrypted even though the library is imported during Suite Setup with variable_decryption = True. To get this to work, I had to move any setup steps where I need to decrypt a variable value into a test case instead of in Suite Setup (or call Get Decrypted Text). See my rough examples below. Is the library intended to work this way?
Example.resource
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${CRYPTO_KEYPATH} = path/to/crypto/keys
${SYS_USERNAME} = TestUser
${SYS_PASSWORD} = crypt:somelongencryptedstringgeneratedbythecryptolibrary
*** Keywords ***
Setup Crypto
[Arguments] ${keyPath}=${CRYPTO_KEYPATH}
BuiltIn.Import Library CryptoLibrary key_path=${keyPath} variable_decryption=True
Login
[Arguments] ${username}=${SYS_USERNAME} ${password}=${SYS_PASSWORD}
SeleniumLibrary.Input Text= id=username ${username}
SeleniumLibrary.Input Password id=password ${password}
SeleniumLibrary.Click Element id=submit
NonWorking_Example.robot
*** Settings ***
Resource ./Example.resource
Suite Setup BuiltIn.Run Keywords Example.Setup Crypto
... AND Example.Login
*** Test Cases ***
Test Case 1
[Documentation] My First Test
Some Keyword
Working_Example.robot
*** Settings ***
Resource ./Example.resource
Suite Setup Example.Setup Crypto
*** Test Cases ***
Login
[Documentation] Logs into the system
Example.Login
Test Case 1
[Documentation] My First Test
Some Keyword