Add e2e tests for Close & Back buttons

This commit is contained in:
Bubka 2023-08-30 15:48:04 +02:00
parent 5d4f88baa6
commit 690a78a044
20 changed files with 194 additions and 16 deletions

View File

@ -7,7 +7,6 @@ Library String
*** Variables ***
${ABOUT PAGE URL} ${ROOT URL}/about
${BACK BUTTON} lnkBack
*** Keywords ***
About Page Should Be Open
@ -16,6 +15,13 @@ About Page Should Be Open
Go To About Page
Go To ${ABOUT PAGE URL}
Browse To About Page
Click Link ${ABOUT LINK}
Exit About Page
Wait Until Page Contains Element ${BACK BUTTON}
Click Link ${BACK BUTTON}
Block Vars Should Be Visible
[Arguments] ${elementId}
Wait Until Page Contains Element id:${elementId}

View File

@ -7,9 +7,18 @@ Resource ../common.resource
*** Variables ***
${IMPORT ACCOUNTS PAGE URL} ${ROOT URL}/account/import
${CANCEL BUTTON} btnCancel
${CLOSE BUTTON} btnClose
*** Keywords ***
Import Accounts Page Should Be Open
Location Should Be ${IMPORT ACCOUNTS PAGE URL}
Go To Import Accounts Page
Go Authenticated To ${IMPORT ACCOUNTS PAGE URL}
Go Authenticated To ${IMPORT ACCOUNTS PAGE URL}
Exit Import Page
Click Link ${CLOSE BUTTON}
Cancel Import
Click Link ${CANCEL BUTTON}

View File

@ -7,9 +7,28 @@ Resource ../common.resource
*** Variables ***
${ACCOUNTS PAGE URL} ${ROOT URL}/accounts
${GROUP SWITCH} groupSwitch
${SHOW GROUP SWITCH BUTTON} btnShowGroupSwitch
${HIDE GROUP SWITCH BUTTON} btnHideGroupSwitch
*** Keywords ***
Accounts Page Should Be Open
Location Should Be ${ACCOUNTS PAGE URL}
Wait Until Location Is ${ACCOUNTS PAGE URL}
Go To Accounts Page
Go Authenticated To ${ACCOUNTS PAGE URL}
Go Authenticated To ${ACCOUNTS PAGE URL}
Show First Totp In Modal
Wait Until Page Contains Element class:tfa-cell
${account} = Get WebElement class:tfa-cell:first-child
Click Element ${account}
Wait Until Element Is Visible ${OTP}
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}
Wait Until Page Does Not Contain Element ${GROUP SWITCH}

View File

@ -8,7 +8,7 @@ ${GROUPS PAGE URL} ${ROOT URL}/groups
*** Keywords ***
Groups Page Should Be Open
Location Should Be ${GROUPS PAGE URL}
Wait Until Location Is ${GROUPS PAGE URL}
Go To Groups Page
Go Authenticated To ${GROUPS PAGE URL}

View File

@ -9,7 +9,6 @@ ${PASSWORD REQUEST PAGE URL} ${ROOT URL}/password/request
${EMAIL FIELD} emlEmail
${EMAIL FIELD ERROR} valErrorEmail
${SUBMIT BUTTON} btnSendResetPwd
${CANCEL BUTTON} btnCancel
*** Keywords ***
Password Request Page Should Be Open

View File

@ -13,7 +13,6 @@ ${PASSWORD FIELD ERROR} valErrorPassword
${TOKEN FIELD ERROR} valErrorToken
${SUBMIT BUTTON} btnSubmit
${CONTINUE BUTTON} btnContinue
${CANCEL BUTTON} btnCancel
${TOGGLE PASSWORD VISIBILITY BUTTON} btnTogglePassword
*** Keywords ***

View File

@ -0,0 +1,20 @@
*** Settings ***
Library SeleniumLibrary
*** Variables ***
${OPTIONS TAB} lnkTabOptions
${ACCOUNT TAB} lnkTabAccount
${OAUTH TAB} lnkTabOAuth
${WEBAUTHN TAB} lnkTabWebauthn
${CLOSE BUTTON} btnClose
*** Keywords ***
Exit Settings
Wait Until Page Contains Element ${CLOSE BUTTON}
Click Link ${CLOSE BUTTON}
Activate Settings Tab
[Arguments] ${tab}
Wait Until Page Contains Element ${tab}
${requested tab is active}= Run Keyword And Return Status Element Attribute Value Should Be .tabs > li.is-active a id ${tab}
Run Keyword If ${requested tab is active} == False Click Link ${tab}

View File

@ -2,8 +2,9 @@
Documentation A page object to use in Account settings tests.
...
Library SeleniumLibrary
Resource ../common.resource
Resource login_page.robot
Resource settings.resource
Resource ../common.resource
*** Variables ***
${ACCOUNT SETTINGS PAGE URL} ${ROOT URL}/settings/account
@ -18,6 +19,9 @@ Account Settings Page Should Be Open
Go To Account Settings Page
Go Authenticated To ${ACCOUNT SETTINGS PAGE URL}
Activate Account Settings Tab
Activate Settings Tab ${ACCOUNT TAB}
Delete User Account
Scroll To Bottom
Input Text ${PASSWORD FIELD FOR DELETE} ${PASSWORD}

View File

@ -2,6 +2,7 @@
Documentation A page object to use in OAuth settings tests.
...
Library SeleniumLibrary
Resource settings.resource
Resource ../common.resource
*** Variables ***
@ -13,3 +14,6 @@ OAuth Settings Page Should Be Open
Go To OAuth Settings Page
Go Authenticated To ${OAUTH SETTINGS PAGE URL}
Activate OAuth Settings Tab
Activate Settings Tab ${OAUTH TAB}

View File

@ -2,6 +2,7 @@
Documentation A page object to use in User Options settings tests.
...
Library SeleniumLibrary
Resource settings.resource
Resource ../common.resource
*** Variables ***
@ -13,3 +14,6 @@ Options Settings Page Should Be Open
Go To Options Settings Page
Go Authenticated To ${OPTIONS SETTINGS PAGE URL}
Activate Options Settings Tab
Activate Settings Tab ${OPTIONS TAB}

View File

@ -2,6 +2,7 @@
Documentation A page object to use in WebAuthn settings tests.
...
Library SeleniumLibrary
Resource settings.resource
Resource ../common.resource
*** Variables ***
@ -9,7 +10,11 @@ ${WEBAUTHN SETTINGS PAGE URL} ${ROOT URL}/settings/webauthn
*** Keywords ***
Webauthn Settings Page Should Be Open
Location Should Be ${WEBAUTHN SETTINGS PAGE URL}
Wait Until Location Is ${WEBAUTHN SETTINGS PAGE URL}
Go To Webauthn Settings Page
Go Authenticated To ${WEBAUTHN SETTINGS PAGE URL}
Activate Webauthn Settings Tab
Activate Settings Tab ${WEBAUTHN TAB}
Wait Until Page Does Not Contain Element icnSpinner

View File

@ -7,9 +7,16 @@ Resource ../common.resource
*** Variables ***
${START PAGE URL} ${ROOT URL}/start
${IMPORT BUTTON} btnImport
*** Keywords ***
Start Page Should Be Open
Location Should Be ${START PAGE URL}
Go To Start Page
Go Authenticated To ${START PAGE URL}
Wait Until Page Contains Element ${BACK BUTTON}
Set Footer As Static
Choose To Import Accounts
Click Element ${IMPORT BUTTON}

View File

@ -9,7 +9,6 @@ ${WEBAUTHN LOST PAGE URL} ${ROOT URL}/webauthn/lost
${EMAIL FIELD} emlEmail
${EMAIL FIELD ERROR} valErrorEmail
${SUBMIT BUTTON} btnSubmit
${CANCEL BUTTON} btnCancel
*** Keywords ***
Webauthn Device Lost Page Should Be Open

View File

@ -10,7 +10,6 @@ ${PASSWORD FIELD} pwdPassword
${PASSWORD FIELD ERROR} valErrorPassword
${REVOKE ALL CHECKBOX} revokeAll
${SUBMIT BUTTON} btnRecover
${CANCEL BUTTON} btnCancel
${RESET PASSWORD LINK} lnkResetPwd
*** Keywords ***

View File

@ -24,7 +24,7 @@ New Request While Pending One Is Rejected
Email Submit Should Fail ${ADMIN EMAIL}
Request Form Can Be Quit
Click Link ${CANCEL BUTTON}
Click Element ${CANCEL BUTTON}
Login Page Should Be Open
*** Keywords ***

View File

@ -48,7 +48,7 @@ Password Reset Is Submitted Sucessfully
Reset Form Can Be Quit
Go To Password Reset Page ${ADMIN EMAIL} ${TOKEN}
Click Link ${CANCEL BUTTON}
Click Element ${CANCEL BUTTON}
Login Page Should Be Open
*** Keywords ***

View File

@ -24,7 +24,7 @@ New Request While Pending One Is Rejected
Email Submit Should Fail ${ADMIN EMAIL}
Webauthn Lost Form Can Be Quit
Click Link ${CANCEL BUTTON}
Click Element ${CANCEL BUTTON}
Login Page Should Be Open
*** Keywords ***

View File

@ -34,7 +34,7 @@ Reset Passwork Link Should Be Visible
Webauthn Recover Form Can Be Quit
Go To Webauthn Recover Page \ \
Click Link ${CANCEL BUTTON}
Click Element ${CANCEL BUTTON}
Login Page Should Be Open
*** Keywords ***

View File

@ -0,0 +1,94 @@
*** Settings ***
Documentation A test suite to check Close & Back buttons targeted urls.
Suite Setup Run keywords
... Open Custom Browser
... AND Play Admin Sign In Workflow
Suite Teardown Close All Browsers
Resource ../../Pages/login_page.robot
Resource ../../Pages/about_page.robot
Resource ../../Pages/accounts_page.robot
Resource ../../Pages/groups_page.robot
Resource ../../Pages/settings_options_page.robot
Resource ../../Pages/settings_webauthn_page.robot
Resource ../../Pages/start_page.robot
Resource ../../Pages/account_import_page.robot
Resource ../../common.resource
*** Variables ***
${STARTING URL} ${OPTIONS SETTINGS PAGE URL}
*** Test Cases ***
Back Button From About Page Should Send To Previous Page
Go To ${STARTING URL}
Click Link ${ABOUT LINK}
Click Link ${BACK BUTTON}
Wait Until Location Is ${STARTING URL}
Back Button From About Page Without History Should Send To Accounts Page
Go To ${STARTING URL}
Go To About Page
Click Link ${BACK BUTTON}
Wait Until Location Is ${ACCOUNTS PAGE URL}
Back Button From Start Page Should Send To Accounts Page
Go To Start Page
Click Link ${BACK BUTTON}
Wait Until Location Is ${ACCOUNTS PAGE URL}
Back Button From Import Page Should Send To Accounts Page
Go To Start Page
Choose To Import Accounts
Exit Import Page
Wait Until Location Is ${ACCOUNTS PAGE URL}
Cancel Button From Import Page Should Send To Accounts Page
Go To Start Page
Choose To Import Accounts
Cancel Import
Wait Until Location Is ${ACCOUNTS PAGE URL}
Close Button Should Close Modal Window
Go To ${ACCOUNTS PAGE URL}
Show First Totp In Modal
Click Element ${CLOSE BUTTON}
Wait Until Element Is Not Visible class:modal-otp
Close Button Should Close Group Switch
Go To ${ACCOUNTS PAGE URL}
Show Group Switch
Wait Until Page Contains Element ${CLOSE BUTTON}
Click Element ${CLOSE BUTTON}
Wait Until Page Does Not Contain Element ${GROUP SWITCH}
Close Button From Groups Page Should Send To Accounts Page
Go To ${GROUPS PAGE URL}
Wait Until Page Contains Element ${CLOSE BUTTON}
Click Element ${CLOSE BUTTON}
Wait Until Location Is ${ACCOUNTS PAGE URL}
Close Button From Settings Should Send To Page Before Settings Browsing
[Template] Close Button From A Settings Tab Should Send To Previous Page
${OPTIONS TAB}
${WEBAUTHN TAB}
${ACCOUNT TAB}
${OAUTH TAB}
Visiting About Page Via Settings Pages Should End To Starting Page
Go To Groups Page
Browse To Settings
Activate Webauthn Settings Tab
Browse To About Page
Exit About Page
Webauthn Settings Page Should Be Open
Exit Settings
Groups Page Should Be Open
*** Keywords ***
Close Button From A Settings Tab Should Send To Previous Page
[Arguments] ${tab}
Go To Groups Page
Browse To Settings
Activate Settings Tab ${tab}
Exit Settings
Groups Page Should Be Open

View File

@ -14,7 +14,14 @@ ${USER EMAIL} testingadmin@2fauth.app
${PASSWORD} password
${ROOT URL} http://${SERVER}
${LOGOUT LINK} lnkSignOut
${ABOUT LINK} lnkAbout
${SETTINGS LINK} lnkSettings
${BACK BUTTON} lnkBack
${CANCEL BUTTON} btnCancel
${CLOSE BUTTON} btnClose
${OTP} otp
${SUCCESS NOTIFICATION} css:#vueNotification .is-success
${ALERT NOTIFICATION} css:#vueNotification .is-danger
@ -67,4 +74,7 @@ Element Should Not Have Class
Set Footer As Static
execute javascript
... document.querySelector('footer').style = 'position: static';
... document.querySelector('footer').style = 'position: static';
Browse To Settings
Click Element ${SETTINGS LINK}