mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-06-01 07:45:38 +02:00
Complete e2e tests for search and account creation
This commit is contained in:
parent
b7ffb0be84
commit
43d7922732
@ -7,9 +7,100 @@ Resource ../common.resource
|
|||||||
*** Variables ***
|
*** Variables ***
|
||||||
${CREATE ACCOUNT PAGE URL} ${ROOT URL}/account/create
|
${CREATE ACCOUNT PAGE URL} ${ROOT URL}/account/create
|
||||||
|
|
||||||
|
${SERVICE FIELD} txtService
|
||||||
|
${ACCOUNT FIELD} txtAccount
|
||||||
|
${SECRET FIELD} txtSecret
|
||||||
|
${PERIOD FIELD} txtPeriod
|
||||||
|
${COUNTER FIELD} txtCounter
|
||||||
|
${TOTP TOGGLE BUTTON} btnOtp_typetotp
|
||||||
|
${HOTP TOGGLE BUTTON} btnOtp_typehotp
|
||||||
|
${STEAM TOGGLE BUTTON} btnOtp_typesteamtotp
|
||||||
|
${DIGITS BUTTON PREFIX} btnDigits
|
||||||
|
${6 DIGITS BUTTON} btnDigits6
|
||||||
|
${7 DIGITS BUTTON} btnDigits7
|
||||||
|
${8 DIGITS BUTTON} btnDigits8
|
||||||
|
${9 DIGITS BUTTON} btnDigits9
|
||||||
|
${10 DIGITS BUTTON} btnDigits10
|
||||||
|
${ALGORITHM BUTTON PREFIX} btnAlgorithm
|
||||||
|
${SHA1} sha1
|
||||||
|
${SHA256} sha256
|
||||||
|
${SHA512} sha512
|
||||||
|
${SMD5} md5
|
||||||
|
${CREATE BUTTON} btnCreate
|
||||||
|
${PREVIEW BUTTON} btnPreview
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
Create Account Page Should Be Open
|
Create TwoFAccount Page Should Be Open
|
||||||
Location Should Be ${CREATE ACCOUNT PAGE URL}
|
Location Should Be ${CREATE ACCOUNT PAGE URL}
|
||||||
|
|
||||||
Go To Create Account Page
|
Go To Create TwoFAccount Page
|
||||||
Go Authenticated To ${CREATE ACCOUNT PAGE URL}
|
Go Authenticated To ${CREATE ACCOUNT PAGE URL}
|
||||||
|
Set Footer As Static
|
||||||
|
|
||||||
|
Create TOTP TwoFAccount
|
||||||
|
[Arguments] ${service} ${account} ${secret}=XXXXXXXX ${digits}=6 ${algorithm}=${SHA1} ${period}=30
|
||||||
|
Go To Create TwoFAccount Page
|
||||||
|
Select TOTP Type
|
||||||
|
Fill Period Field ${period}
|
||||||
|
Create OTP TwoFAccount ${service} ${account} ${secret} ${digits} ${algorithm}
|
||||||
|
&{otp data} = Create Dictionary type=TOTP service=${service} account=${account} secret=${secret} digits=${digits} algorithm=${algorithm} period=${period}
|
||||||
|
RETURN &{otp data}
|
||||||
|
|
||||||
|
Create HOTP TwoFAccount
|
||||||
|
[Arguments] ${service} ${account} ${secret}=XXXXXXXX ${digits}=6 ${algorithm}=${SHA1} ${counter}=1
|
||||||
|
Go To Create TwoFAccount Page
|
||||||
|
Select HOTP Type
|
||||||
|
Fill Counter Field ${counter}
|
||||||
|
Create OTP TwoFAccount ${service} ${account} ${secret} ${digits} ${algorithm}
|
||||||
|
&{otp data} = Create Dictionary type=HOTP service=${service} account=${account} secret=${secret} digits=${digits} algorithm=${algorithm} period=${counter}
|
||||||
|
RETURN &{otp data}
|
||||||
|
|
||||||
|
Create OTP TwoFAccount
|
||||||
|
[Arguments] ${service} ${account} ${secret}=XXXXXXXX ${digits}=6 ${algorithm}=${SHA1}
|
||||||
|
Fill Service Field ${service}
|
||||||
|
Fill Account Field ${account}
|
||||||
|
Fill Secret Field ${secret}
|
||||||
|
Set Digits To ${digits}
|
||||||
|
Set Algorithm To ${algorithm}
|
||||||
|
Click Element ${CREATE BUTTON}
|
||||||
|
Wait Until Location Is ${ACCOUNTS PAGE URL} 10s
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Fill Service Field
|
||||||
|
[Arguments] ${service}
|
||||||
|
Input Text ${SERVICE FIELD} ${service}
|
||||||
|
|
||||||
|
Fill Account Field
|
||||||
|
[Arguments] ${account}
|
||||||
|
Input Text ${ACCOUNT FIELD} ${account}
|
||||||
|
|
||||||
|
Select TOTP Type
|
||||||
|
Click Element ${TOTP TOGGLE BUTTON}
|
||||||
|
|
||||||
|
Select HOTP Type
|
||||||
|
Click Element ${HOTP TOGGLE BUTTON}
|
||||||
|
|
||||||
|
Select STEAM Type
|
||||||
|
Click Element ${STEAM TOGGLE BUTTON}
|
||||||
|
|
||||||
|
Fill Secret Field
|
||||||
|
[Arguments] ${secret}
|
||||||
|
Input Text ${SECRET FIELD} ${secret}
|
||||||
|
|
||||||
|
Fill Period Field
|
||||||
|
Wait Until Page Contains Element ${PERIOD FIELD}
|
||||||
|
[Arguments] ${period}=30
|
||||||
|
Input Text ${PERIOD FIELD} ${period}
|
||||||
|
|
||||||
|
Fill Counter Field
|
||||||
|
Wait Until Page Contains Element ${COUNTER FIELD}
|
||||||
|
[Arguments] ${counter}=1
|
||||||
|
Input Text ${COUNTER FIELD} ${counter}
|
||||||
|
|
||||||
|
Set Digits To
|
||||||
|
[Arguments] ${digits}
|
||||||
|
Click Element ${DIGITS BUTTON PREFIX}${digits}
|
||||||
|
|
||||||
|
Set Algorithm To
|
||||||
|
[Arguments] ${algorithm}
|
||||||
|
Click Element ${ALGORITHM BUTTON PREFIX}${algorithm}
|
@ -8,10 +8,10 @@ Resource ../common.resource
|
|||||||
${EDIT ACCOUNT PAGE URL} ${ROOT URL}/account/1/edit
|
${EDIT ACCOUNT PAGE URL} ${ROOT URL}/account/1/edit
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
Edit Page Should Be Open For Account
|
Edit Page Should Be Open For TwoFAccount
|
||||||
[Arguments] ${account id}
|
[Arguments] ${account id}
|
||||||
Location Should Be ${ROOT URL}/account/${account id}/edit
|
Location Should Be ${ROOT URL}/account/${account id}/edit
|
||||||
|
|
||||||
Go To Edit Page For Account
|
Go To Edit Page For TwoFAccount
|
||||||
[Arguments] ${account id}
|
[Arguments] ${account id}
|
||||||
Go Authenticated To ${ROOT URL}/account/${account id}/edit
|
Go Authenticated To ${ROOT URL}/account/${account id}/edit
|
||||||
|
@ -8,8 +8,8 @@ Resource ../common.resource
|
|||||||
${SHOW ACCOUNT QRCODE PAGE URL} ${ROOT URL}/account/1/qrcode
|
${SHOW ACCOUNT QRCODE PAGE URL} ${ROOT URL}/account/1/qrcode
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
Show Account Qrcode Page Should Be Open
|
Show TwoFAccount Qrcode Page Should Be Open
|
||||||
Location Should Be ${SHOW ACCOUNT QRCODE PAGE URL}
|
Location Should Be ${SHOW ACCOUNT QRCODE PAGE URL}
|
||||||
|
|
||||||
Go To Show Account Qrcode Page
|
Go To Show TwoFAccount Qrcode Page
|
||||||
Go Authenticated To ${SHOW ACCOUNT QRCODE PAGE URL}
|
Go Authenticated To ${SHOW ACCOUNT QRCODE PAGE URL}
|
@ -3,6 +3,7 @@ Documentation A page object to use in Accounts tests.
|
|||||||
...
|
...
|
||||||
Library SeleniumLibrary
|
Library SeleniumLibrary
|
||||||
Library Collections
|
Library Collections
|
||||||
|
Resource start_page.robot
|
||||||
Resource ../common.resource
|
Resource ../common.resource
|
||||||
|
|
||||||
*** Variables ***
|
*** Variables ***
|
||||||
@ -12,12 +13,18 @@ ${GROUP SWITCH} groupSwitch
|
|||||||
${SEARCH FIELD} txtSearch
|
${SEARCH FIELD} txtSearch
|
||||||
${GRID CLASS} tfa-grid
|
${GRID CLASS} tfa-grid
|
||||||
${LIST CLASS} tfa-list
|
${LIST CLASS} tfa-list
|
||||||
${ACCOUNTS CONTAINER} .accounts > span
|
${ACCOUNTS CONTAINER} css:.accounts > span
|
||||||
${2FA ACCOUNT} class:tfa-cell
|
${2FA ACCOUNT} class:tfa-cell
|
||||||
${MODAL OTP} class:modal-otp
|
${MODAL OTP} class:modal-otp
|
||||||
${ALWAYS ON OTP} class:always-on-otp
|
${ALWAYS ON OTP} class:always-on-otp
|
||||||
${SHOW GROUP SWITCH BUTTON} btnShowGroupSwitch
|
${SHOW GROUP SWITCH BUTTON} btnShowGroupSwitch
|
||||||
${HIDE GROUP SWITCH BUTTON} btnHideGroupSwitch
|
${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
|
||||||
|
|
||||||
*** Keywords ***
|
*** Keywords ***
|
||||||
Go To Accounts Page
|
Go To Accounts Page
|
||||||
@ -32,9 +39,10 @@ Show An Otp In Modal
|
|||||||
Click Element ${account}
|
Click Element ${account}
|
||||||
Wait Until Element Is Visible ${OTP}
|
Wait Until Element Is Visible ${OTP}
|
||||||
|
|
||||||
Get TwoFAccounts Elements
|
Get Visible TwoFAccounts Elements
|
||||||
|
Wait Until Page Contains Element ${ACCOUNTS CONTAINER}
|
||||||
@{twofaccounts} = Get WebElements ${ACCOUNTS CONTAINER} > div
|
@{twofaccounts} = Get WebElements ${ACCOUNTS CONTAINER} > div
|
||||||
[return] ${twofaccounts}
|
[return] @{twofaccounts}
|
||||||
|
|
||||||
Get OTP Value Shown In Modal
|
Get OTP Value Shown In Modal
|
||||||
${string}= Get Text ${OTP}
|
${string}= Get Text ${OTP}
|
||||||
@ -97,3 +105,12 @@ Close Modal Otp
|
|||||||
Run Keyword If ${modal is open} Click Element ${CLOSE BUTTON}
|
Run Keyword If ${modal is open} Click Element ${CLOSE BUTTON}
|
||||||
Wait Until Element Is Not Visible ${MODAL OTP}
|
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}
|
@ -13,14 +13,14 @@ Resource ../../common.resource
|
|||||||
*** Test Cases ***
|
*** Test Cases ***
|
||||||
Grid Mode Should Display TwoFAccounts In Grid
|
Grid Mode Should Display TwoFAccounts In Grid
|
||||||
Run Set Option Keyword And Come Back Set Option Display Mode To Grid
|
Run Set Option Keyword And Come Back Set Option Display Mode To Grid
|
||||||
@{twofaccounts} = Get TwoFAccounts Elements
|
@{twofaccounts} = Get Visible TwoFAccounts Elements
|
||||||
FOR ${twofaccount} IN @{twofaccounts}
|
FOR ${twofaccount} IN @{twofaccounts}
|
||||||
Element Should Have Class ${twofaccount} ${GRID CLASS}
|
Element Should Have Class ${twofaccount} ${GRID CLASS}
|
||||||
END
|
END
|
||||||
|
|
||||||
List Mode Should Display TwoFAccounts In List
|
List Mode Should Display TwoFAccounts In List
|
||||||
Run Set Option Keyword And Come Back Set Option Display Mode To Grid
|
Run Set Option Keyword And Come Back Set Option Display Mode To Grid
|
||||||
@{twofaccounts} = Get TwoFAccounts Elements
|
@{twofaccounts} = Get Visible TwoFAccounts Elements
|
||||||
FOR ${twofaccount} IN @{twofaccounts}
|
FOR ${twofaccount} IN @{twofaccounts}
|
||||||
Element Should Have Class ${twofaccount} ${LIST CLASS}
|
Element Should Have Class ${twofaccount} ${LIST CLASS}
|
||||||
END
|
END
|
||||||
|
102
tests/EndToEnd/Tests/TwoFAccounts/search.robot
Normal file
102
tests/EndToEnd/Tests/TwoFAccounts/search.robot
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Documentation A test suite containing tests related to 2FAccounts search.
|
||||||
|
Suite Setup Run Keywords
|
||||||
|
... Open Custom Browser
|
||||||
|
... AND Play Admin Sign In Workflow
|
||||||
|
Suite Teardown Close All Browsers
|
||||||
|
Test Setup Set Up For Search
|
||||||
|
Resource ../../Pages/account_create_page.robot
|
||||||
|
Resource ../../Pages/accounts_page.robot
|
||||||
|
Resource ../../common.resource
|
||||||
|
Library String
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${CLEAR SEARCH BUTTON} btnClearSearch
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
|
||||||
|
Search Field Should Be Empty By Default
|
||||||
|
Search Field Should Be Empty
|
||||||
|
|
||||||
|
Search Field Should Show Close Button When Filled
|
||||||
|
Input Text ${SEARCH FIELD} lorem ipsum
|
||||||
|
Wait Until Page Contains Element ${CLEAR SEARCH BUTTON}
|
||||||
|
|
||||||
|
Clear Search Button Should Clear Search
|
||||||
|
Input Text ${SEARCH FIELD} lorem ipsum
|
||||||
|
Wait Until Page Contains Element ${CLEAR SEARCH BUTTON}
|
||||||
|
Click Element ${CLEAR SEARCH BUTTON}
|
||||||
|
Search Field Should Be Empty
|
||||||
|
|
||||||
|
Clearing Search Field Should Hide Clear Search Button
|
||||||
|
Input Text ${SEARCH FIELD} lorem ipsum
|
||||||
|
Wait Until Page Contains Element ${CLEAR SEARCH BUTTON}
|
||||||
|
Press Keys ${SEARCH FIELD} CTRL+a
|
||||||
|
Press Keys None DELETE
|
||||||
|
Page Should Not Contain Element ${CLEAR SEARCH BUTTON}
|
||||||
|
|
||||||
|
Search Should Show Exact Match On Service
|
||||||
|
${service} = Generate Random String 10 [LETTERS]
|
||||||
|
${account} = Generate Random String 10 [LETTERS]
|
||||||
|
&{TOTP} = Create TOTP TwoFAccount ${service} ${account}
|
||||||
|
Search Should Show Matching Results ${TOTP.service} 1 True
|
||||||
|
Search Should Show Matching Results ${TOTP.service} 1 False
|
||||||
|
|
||||||
|
Search Should Show Exact Match On Account
|
||||||
|
${service} = Generate Random String 10 [LETTERS]
|
||||||
|
${account} = Generate Random String 10 [LETTERS]
|
||||||
|
&{TOTP} = Create TOTP TwoFAccount ${service} ${account}
|
||||||
|
Search Should Show Matching Results ${TOTP.account} 1 True
|
||||||
|
Search Should Show Matching Results ${TOTP.account} 1 False
|
||||||
|
|
||||||
|
Search Should Show Partial Match On Service
|
||||||
|
${partial_service} = Generate Random String 10 [LETTERS]
|
||||||
|
${partial_account} = Generate Random String 10 [LETTERS]
|
||||||
|
${service a} = Set Variable xx_${partial_service}__xx
|
||||||
|
${account a} = Set Variable xxx_${partial_account}__xxx
|
||||||
|
&{TOTP} = Create TOTP TwoFAccount ${service a} ${account a}
|
||||||
|
${service b} = Set Variable yy_${partial_service}__yyy
|
||||||
|
${account b} = Set Variable yyy_${partial_account}__yyy
|
||||||
|
&{TOTP} = Create TOTP TwoFAccount ${service b} ${account b}
|
||||||
|
Search Should Show Matching Results ${partial_service} 2 True
|
||||||
|
Search Should Show Matching Results ${partial_service} 2 False
|
||||||
|
|
||||||
|
Search Should Show Partial Match On Account
|
||||||
|
${partial_service} = Generate Random String 10 [LETTERS]
|
||||||
|
${partial_account} = Generate Random String 10 [LETTERS]
|
||||||
|
${service a} = Set Variable xx_${partial_service}__xx
|
||||||
|
${account a} = Set Variable xxx_${partial_account}__xxx
|
||||||
|
&{TOTP} = Create TOTP TwoFAccount ${service a} ${account a}
|
||||||
|
${service b} = Set Variable yy_${partial_service}__yyy
|
||||||
|
${account b} = Set Variable yyy_${partial_account}__yyy
|
||||||
|
&{TOTP} = Create TOTP TwoFAccount ${service b} ${account b}
|
||||||
|
Search Should Show Matching Results ${partial_account} 2 True
|
||||||
|
Search Should Show Matching Results ${partial_account} 2 False
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Search Field Should Be Empty
|
||||||
|
${search} = Get Value ${SEARCH FIELD}
|
||||||
|
Should Be Empty ${search}
|
||||||
|
|
||||||
|
Search Should Show Matching Results
|
||||||
|
[Arguments] ${searched value} ${expected results number}=1 ${ignore_case}=False
|
||||||
|
Wait Until Page Contains Element ${SEARCH FIELD}
|
||||||
|
Input Text ${SEARCH FIELD} ${searched value}
|
||||||
|
Search Results Number Should Equal ${expected results number}
|
||||||
|
@{twofaccounts} = Get Visible TwoFAccounts Elements
|
||||||
|
FOR ${twofaccount} IN @{twofaccounts}
|
||||||
|
Element Should Contain ${twofaccount} ${searched value} None ${ignore_case}
|
||||||
|
END
|
||||||
|
|
||||||
|
Search Results Number Should Equal
|
||||||
|
[Arguments] ${expected results number}
|
||||||
|
${result count} = Get Element Count ${2FA ACCOUNT}
|
||||||
|
Should Be Equal As Integers ${result count} ${expected results number}
|
||||||
|
|
||||||
|
Set Up For Search
|
||||||
|
Go To Accounts Page
|
||||||
|
${twofaccount number} = Get Element Count ${2FA ACCOUNT}
|
||||||
|
IF ${twofaccount number} == 0
|
||||||
|
Create TOTP TwoFAccount lorem ipsum
|
||||||
|
END
|
||||||
|
Wait Until Page Contains Element ${SEARCH FIELD}
|
@ -43,12 +43,13 @@ Open Custom Browser
|
|||||||
Go Authenticated To
|
Go Authenticated To
|
||||||
[Arguments] ${url}
|
[Arguments] ${url}
|
||||||
Go To ${url}
|
Go To ${url}
|
||||||
${is_authenticated}= Run Keyword And Return Status Location Should Be ${url}
|
Wait Until Page Contains Element tag:footer
|
||||||
IF ${is_authenticated} == False
|
${is anonymous}= Run Keyword And Return Status Location Should Be ${LOGIN PAGE URL}
|
||||||
|
IF ${is anonymous} == True
|
||||||
Play Admin Sign In Workflow
|
Play Admin Sign In Workflow
|
||||||
Go To ${url}
|
Go To ${url}
|
||||||
|
Wait Until Page Contains Element tag:footer
|
||||||
END
|
END
|
||||||
Wait Until Location Is ${url}
|
|
||||||
|
|
||||||
A Success Notification Should Appear
|
A Success Notification Should Appear
|
||||||
Wait Until Element Is Visible ${SUCCESS NOTIFICATION}
|
Wait Until Element Is Visible ${SUCCESS NOTIFICATION}
|
||||||
|
@ -24,7 +24,7 @@ Play Admin Sign In Workflow
|
|||||||
Delete All Cookies
|
Delete All Cookies
|
||||||
Go To Legacy Login Page
|
Go To Legacy Login Page
|
||||||
Submit Credentials To Legacy Form Login ${ADMIN EMAIL} ${PASSWORD}
|
Submit Credentials To Legacy Form Login ${ADMIN EMAIL} ${PASSWORD}
|
||||||
Wait Until Location Is ${ACCOUNTS PAGE URL}
|
Wait Until Location Is Not ${LOGIN PAGE URL}
|
||||||
|
|
||||||
Play User Sign In Workflow
|
Play User Sign In Workflow
|
||||||
Play Logout Workflow
|
Play Logout Workflow
|
||||||
|
Loading…
x
Reference in New Issue
Block a user