mirror of
https://github.com/Bubka/2FAuth.git
synced 2025-02-23 22:01:49 +01:00
Add e2e tests for Always On OTP
This commit is contained in:
parent
29dcca8d35
commit
74ccbaa7c9
@ -153,7 +153,7 @@
|
|||||||
<span v-if="account.otp != undefined && isRenewingOTPs" class="has-nowrap has-text-grey has-text-centered is-size-5">
|
<span v-if="account.otp != undefined && isRenewingOTPs" class="has-nowrap has-text-grey has-text-centered is-size-5">
|
||||||
<font-awesome-icon :icon="['fas', 'circle-notch']" spin />
|
<font-awesome-icon :icon="['fas', 'circle-notch']" spin />
|
||||||
</span>
|
</span>
|
||||||
<span v-else-if="account.otp != undefined && isRenewingOTPs == false" class="is-clickable has-nowrap has-text-grey is-size-5 ml-4" @click="copyOTP(account.otp.password)" @keyup.enter="copyOTP(account.otp.password)" :title="$t('commons.copy_to_clipboard')">
|
<span v-else-if="account.otp != undefined && isRenewingOTPs == false" class="always-on-otp is-clickable has-nowrap has-text-grey is-size-5 ml-4" @click="copyOTP(account.otp.password)" @keyup.enter="copyOTP(account.otp.password)" :title="$t('commons.copy_to_clipboard')">
|
||||||
{{ displayPwd(account.otp.password) }}
|
{{ displayPwd(account.otp.password) }}
|
||||||
</span>
|
</span>
|
||||||
<span v-else>
|
<span v-else>
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
Documentation A page object to use in Accounts tests.
|
Documentation A page object to use in Accounts tests.
|
||||||
...
|
...
|
||||||
Library SeleniumLibrary
|
Library SeleniumLibrary
|
||||||
|
Library Collections
|
||||||
Resource ../common.resource
|
Resource ../common.resource
|
||||||
|
|
||||||
*** Variables ***
|
*** Variables ***
|
||||||
@ -9,7 +10,9 @@ ${ACCOUNTS PAGE URL} ${ROOT URL}/accounts
|
|||||||
|
|
||||||
${GROUP SWITCH} groupSwitch
|
${GROUP SWITCH} groupSwitch
|
||||||
${SEARCH FIELD} txtSearch
|
${SEARCH FIELD} txtSearch
|
||||||
|
${2FA ACCOUNT} class:tfa-cell
|
||||||
${MODAL OTP} class:modal-otp
|
${MODAL OTP} class:modal-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
|
||||||
|
|
||||||
@ -21,8 +24,8 @@ Go To Accounts Page
|
|||||||
Go Authenticated To ${ACCOUNTS PAGE URL}
|
Go Authenticated To ${ACCOUNTS PAGE URL}
|
||||||
|
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
Wait Until Page Contains Element class:tfa-cell
|
Wait Until Page Contains Element ${2FA ACCOUNT}
|
||||||
${account} = Get WebElement class:tfa-cell:first-child
|
${account} = Get WebElement ${2FA ACCOUNT}:first-child
|
||||||
Click Element ${account}
|
Click Element ${account}
|
||||||
Wait Until Element Is Visible ${OTP}
|
Wait Until Element Is Visible ${OTP}
|
||||||
|
|
||||||
@ -30,6 +33,16 @@ Get OTP Value Shown In Modal
|
|||||||
${string}= Get Text ${OTP}
|
${string}= Get Text ${OTP}
|
||||||
[return] ${string}
|
[return] ${string}
|
||||||
|
|
||||||
|
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}
|
||||||
|
|
||||||
Show Group Switch
|
Show Group Switch
|
||||||
Wait Until Page Contains Element ${SHOW GROUP SWITCH BUTTON}
|
Wait Until Page Contains Element ${SHOW GROUP SWITCH BUTTON}
|
||||||
Click Element ${SHOW GROUP SWITCH BUTTON}
|
Click Element ${SHOW GROUP SWITCH BUTTON}
|
||||||
@ -39,15 +52,20 @@ Hide Group Switch
|
|||||||
Click Element ${HIDE GROUP SWITCH BUTTON}
|
Click Element ${HIDE GROUP SWITCH BUTTON}
|
||||||
Wait Until Page Does Not Contain Element ${GROUP SWITCH}
|
Wait Until Page Does Not Contain Element ${GROUP SWITCH}
|
||||||
|
|
||||||
Click Otp To Copy It
|
Click Otp In Modal To Copy It
|
||||||
Click Element ${OTP}
|
Click Element ${OTP}
|
||||||
A Success Notification Should Appear
|
|
||||||
|
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}
|
||||||
|
|
||||||
Clipboard Should Contain
|
Clipboard Should Contain
|
||||||
[Arguments] ${expected}
|
[Arguments] ${expected}
|
||||||
Close Modal Otp
|
Close Modal Otp
|
||||||
Wait Until Element Is Visible ${SEARCH FIELD}
|
Wait Until Element Is Visible ${SEARCH FIELD}
|
||||||
Press Keys ${SEARCH FIELD} CTRL+v
|
Set Focus To Element ${SEARCH FIELD}
|
||||||
|
Press Keys None CTRL+v
|
||||||
${clipboard} = Get Value ${SEARCH FIELD}
|
${clipboard} = Get Value ${SEARCH FIELD}
|
||||||
Should Be Equal ${expected} ${clipboard}
|
Should Be Equal ${expected} ${clipboard}
|
||||||
Input Text ${SEARCH FIELD} ${CLEARED CLIPBOARD VALUE}
|
Input Text ${SEARCH FIELD} ${CLEARED CLIPBOARD VALUE}
|
||||||
|
73
tests/EndToEnd/Tests/Otps/always_on.robot
Normal file
73
tests/EndToEnd/Tests/Otps/always_on.robot
Normal file
@ -0,0 +1,73 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Documentation A test suite containing tests related to OTP generation and display.
|
||||||
|
Suite Setup Run Keywords
|
||||||
|
... Open Custom Browser
|
||||||
|
... AND Play Admin Sign In Workflow
|
||||||
|
... AND Run Set Option Keyword And Come Back Set Option Show Password To Constantly
|
||||||
|
Suite Teardown Close All Browsers
|
||||||
|
Library String
|
||||||
|
Resource ../../Pages/accounts_page.robot
|
||||||
|
Resource ../../Pages/settings_options_page.robot
|
||||||
|
Resource ../../common.resource
|
||||||
|
Resource otps.resource
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
Readable Otps Should Be Displayed On Home
|
||||||
|
Run Set Option Keyword And Come Back Disable Option Show Otp As Dot
|
||||||
|
@{otps} = Get OTP Values Shown On Home
|
||||||
|
FOR ${otp} IN @{otps}
|
||||||
|
Otp Should Not Be Obfuscated ${otp}
|
||||||
|
END
|
||||||
|
|
||||||
|
Obfuscated Otps Should Be Displayed On Home
|
||||||
|
Run Set Option Keyword And Come Back Enable Option Show Otp As Dot
|
||||||
|
@{otps} = Get OTP Values Shown On Home
|
||||||
|
FOR ${otp} IN @{otps}
|
||||||
|
Otp Should Be Obfuscated ${otp}
|
||||||
|
END
|
||||||
|
|
||||||
|
All Otp Digits Should Not Be Grouped
|
||||||
|
Run Set Option Keyword And Come Back Disable Option Password Formatting
|
||||||
|
@{otps} = Get OTP Values Shown On Home
|
||||||
|
FOR ${otp} IN @{otps}
|
||||||
|
Otp Digits Should Not Be Grouped ${otp}
|
||||||
|
END
|
||||||
|
|
||||||
|
All Otp Digits Should Be Grouped By Pair
|
||||||
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
|
Run Set Option Keyword And Come Back Set Option Password Formatting By Pair
|
||||||
|
@{otps} = Get OTP Values Shown On Home
|
||||||
|
FOR ${otp} IN @{otps}
|
||||||
|
Otp Digits Should Be Grouped By Pair ${otp}
|
||||||
|
END
|
||||||
|
|
||||||
|
All Otp Digits Should Be Grouped By Trio
|
||||||
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
|
Run Set Option Keyword And Come Back Set Option Password Formatting By Trio
|
||||||
|
@{otps} = Get OTP Values Shown On Home
|
||||||
|
FOR ${otp} IN @{otps}
|
||||||
|
Otp Digits Should Be Grouped By Trio ${otp}
|
||||||
|
END
|
||||||
|
|
||||||
|
All Otp Digits Should Be Grouped By Half
|
||||||
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
|
Run Set Option Keyword And Come Back Set Option Password Formatting By Half
|
||||||
|
@{otps} = Get OTP Values Shown On Home
|
||||||
|
FOR ${otp} IN @{otps}
|
||||||
|
Otp Digits Should Be Grouped By Half ${otp}
|
||||||
|
END
|
||||||
|
|
||||||
|
Readable Otp Should Be Copied On Click
|
||||||
|
Run Set Option Keyword And Come Back Disable Option Show Otp As Dot
|
||||||
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
|
Click Otp On Home To Copy It
|
||||||
|
A Success Notification Should Appear
|
||||||
|
Otp Notified As Copied Should Be In Clipboard
|
||||||
|
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
|
||||||
|
Otp Notified As Copied Should Be In Clipboard
|
||||||
|
${clicked otp} = Get Text ${ALWAYS ON OTP}:first-child
|
||||||
|
${otp} = Replace String ${clicked otp} ${SPACE} ${EMPTY}
|
||||||
|
Clipboard Should Contain ${otp}
|
@ -9,57 +9,60 @@ Library String
|
|||||||
Resource ../../Pages/accounts_page.robot
|
Resource ../../Pages/accounts_page.robot
|
||||||
Resource ../../Pages/settings_options_page.robot
|
Resource ../../Pages/settings_options_page.robot
|
||||||
Resource ../../common.resource
|
Resource ../../common.resource
|
||||||
|
Resource otps.resource
|
||||||
|
|
||||||
*** Test Cases ***
|
*** Test Cases ***
|
||||||
Readable Otp Should Be Displayed
|
Readable Otp Should Be Displayed
|
||||||
Run Set Option Keyword And Come Back Disable Option Show Otp As Dot
|
Run Set Option Keyword And Come Back Disable Option Show Otp As Dot
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
${otp value}= Get OTP Value Shown In Modal
|
${otp value}= Get OTP Value Shown In Modal
|
||||||
Should Not Match Regexp ${otp value} ^[\\s${OTP OBFUSCATOR SYMBOL}]*$
|
Otp Should Not Be Obfuscated ${otp value}
|
||||||
|
|
||||||
Obfuscated Otp Should Be Displayed
|
Obfuscated Otp Should Be Displayed
|
||||||
Run Set Option Keyword And Come Back Enable Option Show Otp As Dot
|
Run Set Option Keyword And Come Back Enable Option Show Otp As Dot
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
${otp value}= Get OTP Value Shown In Modal
|
${otp value}= Get OTP Value Shown In Modal
|
||||||
Should Match Regexp ${otp value} ^[\\s${OTP OBFUSCATOR SYMBOL}]*$
|
Otp Should Be Obfuscated ${otp value}
|
||||||
|
|
||||||
Otp Digits Should Not Be Grouped
|
Otp Digits Should Not Be Grouped
|
||||||
Run Set Option Keyword And Come Back Disable Option Password Formatting
|
Run Set Option Keyword And Come Back Disable Option Password Formatting
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
${otp value}= Get OTP Value Shown In Modal
|
${otp value}= Get OTP Value Shown In Modal
|
||||||
Should Match Regexp ${otp value} ^\\S+$
|
Otp Digits Should Not Be Grouped ${otp value}
|
||||||
|
|
||||||
Otp Digits Should Be Grouped By Pair
|
Otp Digits Should Be Grouped By Pair
|
||||||
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
Run Set Option Keyword And Come Back Set Option Password Formatting By Pair
|
Run Set Option Keyword And Come Back Set Option Password Formatting By Pair
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
${otp value}= Get OTP Value Shown In Modal
|
${otp value}= Get OTP Value Shown In Modal
|
||||||
Should Match Regexp ${otp value} ^\\S{2}(\\s{1}\\S{2})+$
|
Otp Digits Should Be Grouped By Pair ${otp value}
|
||||||
|
|
||||||
Otp Digits Should Be Grouped By Trio
|
Otp Digits Should Be Grouped By Trio
|
||||||
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
Run Set Option Keyword And Come Back Set Option Password Formatting By Trio
|
Run Set Option Keyword And Come Back Set Option Password Formatting By Trio
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
${otp value}= Get OTP Value Shown In Modal
|
${otp value}= Get OTP Value Shown In Modal
|
||||||
Should Match Regexp ${otp value} ^\\S{3}(\\s{1}\\S{3})+$
|
Otp Digits Should Be Grouped By Trio ${otp value}
|
||||||
|
|
||||||
Otp Digits Should Be Grouped By Half
|
Otp Digits Should Be Grouped By Half
|
||||||
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
Run Set Option Keyword And Come Back Set Option Password Formatting By Half
|
Run Set Option Keyword And Come Back Set Option Password Formatting By Half
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
${otp value}= Get OTP Value Shown In Modal
|
${otp value}= Get OTP Value Shown In Modal
|
||||||
Should Match Regexp ${otp value} ^\\S+(\\s{1}\\S+)$
|
Otp Digits Should Be Grouped By Half ${otp value}
|
||||||
|
|
||||||
Modal Should Be Closed After Otp Copy
|
Modal Should Be Closed After Otp Copy
|
||||||
Run Set Option Keyword And Come Back Enable Option Close Otp After Copy
|
Run Set Option Keyword And Come Back Enable Option Close Otp After Copy
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
Click Otp To Copy It
|
Click Otp In Modal To Copy It
|
||||||
|
A Success Notification Should Appear
|
||||||
Wait Until Element Is Not Visible ${OTP}
|
Wait Until Element Is Not Visible ${OTP}
|
||||||
|
|
||||||
Modal Should Not Be Closed After Otp Copy
|
Modal Should Not Be Closed After Otp Copy
|
||||||
Run Set Option Keyword And Come Back Disable Option Close Otp After Copy
|
Run Set Option Keyword And Come Back Disable Option Close Otp After Copy
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
Click Otp To Copy It
|
Click Otp In Modal To Copy It
|
||||||
|
A Success Notification Should Appear
|
||||||
Element Should Be Visible ${OTP}
|
Element Should Be Visible ${OTP}
|
||||||
|
|
||||||
Readable Otp Should Be Copied On Click
|
Readable Otp Should Be Copied On Click
|
||||||
@ -67,7 +70,7 @@ Readable Otp Should Be Copied On Click
|
|||||||
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
Run Set Option Keyword And Come Back Disable Option Copy Otp On Display
|
Run Set Option Keyword And Come Back Disable Option Copy Otp On Display
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
Click Otp To Copy It
|
Click Otp In Modal To Copy It
|
||||||
A Success Notification Should Appear
|
A Success Notification Should Appear
|
||||||
On Screen Otp Notified As Copied Should Be In Clipboard
|
On Screen Otp Notified As Copied Should Be In Clipboard
|
||||||
|
|
||||||
@ -78,7 +81,7 @@ Obfuscated Otp Should Be Copied On Click
|
|||||||
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
Run Set Option Keyword And Come Back Enable Option Password Formatting
|
||||||
Run Set Option Keyword And Come Back Enable Option Copy Otp On Display
|
Run Set Option Keyword And Come Back Enable Option Copy Otp On Display
|
||||||
Show An Otp In Modal
|
Show An Otp In Modal
|
||||||
Click Otp To Copy It
|
Click Otp In Modal To Copy It
|
||||||
A Success Notification Should Appear
|
A Success Notification Should Appear
|
||||||
Close Modal Otp
|
Close Modal Otp
|
||||||
Wait Until Element Is Visible ${SEARCH FIELD}
|
Wait Until Element Is Visible ${SEARCH FIELD}
|
||||||
|
31
tests/EndToEnd/Tests/Otps/otps.resource
Normal file
31
tests/EndToEnd/Tests/Otps/otps.resource
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
*** Settings ***
|
||||||
|
Library SeleniumLibrary
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${OTP OBFUSCATOR SYMBOL} ●
|
||||||
|
|
||||||
|
*** Keywords ***
|
||||||
|
Otp Should Be Obfuscated
|
||||||
|
[Arguments] ${otp}
|
||||||
|
Should Match Regexp ${otp} ^[\\s${OTP OBFUSCATOR SYMBOL}]*$
|
||||||
|
|
||||||
|
Otp Should Not Be Obfuscated
|
||||||
|
[Arguments] ${otp}
|
||||||
|
Should Not Match Regexp ${otp} ^[\\s${OTP OBFUSCATOR SYMBOL}]*$
|
||||||
|
|
||||||
|
Otp Digits Should Not Be Grouped
|
||||||
|
[Arguments] ${otp}
|
||||||
|
Should Match Regexp ${otp} ^\\S+$
|
||||||
|
|
||||||
|
Otp Digits Should Be Grouped By Pair
|
||||||
|
[Arguments] ${otp}
|
||||||
|
Should Match Regexp ${otp} ^\\S{2}(\\s{1}\\S{2})+$
|
||||||
|
|
||||||
|
Otp Digits Should Be Grouped By Trio
|
||||||
|
[Arguments] ${otp}
|
||||||
|
Should Match Regexp ${otp} ^\\S{3}(\\s{1}\\S{3})+$
|
||||||
|
|
||||||
|
Otp Digits Should Be Grouped By Half
|
||||||
|
[Arguments] ${otp}
|
||||||
|
Should Match Regexp ${otp} ^\\S+(\\s{1}\\S+)$
|
||||||
|
|
Loading…
Reference in New Issue
Block a user