diff --git a/.gitignore b/.gitignore index 89d4c62..8438b93 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ atest/report.html atest/screenshot/ atest/logs/ atest/screenshots/ +/Work # Python virtual environment .venv diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3933005..be8e19e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -17,7 +17,7 @@ Here are some guidelines to help you get started: - When creating new user keywords, please provide documentation. - Write tests for your changes. You may need to include unit tests, acceptance tests, or both, depending on the change you made. - Format your code by running `inv lint` from the cloned folder. -- Ensure all tests pass by running `inv utest` for unit tests and `inv atest` for acceptance tests. +- Ensure all tests pass by running `inv utest` for unit tests and `inv atest` for acceptance tests again from the cloned folder. - Push your changes to your fork on GitHub. - Create a pull request. diff --git a/README.md b/README.md index 442359f..bf27157 100644 --- a/README.md +++ b/README.md @@ -117,13 +117,12 @@ docker run --user mfuser -v /path/to/your/tests:/home/mfuser/tests mainframe3270 Interested in contributing to the project? Great to hear! Whether you found a bug, or want to develop a new feature, please refer to our [Contributing Guidelines](CONTRIBUTING.md) to help you get started. -## Keyword Tests - -To run all the library tests, you will need to create a user on the [pub400](https://www.pub400.com/) website. - -## WIKI +## Wiki For more information visit the repository [Wiki](https://github.com/Altran-PT-GDC/Robot-Framework-Mainframe-3270-Library/wiki). +## Changelog +For an overview of the (latest) changes see [CHANGELOG](CHANGELOG.md). + ## Authors - **Altran -** [Altran Web Site](https://www.altran.com/us/en/) - **Samuel Cabral** diff --git a/atest/connection.robot b/atest/connection.robot index a449581..e21f589 100644 --- a/atest/connection.robot +++ b/atest/connection.robot @@ -44,9 +44,10 @@ Create Session File ${session_file}= Set Variable ${CURDIR}/resources/session.s3270 END Copy File ${SESSION_TEMPLATE} ${session_file} - RETURN ${session_file} + # Using legacy [Return] for older RF versions + [Return] ${session_file} Test Teardown - Close Connection + Run Keyword And Ignore Error Close Connection Sleep 1 second Remove File ${TRACE_FILE} diff --git a/atest/mainframe.robot b/atest/mainframe.robot index 4eba8ef..7fb279c 100644 --- a/atest/mainframe.robot +++ b/atest/mainframe.robot @@ -1,10 +1,7 @@ *** Settings *** -Documentation These tests verify that all keywords are working correctly and displaying the expected exception message. -... To run all the tests, you will need to create a user in the https://www.pub400.com/ website, -... this will affect the last test "Test With Login" +Documentation These tests verify that all keywords are working correctly and displaying the expected exception messages. Library ../Mainframe3270/ run_on_failure_keyword=None -Library Dialogs Library OperatingSystem Library String Resource pub400_variables.robot @@ -17,32 +14,33 @@ Suite Teardown Suite Teardown Exception Test Read Wait Field Detected ${read_text} Read 1 10 21 - Run Keyword And Expect Error ${WELCOME_TEXT_EXPECTED_ERROR} Should Be Equal As Strings ${WELCOME_TITLE} + Run Keyword And Expect Error + ... ${WELCOME_TEXT_EXPECTED_ERROR} + ... Should Be Equal As Strings + ... ${WELCOME_TITLE} ... ${read_text} Run Keyword And Expect Error ${X_AXIS_EXCEEDED_EXPECTED_ERROR} Read 4 48 34 Run Keyword And Expect Error ${X_AXIS_EXCEEDED_EXPECTED_ERROR} Read 4 81 1 Run Keyword And Expect Error ${Y_AXIS_EXCEEDED_EXPECTED_ERROR} Read 25 48 34 Exception Test Write In Position + Run Keyword And Expect Error ${X_AXIS_EXCEEDED_EXPECTED_ERROR} Write In Position ${WRITE_TEXT} 10 81 + Run Keyword And Expect Error ${Y_AXIS_EXCEEDED_EXPECTED_ERROR} Write In Position ${WRITE_TEXT} 25 10 + +Exception Test Write Bare In Position Run Keyword And Expect Error ... ${X_AXIS_EXCEEDED_EXPECTED_ERROR} - ... Write In Position + ... Write Bare In Position ... ${WRITE_TEXT} ... 10 ... 81 Run Keyword And Expect Error ... ${Y_AXIS_EXCEEDED_EXPECTED_ERROR} - ... Write In Position + ... Write Bare In Position ... ${WRITE_TEXT} ... 25 ... 10 -Exception Test Write Bare In Position - Run Keyword And Expect Error ${X_AXIS_EXCEEDED_EXPECTED_ERROR} Write Bare In Position ${WRITE_TEXT} 10 - ... 81 - Run Keyword And Expect Error ${Y_AXIS_EXCEEDED_EXPECTED_ERROR} Write Bare In Position ${WRITE_TEXT} 25 - ... 10 - Exception Test Page Should Contain String Verify String Not Found Page Should Contain String ${WELCOME_WRONG_CASE} Verify String Not Found Page Should Contain String ${STRING_NON_EXISTENT} ignore_case=${True} @@ -54,16 +52,27 @@ Exception Test Page Should Contain All Strings ... ${LIST_STRINGS_WRONG_CASE_IN_THE_SECONDS} ... 2 Verify String Not Found In List Page Should Contain All Strings ${LIST_STRINGS_WRONG_CASE_IN_THE_THIRD} 3 - Verify String Not Found In List Page Should Contain All Strings ${LIST_STRINGS_WRONG_IN_THE_FIRST} 1 + Verify String Not Found In List + ... Page Should Contain All Strings + ... ${LIST_STRINGS_WRONG_IN_THE_FIRST} + ... 1 ... ignore_case=${True} - Verify String Not Found In List Page Should Contain All Strings ${LIST_STRINGS_WRONG_IN_THE_SECOND} 2 + Verify String Not Found In List + ... Page Should Contain All Strings + ... ${LIST_STRINGS_WRONG_IN_THE_SECOND} + ... 2 ... ignore_case=${True} - Verify String Not Found In List Page Should Contain All Strings ${LIST_STRINGS_WRONG_IN_THE_THIRD} 3 + Verify String Not Found In List + ... Page Should Contain All Strings + ... ${LIST_STRINGS_WRONG_IN_THE_THIRD} + ... 3 ... ignore_case=${True} Exception Test Page Should Contain Any String Verify List Not Found Page Should Contain Any String ${LIST_STRINGS_ALL_WRONG_CASE} - Verify List Not Found Page Should Contain Any String ${LIST_STRINGS_NON_EXITENT_IGNORE_CASE} + Verify List Not Found + ... Page Should Contain Any String + ... ${LIST_STRINGS_NON_EXITENT_IGNORE_CASE} ... ignore_case=${True} Exception Test Page Should Contain Match @@ -72,8 +81,12 @@ Exception Test Page Should Contain Match Exception Test Page Should Contain String X Times Verify String Does Not Appear X Times Page Should Contain String X Times ${TEXT_TO_COUNT} 1 3 - Verify String Does Not Appear X Times Page Should Contain String X Times ${TEXT_TO_COUNT_WRONG_CASE} 1 - ... 5 ignore_case=${True} + Verify String Does Not Appear X Times + ... Page Should Contain String X Times + ... ${TEXT_TO_COUNT_WRONG_CASE} + ... 1 + ... 5 + ... ignore_case=${True} Exception Test Page Should Match Regex Verify Pattern Not Found Page Should Match Regex ${INVALID_REGEX} @@ -191,7 +204,7 @@ Test Move Next Field Sleep 1s Test Move Previous Field - # Send two Move Previous Field because the first only put the cursor int he beginning of the password field + # Send two Move Previous Field because the first only puts the cursor at the beginning of the password field Move Previous Field Move Previous Field Write Bare ${WRITE_TEXT} @@ -200,34 +213,16 @@ Test Move Previous Field Sleep 1s Test Send Enter - [Tags] no-ci Wait Field Detected - Page Should Contain String ${WELCOME} - Page Should Contain String ${WELCOME_WRONG_CASE} ignore_case=${TRUE} Delete Field - ${user} Get Value From User Write user - ${password} Get Value From User Write user password - Write Bare In Position ${user} 5 25 Move Next Field - Write Bare ${password} + Delete Field Send Enter - ${value} Read 1 33 15 - Should Be Equal As Strings ${MAIN_MENU} ${value} - Take Screenshot + Page Should Contain String Sign-on information required. Test Send PF - [Tags] no-ci - Write 1 - Wait Field Detected - Take Screenshot - Page Should Contain String ${USER_TASK} - Send PF 12 - Wait Field Detected - Take Screenshot - Page Should Contain String ${MAIN_MENU} - Write 90 - Wait Field Detected - Take Screenshot + Send PF 1 + Page Should Contain String Function key not allowed. *** Keywords *** @@ -241,7 +236,7 @@ Suite Setup Sleep 3s Suite Teardown - Close Connection + Run Keyword And Ignore Error Close Connection Sleep 1s Verify String Not Found @@ -251,7 +246,9 @@ Verify String Not Found Verify String Not Found In List [Arguments] ${keyword} ${string_list} ${string_position} ${ignore_case}=${False} - ${not_found_string} Set Variable If ${ignore_case}==${False} ${string_list[${${string_position}-1}]} + ${not_found_string} Set Variable If + ... ${ignore_case}==${False} + ... ${string_list[${${string_position}-1}]} ... ${string_list[${${string_position}-1}].lower()} ${expected_error} Set Variable The string "${not_found_string}" was not found Run Keyword And Expect Error ${expected_error} ${keyword} ${string_list} ignore_case=${ignore_case} @@ -280,7 +277,11 @@ Verify String Does Not Appear X Times ... ${ignore_case}=${False} ${expected_error} Set Variable ... The string "${string}" was not found "${wrong_number_of_times}" times, it appears "${right_number_of_times}" times - Run Keyword And Expect Error ${expected_error} ${keyword} ${TEXT_TO_COUNT} 1 + Run Keyword And Expect Error + ... ${expected_error} + ... ${keyword} + ... ${TEXT_TO_COUNT} + ... 1 ... ignore_case=${ignore_case} Verify String Found diff --git a/atest/run_on_failure/custom_keyword_on_import.robot b/atest/run_on_failure/custom_keyword_on_import.robot index 9e85315..5467ce4 100644 --- a/atest/run_on_failure/custom_keyword_on_import.robot +++ b/atest/run_on_failure/custom_keyword_on_import.robot @@ -32,5 +32,5 @@ Custom Run On Failure Keyword Create File ${CUSTOM_FILE} An error ocurred Close Mainframe - Close Connection + Run Keyword And Ignore Error Close Connection Sleep 1 second diff --git a/atest/run_on_failure/none_on_import.robot b/atest/run_on_failure/none_on_import.robot index 891b082..cf3e241 100644 --- a/atest/run_on_failure/none_on_import.robot +++ b/atest/run_on_failure/none_on_import.robot @@ -24,5 +24,5 @@ Cause Error ... Page Should Contain String ${STRING_NON_EXISTENT} Close Mainframe - Close Connection + Run Keyword And Ignore Error Close Connection Sleep 1 second diff --git a/atest/run_on_failure/run_on_failure.robot b/atest/run_on_failure/run_on_failure.robot index 62d4517..6c97af5 100644 --- a/atest/run_on_failure/run_on_failure.robot +++ b/atest/run_on_failure/run_on_failure.robot @@ -43,5 +43,5 @@ Custom Run On Failure Keyword Create File ${CUSTOM_FILE} An error ocurred Close Mainframe - Close Connection + Run Keyword And Ignore Error Close Connection Sleep 1 second diff --git a/tasks.py b/tasks.py index 97dd363..28a3bf8 100644 --- a/tasks.py +++ b/tasks.py @@ -13,7 +13,7 @@ def lint_python(c): @task def lint_robot(c): """Perform robot code formatting with robotidy.""" - c.run("robotidy atest/") + c.run("robotidy --configure ReplaceReturns:enabled=False atest/") @task(lint_python, lint_robot)