Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

variable_decryption = True does not automatically decrypt variables needed during Suite Setup #22

Open
sparkymartin opened this issue Oct 28, 2022 · 0 comments

Comments

@sparkymartin
Copy link

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant