mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-03-15 07:28:30 +01:00
Add basic E2E Login tests
This commit is contained in:
parent
4e83c6c2f6
commit
d1708b9c9b
12
tests/EndToEnd/Pages/accounts_page.robot
Normal file
12
tests/EndToEnd/Pages/accounts_page.robot
Normal file
@ -0,0 +1,12 @@
|
||||
*** Settings ***
|
||||
Documentation A page object to use in Accounts tests.
|
||||
...
|
||||
Library SeleniumLibrary
|
||||
Resource ../common.resource
|
||||
|
||||
*** Variables ***
|
||||
&{ACCOUNTS_PAGE} url=http://${SERVER}/accounts title=Accounts
|
||||
|
||||
*** Keywords ***
|
||||
Accounts Page Should Be Open
|
||||
Page Should Be Open ${ACCOUNTS_PAGE}
|
50
tests/EndToEnd/Pages/login_page.robot
Normal file
50
tests/EndToEnd/Pages/login_page.robot
Normal file
@ -0,0 +1,50 @@
|
||||
*** Settings ***
|
||||
Documentation A page object to use in Login tests.
|
||||
...
|
||||
Library SeleniumLibrary
|
||||
Resource ../common.resource
|
||||
|
||||
*** Variables ***
|
||||
&{LOGIN_PAGE} url=http://${SERVER}/login title=Login
|
||||
${EMAIL FIELD} emlEmail
|
||||
${EMAIL FIELD ERROR} valErrorEmail
|
||||
${PASSWORD FIELD} pwdPassword
|
||||
${PASSWORD FIELD ERROR} valErrorPassword
|
||||
${LEGACY FORM} frmLegacyLogin
|
||||
${SIGN IN BUTTON} btnSignIn
|
||||
${CONTINUE WITH WEBAUTHN BUTTON} btnContinue
|
||||
${SIGN IN WITH WEBAUTHN LINK} lnkSignWithWebauthn
|
||||
${SIGN IN WITH LOGIN PASSWORD LINK} lnkSignWithLegacy
|
||||
${RECOVER YOUR ACCOUNT LINK} lnkRecoverAccount
|
||||
${RESET PASSWORD LINK} lnkResetPwd
|
||||
|
||||
*** Keywords ***
|
||||
Open Browser To Legacy Login Page
|
||||
Open Browser To Page ${LOGIN_PAGE}
|
||||
Show Legacy Form
|
||||
|
||||
Go To Legacy Login Page
|
||||
Go To Page ${LOGIN_PAGE}
|
||||
Show Legacy Form
|
||||
|
||||
Submit Credentials To Legacy Form Login
|
||||
[Arguments] ${username} ${password}
|
||||
Input Text ${EMAIL FIELD} ${username}
|
||||
Input Text ${PASSWORD FIELD} ${password}
|
||||
Click Button ${SIGN IN BUTTON}
|
||||
|
||||
Email Field Should Show An Error
|
||||
Field Should Show An Error ${EMAIL FIELD ERROR}
|
||||
|
||||
Password Field Should Show An Error
|
||||
Field Should Show An Error ${PASSWORD FIELD ERROR}
|
||||
|
||||
Show Legacy Form
|
||||
${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}
|
||||
Element Should Be Visible ${LEGACY FORM}
|
||||
|
||||
Show Webauthn Form
|
||||
${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}
|
||||
Element Should Not Be Visible ${LEGACY FORM}
|
9
tests/EndToEnd/Tests/Auth/authentication.resource
Normal file
9
tests/EndToEnd/Tests/Auth/authentication.resource
Normal file
@ -0,0 +1,9 @@
|
||||
*** Settings ***
|
||||
Documentation A resource file for authentication tests.
|
||||
...
|
||||
Library SeleniumLibrary
|
||||
Resource ../../common.resource
|
||||
|
||||
*** Variables ***
|
||||
${VALID USER} testing@2fauth.app
|
||||
${VALID PASSWORD} password
|
20
tests/EndToEnd/Tests/Auth/available_links.robot
Normal file
20
tests/EndToEnd/Tests/Auth/available_links.robot
Normal file
@ -0,0 +1,20 @@
|
||||
*** Settings ***
|
||||
Documentation A test suite containing tests related to the login page links.
|
||||
Suite Setup Open Browser To Legacy Login Page
|
||||
Suite Teardown Close Browser
|
||||
Resource ../../Pages/login_page.robot
|
||||
|
||||
*** Test Cases ***
|
||||
Reset Link
|
||||
Element Should Be Visible ${RESET PASSWORD LINK}
|
||||
|
||||
Webauthn login Link
|
||||
Element Should Be Visible ${SIGN IN WITH WEBAUTHN LINK}
|
||||
|
||||
Legacy login Link
|
||||
Show Webauthn Form
|
||||
Element Should Be Visible ${SIGN IN WITH LOGIN PASSWORD LINK}
|
||||
|
||||
Recover Account Link
|
||||
Show Webauthn Form
|
||||
Element Should Be Visible ${RECOVER YOUR ACCOUNT LINK}
|
31
tests/EndToEnd/Tests/Auth/invalid_legacy_login.robot
Normal file
31
tests/EndToEnd/Tests/Auth/invalid_legacy_login.robot
Normal file
@ -0,0 +1,31 @@
|
||||
*** Settings ***
|
||||
Documentation A test suite containing tests related to invalid login.
|
||||
Suite Setup Open Browser To Legacy Login Page
|
||||
Suite Teardown Close Browser
|
||||
Test Setup Go To Legacy Login Page
|
||||
Resource ../../Pages/login_page.robot
|
||||
Resource authentication.resource
|
||||
|
||||
*** Test Cases ***
|
||||
Invalid Email
|
||||
[Template] Login With Invalid Email Should Fail
|
||||
${EMPTY} ${VALID PASSWORD}
|
||||
invalid ${VALID PASSWORD}
|
||||
email@donot.exist ${VALID PASSWORD}
|
||||
|
||||
Missing Password
|
||||
Submit Credentials To Legacy Form Login ${VALID USER} ${EMPTY}
|
||||
Location Should Be ${LOGIN_PAGE.url}
|
||||
Password Field Should Show An Error
|
||||
|
||||
Invalid Password
|
||||
Submit Credentials To Legacy Form Login ${VALID USER} invalid
|
||||
Location Should Be ${LOGIN_PAGE.url}
|
||||
An Error should be notified
|
||||
|
||||
*** Keywords ***
|
||||
Login With Invalid Email Should Fail
|
||||
[Arguments] ${username} ${password}
|
||||
Submit Credentials To Legacy Form Login ${username} ${password}
|
||||
Location Should Be ${LOGIN_PAGE.url}
|
||||
Email Field Should Show An Error
|
12
tests/EndToEnd/Tests/Auth/valid_legacy_login.robot
Normal file
12
tests/EndToEnd/Tests/Auth/valid_legacy_login.robot
Normal file
@ -0,0 +1,12 @@
|
||||
*** Settings ***
|
||||
Documentation A test suite containing tests related to valid login.
|
||||
Suite Setup Open Browser To Legacy Login Page
|
||||
Suite Teardown Close Browser
|
||||
Resource ../../Pages/login_page.robot
|
||||
Resource ../../Pages/accounts_page.robot
|
||||
Resource authentication.resource
|
||||
|
||||
*** Test Cases ***
|
||||
Valid Login
|
||||
Submit Credentials To Legacy Form Login ${VALID USER} ${VALID PASSWORD}
|
||||
Accounts Page Should Be Open
|
34
tests/EndToEnd/common.resource
Normal file
34
tests/EndToEnd/common.resource
Normal file
@ -0,0 +1,34 @@
|
||||
*** Settings ***
|
||||
Documentation A resource file with reusable keywords and variables.
|
||||
Library SeleniumLibrary
|
||||
|
||||
*** Variables ***
|
||||
${SERVER} localhost
|
||||
${BROWSER} chrome
|
||||
${DELAY} 0.1
|
||||
|
||||
|
||||
*** Keywords ***
|
||||
Open Browser To Page
|
||||
[Arguments] ${page}
|
||||
Set Selenium Speed ${DELAY}
|
||||
Open Browser ${page.url} ${BROWSER}
|
||||
Page Should Be Open ${page}
|
||||
|
||||
An Error should be notified
|
||||
Element Should Be Visible id:vueNotification >> class:is-danger
|
||||
|
||||
Go To Page
|
||||
[Arguments] ${page}
|
||||
Go To ${page.url}
|
||||
Page Should Be Open ${page}
|
||||
|
||||
Page Should Be Open
|
||||
[Arguments] ${page}
|
||||
Location Should Be ${page.url}
|
||||
Title Should Be ${page.title}
|
||||
|
||||
Field Should Show An Error
|
||||
[Arguments] ${field error}
|
||||
Element Should Be Visible ${field error}
|
||||
Should Not Be Empty ${field error}
|
Loading…
Reference in New Issue
Block a user