Update E2E tests

This commit is contained in:
Bubka 2022-08-16 09:05:36 +02:00
parent 66a4ddde0a
commit ef5d55fe39
21 changed files with 201 additions and 69 deletions

View File

@ -5,7 +5,7 @@ Library SeleniumLibrary
Resource ../common.resource Resource ../common.resource
*** Variables *** *** Variables ***
${ACCOUNTS PAGE URL} http://${SERVER}/accounts ${ACCOUNTS PAGE URL} ${ROOT URL}/accounts
*** Keywords *** *** Keywords ***
Accounts Page Should Be Open Accounts Page Should Be Open

View File

@ -0,0 +1,15 @@
*** Settings ***
Documentation A page object to use in 2FA accounts creation tests.
...
Library SeleniumLibrary
Resource ../common.resource
*** Variables ***
${CREATE ACCOUNT PAGE URL} ${ROOT URL}/account/create
*** Keywords ***
Create Account Page Should Be Open
Location Should Be ${CREATE ACCOUNT PAGE URL}
Go To Create Account Page
Go Authenticated To ${CREATE ACCOUNT PAGE URL}

View File

@ -0,0 +1,16 @@
*** Settings ***
Documentation A page object to use in 2FA account edition tests.
...
Library SeleniumLibrary
Resource ../common.resource
*** Variables ***
*** Keywords ***
Edit Page Should Be Open For Account
[Arguments] ${account id}
Location Should Be ${ROOT URL}/account/${account id}/edit
Go To Edit Page For Account
[Arguments] ${account id}
Go Authenticated To ${ROOT URL}/account/${account id}/edit

View File

@ -5,7 +5,7 @@ Library SeleniumLibrary
Resource ../common.resource Resource ../common.resource
*** Variables *** *** Variables ***
${LOGIN PAGE URL} http://${SERVER}/login ${LOGIN PAGE URL} ${ROOT URL}/login
${EMAIL FIELD} emlEmail ${EMAIL FIELD} emlEmail
${EMAIL FIELD ERROR} valErrorEmail ${EMAIL FIELD ERROR} valErrorEmail
${PASSWORD FIELD} pwdPassword ${PASSWORD FIELD} pwdPassword
@ -48,11 +48,15 @@ Password Field Should Show An Error
Show Legacy Form Show Legacy Form
${is_not_visible}= Run Keyword And Return Status Element Should Be Visible ${SIGN IN WITH LOGIN PASSWORD LINK} ${is_not_visible}= Run Keyword And Return Status Element Should Be Visible ${SIGN IN WITH LOGIN PASSWORD LINK}
Run Keyword If ${is_not_visible} Click Link ${SIGN IN WITH LOGIN PASSWORD LINK} Run Keyword If ${is_not_visible} Click Link ${SIGN IN WITH LOGIN PASSWORD LINK}
Legacy Form Should Be Visible
Element Should Be Visible ${LEGACY FORM} Element Should Be Visible ${LEGACY FORM}
Show Webauthn Form Show Webauthn Form
${is_not_visible}= Run Keyword And Return Status Element Should Be Visible ${SIGN IN WITH WEBAUTHN LINK} ${is_not_visible}= Run Keyword And Return Status Element Should Be Visible ${SIGN IN WITH WEBAUTHN LINK}
Run Keyword If ${is_not_visible} Click Link ${SIGN IN WITH WEBAUTHN LINK} Run Keyword If ${is_not_visible} Click Link ${SIGN IN WITH WEBAUTHN LINK}
Webauthn Form Should Be Visible
Element Should Not Be Visible ${LEGACY FORM} Element Should Not Be Visible ${LEGACY FORM}
User Should Be Welcomed User Should Be Welcomed

View File

@ -5,7 +5,7 @@ Library SeleniumLibrary
Resource ../common.resource Resource ../common.resource
*** Variables *** *** Variables ***
${REGISTER PAGE URL} http://${SERVER}/register ${REGISTER PAGE URL} ${ROOT URL}/register
${USERNAME FIELD} txtName ${USERNAME FIELD} txtName
${USERNAME FIELD ERROR} valErrorName ${USERNAME FIELD ERROR} valErrorName
${EMAIL FIELD} emlEmail ${EMAIL FIELD} emlEmail
@ -25,7 +25,7 @@ Go To Register Page
Register Page Should Be Open Register Page Should Be Open
Location Should Be ${REGISTER PAGE URL} Location Should Be ${REGISTER PAGE URL}
Submit Account Data To Registration Form Submit User Data To Registration Form
[Arguments] ${username} ${email} ${password} ${password confirmation} [Arguments] ${username} ${email} ${password} ${password confirmation}
Input Text ${USERNAME FIELD} ${username} Input Text ${USERNAME FIELD} ${username}
Input Text ${EMAIL FIELD} ${email} Input Text ${EMAIL FIELD} ${email}

View File

@ -6,7 +6,7 @@ Resource ../common.resource
Resource login_page.robot Resource login_page.robot
*** Variables *** *** Variables ***
${ACCOUNT SETTINGS PAGE URL} http://${SERVER}/settings/account ${ACCOUNT SETTINGS PAGE URL} ${ROOT URL}/settings/account
${PASSWORD FIELD FOR DELETE} css:form#frmDeleteAccount >> css:input#pwdPassword ${PASSWORD FIELD FOR DELETE} css:form#frmDeleteAccount >> css:input#pwdPassword
${DELETE YOUR ACCOUNT BUTTON} btnDeleteAccount ${DELETE YOUR ACCOUNT BUTTON} btnDeleteAccount

View File

@ -0,0 +1,15 @@
*** Settings ***
Documentation A page object to use in OAuth settings tests.
...
Library SeleniumLibrary
Resource ../common.resource
*** Variables ***
${OAUTH SETTINGS PAGE URL} ${ROOT URL}/settings/oauth
*** Keywords ***
OAuth Settings Page Should Be Open
Location Should Be ${OAUTH SETTINGS PAGE URL}
Go To OAuth Settings Page
Go Authenticated To ${OAUTH SETTINGS PAGE URL}

View File

@ -0,0 +1,15 @@
*** Settings ***
Documentation A page object to use in User Options settings tests.
...
Library SeleniumLibrary
Resource ../common.resource
*** Variables ***
${OPTIONS SETTINGS PAGE URL} ${ROOT URL}/settings/options
*** Keywords ***
Options Settings Page Should Be Open
Location Should Be ${OPTIONS SETTINGS PAGE URL}
Go To Options Settings Page
Go Authenticated To ${OPTIONS SETTINGS PAGE URL}

View File

@ -0,0 +1,15 @@
*** Settings ***
Documentation A page object to use in WebAuthn settings tests.
...
Library SeleniumLibrary
Resource ../common.resource
*** Variables ***
${WEBAUTHN SETTINGS PAGE URL} ${ROOT URL}/settings/webauthn
*** Keywords ***
Webauthn Settings Page Should Be Open
Location Should Be ${WEBAUTHN SETTINGS PAGE URL}
Go To Webauthn Settings Page
Go Authenticated To ${WEBAUTHN SETTINGS PAGE URL}

View File

@ -0,0 +1,15 @@
*** Settings ***
Documentation A page object to use in 2FA accounts acquisition tests.
...
Library SeleniumLibrary
Resource ../common.resource
*** Variables ***
${START PAGE URL} ${ROOT URL}/start
*** Keywords ***
Start Page Should Be Open
Location Should Be ${START PAGE URL}
Go To Start Page
Go Authenticated To ${START PAGE URL}

View File

@ -1,7 +1,7 @@
*** Settings *** *** Settings ***
Documentation A test suite to check available links on the login page. Documentation A test suite to check available links on the login page.
Suite Setup Suite Setup Suite Setup Available Links Suite Setup
Suite Teardown Close Browser Suite Teardown Close All Browsers
Resource ../../Pages/login_page.robot Resource ../../Pages/login_page.robot
*** Test Cases *** *** Test Cases ***
@ -13,13 +13,16 @@ Webauthn login Link Is Visible
Legacy login Link Is Visible Legacy login Link Is Visible
Show Webauthn Form Show Webauthn Form
Webauthn Form Should Be Visible
Element Should Be Visible ${SIGN IN WITH LOGIN PASSWORD LINK} Element Should Be Visible ${SIGN IN WITH LOGIN PASSWORD LINK}
Recover Account Link Is Visible Recover Account Link Is Visible
Show Webauthn Form Show Webauthn Form
Webauthn Form Should Be Visible
Element Should Be Visible ${RECOVER YOUR ACCOUNT LINK} Element Should Be Visible ${RECOVER YOUR ACCOUNT LINK}
*** Keywords *** *** Keywords ***
Suite Setup Available Links Suite Setup
Open Blank Browser Open Blank Browser
Go To Legacy Login Page Go To Legacy Login Page
Legacy Form Should Be Visible

View File

@ -1,10 +1,11 @@
*** Settings *** *** Settings ***
Documentation A test suite containing tests related to invalid login. Documentation A test suite containing tests related to invalid login.
Suite Setup Open Blank Browser Suite Setup Open Blank Browser
Suite Teardown Close Browser Suite Teardown Close All Browsers
Test Setup Run keywords Test Setup Run keywords
... Go To Legacy Login Page ... Go To Legacy Login Page
... AND Location Should Be ${LOGIN PAGE URL} ... AND Login Page Should Be Open
... AND Legacy Form Should Be Visible
Resource ../../Pages/login_page.robot Resource ../../Pages/login_page.robot
Resource authentication.resource Resource authentication.resource

View File

@ -1,7 +1,8 @@
*** Settings *** *** Settings ***
Documentation A test suite containing tests related to invalid registration. Documentation A test suite containing tests related to invalid registration.
Suite Setup Suite Setup Suite Setup Register Suite Setup
Suite Teardown Suite Teardown Suite Teardown Register Suite Teardown
Test Setup Register Test Setup
Resource ../../Pages/register_page.robot Resource ../../Pages/register_page.robot
Resource ../../Pages/accounts_page.robot Resource ../../Pages/accounts_page.robot
Resource authentication.resource Resource authentication.resource
@ -25,42 +26,34 @@ Invalid Password
${PASSWORD} ${INVALID PASSWORD} ${PASSWORD} ${INVALID PASSWORD}
${INVALID PASSWORD TOO SHORT} ${INVALID PASSWORD TOO SHORT} ${INVALID PASSWORD TOO SHORT} ${INVALID PASSWORD TOO SHORT}
A User Already Exists
Submit Account Data To Registration Form ${USERNAME} ${EMAIL} ${PASSWORD} ${PASSWORD}
An Error Notification Should Appear
*** Keywords *** *** Keywords ***
Registering With Invalid Username Should Fail Registering With Invalid Username Should Fail
[Arguments] ${bad username} [Arguments] ${bad username}
Submit Account Data To Registration Form ${bad username} ${EMAIL} ${PASSWORD} ${PASSWORD} Submit User Data To Registration Form ${bad username} ${EMAIL} ${PASSWORD} ${PASSWORD}
Page Should Remain Register Page register_page.Username Field Should Show An Error
Username Field Should Show An Error
Registering With Invalid Email Should Fail Registering With Invalid Email Should Fail
[Arguments] ${bad email} [Arguments] ${bad email}
Submit Account Data To Registration Form ${USERNAME} ${bad email} ${PASSWORD} ${PASSWORD} Submit User Data To Registration Form ${USERNAME} ${bad email} ${PASSWORD} ${PASSWORD}
Page Should Remain Register Page
register_page.Email Field Should Show An Error register_page.Email Field Should Show An Error
Registering With Invalid Passwords Should Fail Registering With Invalid Passwords Should Fail
[Arguments] ${bad password} ${bad password confirmation} [Arguments] ${bad password} ${bad password confirmation}
Submit Account Data To Registration Form ${USERNAME} ${EMAIL} ${bad password} ${bad password confirmation} Submit User Data To Registration Form ${USERNAME} ${EMAIL} ${bad password} ${bad password confirmation}
Page Should Remain Register Page
register_page.Password Field Should Show An Error register_page.Password Field Should Show An Error
User should be asked To Register A Webauthn Device User should be asked To Register A Webauthn Device
Page Should Contain Element ${REGISTER NEW DEVICE BUTTON} Page Should Contain Element ${REGISTER NEW DEVICE BUTTON}
Page Should Contain Element ${MAYBE LATER BUTTON} Page Should Contain Element ${MAYBE LATER BUTTON}
Page Should Remain Register Page Register Suite Setup
Location Should Be ${REGISTER PAGE URL}
Suite Setup
Open Blank Browser Open Blank Browser
Play Delete User Account Workflow Play Delete User Account Workflow
Go To Register Page
Location Should Be ${REGISTER PAGE URL}
Suite Teardown Register Suite Teardown
Close Browser Close All Browsers
Play Register New User Workflow Play Register New User Workflow
Register Test Setup
Go To Register Page
Location Should Be ${REGISTER PAGE URL}

View File

@ -0,0 +1,14 @@
*** Settings ***
Documentation A test suite containing tests related to maximum user registration.
Suite Setup Open Blank Browser
Suite Teardown Close All Browsers
Resource ../../Pages/register_page.robot
Resource ../../Pages/accounts_page.robot
Resource authentication.resource
*** Test Cases ***
A User Already Exists
Go To Register Page
Location Should Be ${REGISTER PAGE URL}
Submit User Data To Registration Form ${USERNAME} ${EMAIL} ${PASSWORD} ${PASSWORD}
An Error Notification Should Appear

View File

@ -1,11 +1,9 @@
*** Settings *** *** Settings ***
Documentation A test suite containing tests related to valid login. Documentation A test suite containing tests related to valid login.
Suite Setup Open Blank Browser Suite Setup Open Blank Browser
Suite Teardown Close Browser Suite Teardown Close All Browsers
Resource ../../Pages/login_page.robot Resource ../../Pages/login_page.robot
Resource ../../Pages/accounts_page.robot
Resource authentication.resource Resource authentication.resource
Resource invalid_registration.robot
*** Test Cases *** *** Test Cases ***
Valid Login Valid Login

View File

@ -1,7 +1,7 @@
*** Settings *** *** Settings ***
Documentation A test suite containing tests related to valid registration. Documentation A test suite containing tests related to valid registration.
Suite Setup Open Blank Browser Suite Setup Open Blank Browser
Suite Teardown Close Browser Suite Teardown Close All Browsers
Resource ../../Pages/register_page.robot Resource ../../Pages/register_page.robot
Resource ../../Pages/accounts_page.robot Resource ../../Pages/accounts_page.robot
Resource authentication.resource Resource authentication.resource
@ -11,7 +11,7 @@ Valid Registration Without Webauthn Device
Play Delete User Account Workflow Play Delete User Account Workflow
Go To Register Page Go To Register Page
Register Page Should Be Open Register Page Should Be Open
Submit Account Data To Registration Form ${USERNAME} ${EMAIL} ${PASSWORD} ${PASSWORD} Submit User Data To Registration Form ${USERNAME} ${EMAIL} ${PASSWORD} ${PASSWORD}
User Should Be Asked To Register A Webauthn Device Or Postpone User Should Be Asked To Register A Webauthn Device Or Postpone
Postpone Webauthn Registration Postpone Webauthn Registration

View File

@ -0,0 +1,33 @@
*** Settings ***
Documentation A test suite containing tests related to browsing redirections.
Suite Setup Open Blank Browser
Suite Teardown Close All Browsers
Resource ../../Pages/register_page.robot
Resource ../../Pages/accounts_page.robot
Resource ../../Pages/settings_account_page.robot
Resource ../../Pages/settings_oauth_page.robot
Resource ../../Pages/settings_options_page.robot
Resource ../../Pages/settings_webauthn_page.robot
Resource ../../Pages/start_page.robot
Resource ../../Pages/create_account_page.robot
Resource ../../Pages/edit_account_page.robot
Resource ../../common.resource
*** Test Cases ***
Protected Page
[Template] Anonymous Should Be Redirected To Login Page
${ACCOUNTS PAGE URL}
${ACCOUNT SETTINGS PAGE URL}
${OAUTH SETTINGS PAGE URL}
${OPTIONS SETTINGS PAGE URL}
${WEBAUTHN SETTINGS PAGE URL}
${CREATE ACCOUNT PAGE URL}
${EDIT ACCOUNT PAGE URL}
${START PAGE URL}
*** Keywords ***
Anonymous Should Be Redirected To Login Page
[Arguments] ${url}
Delete All Cookies
Go To ${url}
Location Should Be ${LOGIN PAGE URL}

View File

@ -0,0 +1,13 @@
# *** Settings ***
# Documentation A test suite to check available links on the login page.
# Suite Setup Open Blank Browser
# Suite Teardown Close Browser
# Resource Pages/login_page.robot
# Resource workflows.resource
# *** Variables ***
# ${ROOT URL} https://${SERVER}/
# *** Test Cases ***
# My Test
# Play Delete User Account Workflow

View File

@ -1,32 +1,29 @@
*** Settings *** *** Settings ***
Documentation A resource file with reusable keywords and variables. Documentation A resource file with reusable keywords and variables.
Library SeleniumLibrary Library SeleniumLibrary
# Library RequestsLibrary
Resource workflows.resource Resource workflows.resource
*** Variables *** *** Variables ***
${SERVER} localhost ${SERVER} 2fauth
${BROWSER} chrome ${BROWSER} chrome
${DELAY} 0.1 ${DELAY} 0.5
${USERNAME} Tester ${USERNAME} Tester
${EMAIL} testing@2fauth.app ${EMAIL} testing@2fauth.app
${PASSWORD} password ${PASSWORD} password
${HOME PAGE URL} http://${SERVER}/ ${ROOT URL} https://${SERVER}
${LOGOUT LINK} lnkSignOut ${LOGOUT LINK} lnkSignOut
*** Keywords *** *** Keywords ***
Open Blank Browser Open Blank Browser
Set Selenium Speed ${DELAY} Set Selenium Speed ${DELAY}
# ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys ${options}= Evaluate sys.modules['selenium.webdriver'].ChromeOptions() sys
# Call Method ${options} add_argument --lang\=en,en-us Call Method ${options} add_argument --lang\=en,en-us
# Call Method ${options} add_argument --disable-dev-shm-usage # See https://stackoverflow.com/questions/50642308/org-openqa-selenium-webdriverexception-unknown-error-devtoolsactiveport-file-d Call Method ${options} add_argument --disable-dev-shm-usage # See https://stackoverflow.com/questions/50642308/org-openqa-selenium-webdriverexception-unknown-error-devtoolsactiveport-file-d
# ${prefs}= Create Dictionary intl.accept_languages=en,en-us ${prefs}= Create Dictionary intl.accept_languages=en,en-us
# Call Method ${options} add_experimental_option prefs ${prefs} Call Method ${options} add_experimental_option prefs ${prefs}
# Create Webdriver Chrome chrome_options=${options} Open Browser url=${ROOT URL} browser=${BROWSER} options=${options}
# Go To ${HOME PAGE URL}
Open Browser ${HOME PAGE URL} Chrome
Maximize Browser Window Maximize Browser Window
Go Authenticated To Go Authenticated To
@ -39,7 +36,7 @@ Go Authenticated To
END END
An Error Notification Should Appear An Error Notification Should Appear
Element Should Be Visible css:#vueNotification >> css:.is-danger Wait Until Element Is Visible css:#vueNotification .is-danger
Field Should Show An Error Field Should Show An Error
[Arguments] ${field error} [Arguments] ${field error}
@ -47,4 +44,4 @@ Field Should Show An Error
Should Not Be Empty ${field error} Should Not Be Empty ${field error}
Scroll To Bottom Scroll To Bottom
Execute Javascript window.scrollTo(0,document.body.scrollHeight) Execute Javascript window.scrollTo(0,document.body.scrollHeight)

View File

@ -1,13 +0,0 @@
*** Settings ***
Documentation A test suite to check available links on the login page.
Suite Setup Open Blank Browser
# Suite Teardown Close Browser
Resource Pages/login_page.robot
Resource workflows.resource
*** Variables ***
${HOME PAGE URL} http://${SERVER}/
*** Test Cases ***
My Test
Play Delete User Account Workflow

View File

@ -3,7 +3,6 @@ Documentation Workflows execute recurrent tasks.
... They don't assert anything. ... They don't assert anything.
... They must be triggered while a browser is already opened. ... They must be triggered while a browser is already opened.
... They must not close the browser ... They must not close the browser
Library SeleniumLibrary
Resource common.resource Resource common.resource
Resource Pages/login_page.robot Resource Pages/login_page.robot
Resource Pages/register_page.robot Resource Pages/register_page.robot
@ -21,15 +20,14 @@ Play Delete User Account Workflow
Play sign In Workflow Play sign In Workflow
Delete All Cookies Delete All Cookies
Go To Legacy Login Page Go To Legacy Login Page
Login Page Should Be Open
Submit Credentials To Legacy Form Login ${EMAIL} ${PASSWORD} Submit Credentials To Legacy Form Login ${EMAIL} ${PASSWORD}
Play Register New User Workflow Play Register New User Workflow
Go To Register Page Go To Register Page
Submit Account Data To Registration Form ${USERNAME} ${EMAIL} ${PASSWORD} ${PASSWORD} Submit User Data To Registration Form ${USERNAME} ${EMAIL} ${PASSWORD} ${PASSWORD}
Play Logout Workflow Play Logout Workflow
Go To http://${SERVER}/accounts Go To ${ROOT URL}/accounts
${is_authenticated}= Run Keyword And Return Status Page Should Contain Element ${LOGOUT LINK} ${is_authenticated}= Run Keyword And Return Status Page Should Contain Element ${LOGOUT LINK}
IF ${is_authenticated} == True IF ${is_authenticated} == True
Click Element ${LOGOUT LINK} Click Element ${LOGOUT LINK}