2FAuth/tests/EndToEnd/Pages/accounts_page.robot

116 lines
3.8 KiB
Plaintext
Raw Normal View History

2022-08-04 21:32:24 +02:00
*** Settings ***
Documentation A page object to use in Accounts tests.
...
Library SeleniumLibrary
Library Collections
Resource start_page.robot
2022-08-04 21:32:24 +02:00
Resource ../common.resource
*** Variables ***
2022-08-16 09:05:36 +02:00
${ACCOUNTS PAGE URL} ${ROOT URL}/accounts
2022-08-04 21:32:24 +02:00
2023-08-30 15:48:04 +02:00
${GROUP SWITCH} groupSwitch
2023-08-31 19:12:55 +02:00
${SEARCH FIELD} txtSearch
${GRID CLASS} tfa-grid
${LIST CLASS} tfa-list
${ACCOUNTS CONTAINER} css:.accounts > span
2023-09-01 14:43:27 +02:00
${2FA ACCOUNT} class:tfa-cell
2023-08-31 19:12:55 +02:00
${MODAL OTP} class:modal-otp
2023-09-01 14:43:27 +02:00
${ALWAYS ON OTP} class:always-on-otp
2023-08-30 15:48:04 +02:00
${SHOW GROUP SWITCH BUTTON} btnShowGroupSwitch
${HIDE GROUP SWITCH BUTTON} btnHideGroupSwitch
${MANAGE BUTTON} btnManage
${SELECT ALL BUTTON} btnSelectAll
${UNSELECT ALL BUTTON} btnUnselectAll
${MOVE BUTTON} btnMove
${DELETE BUTTON} btnDelete
${EXPORT BUTTON} btnExport
2023-08-30 15:48:04 +02:00
*** Keywords ***
Go To Accounts Page
2023-08-30 15:48:04 +02:00
Go Authenticated To ${ACCOUNTS PAGE URL}
Wait Until Accounts Are Loaded
Wait Until Page Contains Element class:accounts
2023-08-31 19:12:55 +02:00
Show An Otp In Modal
2023-09-01 14:43:27 +02:00
Wait Until Page Contains Element ${2FA ACCOUNT}
${account} = Get WebElement ${2FA ACCOUNT}:first-child
2023-08-30 15:48:04 +02:00
Click Element ${account}
Wait Until Element Is Visible ${OTP}
Get Visible TwoFAccounts Elements
Wait Until Page Contains Element ${ACCOUNTS CONTAINER}
@{twofaccounts} = Get WebElements ${ACCOUNTS CONTAINER} > div
[return] @{twofaccounts}
2023-08-31 19:12:55 +02:00
Get OTP Value Shown In Modal
${string}= Get Text ${OTP}
[return] ${string}
2023-09-01 14:43:27 +02:00
Get OTP Values Shown On Home
Wait Until Page Contains Element ${ALWAYS ON OTP}
@{elements}= Get WebElements ${ALWAYS ON OTP}
${otps} = Create List
FOR ${element} IN @{elements}
${otp} = Get Text ${element}
Append To List ${otps} ${otp}
END
[return] @{otps}
2023-08-30 15:48:04 +02:00
Show Group Switch
Wait Until Page Contains Element ${SHOW GROUP SWITCH BUTTON}
Click Element ${SHOW GROUP SWITCH BUTTON}
Wait Until Page Contains Element ${GROUP SWITCH}
Hide Group Switch
Click Element ${HIDE GROUP SWITCH BUTTON}
2023-08-31 19:12:55 +02:00
Wait Until Page Does Not Contain Element ${GROUP SWITCH}
2023-09-01 14:43:27 +02:00
Click Otp In Modal To Copy It
2023-08-31 19:12:55 +02:00
Click Element ${OTP}
2023-09-01 14:43:27 +02:00
Click Otp On Home To Copy It
Wait Until Page Contains Element ${ALWAYS ON OTP}
${otp element} = Get WebElement ${ALWAYS ON OTP}:first-child
Click Element ${otp element}
2023-08-31 19:12:55 +02:00
Clipboard Should Contain
[Arguments] ${expected}
Close Modal Otp
Wait Until Element Is Visible ${SEARCH FIELD}
2023-09-01 14:43:27 +02:00
Set Focus To Element ${SEARCH FIELD}
Press Keys None CTRL+v
2023-08-31 19:12:55 +02:00
${clipboard} = Get Value ${SEARCH FIELD}
Should Be Equal ${expected} ${clipboard}
Input Text ${SEARCH FIELD} ${CLEARED CLIPBOARD VALUE}
Press Keys ${SEARCH FIELD} CTRL+c
Clear Search
Clear Search
Run Keyword And Ignore Error Click Element btnClearSearch
Copy To Clipboard
[Arguments] ${string}
Close Modal Otp
Wait Until Element Is Visible ${SEARCH FIELD}
Input Text ${SEARCH FIELD} ${string}
Set Focus To Element ${SEARCH FIELD}
Press Keys None CTRL+a
Press Keys None CTRL+c
Clear Search
Close Modal Otp
${modal is open} = Run Keyword And Return Status Element Should Be Visible ${MODAL OTP}
Run Keyword If ${modal is open} Click Element ${CLOSE BUTTON}
Wait Until Element Is Not Visible ${MODAL OTP}
Delete All TwoFAccounts
Wait Until Page Contains Element ${MANAGE BUTTON}
Click Element ${MANAGE BUTTON}
Wait Until Page Contains Element ${SELECT ALL BUTTON}
Click Element ${SELECT ALL BUTTON}
Wait Until Element Is Enabled ${DELETE BUTTON}
Click Element ${DELETE BUTTON}
Handle Alert
Wait Until Location Is ${START PAGE URL}