Add e2e tests for role based content of the about page

This commit is contained in:
Bubka 2023-08-29 09:10:10 +02:00
parent 0199ef9e21
commit 70313995b9
6 changed files with 136 additions and 10 deletions

View File

@ -52,10 +52,10 @@
{{ $t('commons.environment') }}
</h2>
<div class="about-debug box is-family-monospace is-size-7">
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listInfos.innerText" v-clipboard:success="clipboardSuccessHandler">
<button id="btnCopyEnvVars" :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listInfos.innerText" v-clipboard:success="clipboardSuccessHandler">
<font-awesome-icon :icon="['fas', 'copy']" />
</button>
<ul ref="listInfos">
<ul ref="listInfos" id="listInfos">
<li v-for="(value, key) in infos" :value="value" :key="key"><b>{{key}}</b>: {{value}}</li>
</ul>
</div>
@ -63,10 +63,10 @@
{{ $t('settings.admin_settings') }}
</h2>
<div v-if="showAdminSettings" class="about-debug box is-family-monospace is-size-7">
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listAdminSettings.innerText" v-clipboard:success="clipboardSuccessHandler">
<button id="btnCopyAdminSettings" :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listAdminSettings.innerText" v-clipboard:success="clipboardSuccessHandler">
<font-awesome-icon :icon="['fas', 'copy']" />
</button>
<ul ref="listAdminSettings">
<ul ref="listAdminSettings" id="listAdminSettings">
<li v-for="(value, setting) in adminSettings" :value="value" :key="setting"><b>{{setting}}</b>: {{value}}</li>
</ul>
</div>
@ -74,10 +74,10 @@
{{ $t('settings.user_preferences') }}
</h2>
<div v-if="showUserPreferences" class="about-debug box is-family-monospace is-size-7">
<button :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listUserPreferences.innerText" v-clipboard:success="clipboardSuccessHandler">
<button id="btnCopyUserPreferences" :aria-label="$t('commons.copy_to_clipboard')" class="button is-like-text is-pulled-right is-small is-text" v-clipboard="() => this.$refs.listUserPreferences.innerText" v-clipboard:success="clipboardSuccessHandler">
<font-awesome-icon :icon="['fas', 'copy']" />
</button>
<ul ref="listUserPreferences">
<ul ref="listUserPreferences" id="listUserPreferences">
<li v-for="(value, preference) in userPreferences" :value="value" :key="preference"><b>{{preference}}</b>: {{value}}</li>
</ul>
</div>
@ -86,6 +86,7 @@
<!-- close button -->
<p class="control">
<router-link
id="lnkBack"
:to="{ path: $route.params.goBackTo, params: { returnTo: $route.params.returnTo, toRefresh: true } }"
:aria-label="$t('commons.close_the_x_page', {pagetitle: pagetitle})"
class="button is-rounded"

View File

@ -3,9 +3,11 @@ Documentation A page object to use in About page tests.
...
Library SeleniumLibrary
Resource ../common.resource
Library String
*** Variables ***
${ABOUT PAGE URL} ${ROOT URL}/about
${BACK BUTTON} lnkBack
*** Keywords ***
About Page Should Be Open
@ -13,3 +15,40 @@ About Page Should Be Open
Go To About Page
Go To ${ABOUT PAGE URL}
Block Vars Should Be Visible
[Arguments] ${elementId}
Wait Until Page Contains Element id:${elementId}
${COUNT} = Get Element Count css:#${elementId} li
Should Be True 0 < ${COUNT}
Environment Vars Should Be Visible
Block Vars Should Be Visible listInfos
User Preferences Should Be Visible
Block Vars Should Be Visible listUserPreferences
User Preferences Should Not Be Visible
Page Should Not Contain id:listUserPreferences
Admin Settings Should Be Visible
Block Vars Should Be Visible listAdminSettings
Admin Settings Should Not Be Visible
Page Should Not Contain id:listAdminSettings
Block Vars Should Have A Value
[Arguments] ${elementId}
Wait Until Page Contains Element id:${elementId}
${elements} = Get WebElements css:#${elementId} li
FOR ${element} IN @{elements}
${text} = Get Text ${element}
@{values} = Split String ${text} :
Should Not Be Empty ${values}[1]
END
Copying Block Vars Should Notify On Success
[Arguments] ${button}
Click Button ${button}
A Success Notification Should Appear
Click Element ${SUCCESS NOTIFICATION}

View File

@ -0,0 +1,26 @@
*** Settings ***
Documentation A test suite containing tests related to the about page static content.
Suite Setup Run Keywords
... Open Custom Browser
... AND Play Admin Sign In Workflow
... AND Go To About Page
... AND Set Footer As Static
Suite Teardown Close All Browsers
Resource ../../Pages/about_page.robot
Resource ../../common.resource
*** Test Cases ***
Environment Vars Should Be Visible To Admin
Environment Vars Should Be Visible
User Preferences Should Be Visible To Admin
User Preferences Should Be Visible
Admin Settings Should Be Visible To Admin
Admin Settings Should Be Visible
Admin Settings Should Have A Value
Block Vars Should Have A Value listAdminSettings
Copying Admin Settings Should Notify On Success
Copying Block Vars Should Notify On Success btnCopyAdminSettings

View File

@ -0,0 +1,26 @@
*** Settings ***
Documentation A test suite containing tests related to the about page static content.
Suite Setup Run Keywords
... Open Custom Browser
... AND Play Logout Workflow
... AND Go To About Page
... AND Set Footer As Static
Suite Teardown Close All Browsers
Resource ../../Pages/about_page.robot
Resource ../../common.resource
*** Test Cases ***
Environment Vars Should Be Visible To Anonymous
Environment Vars Should Be Visible
Environment Vars Should Have A Value
Block Vars Should Have A Value listInfos
Copying Env Vars Should Notify On Success
Copying Block Vars Should Notify On Success btnCopyEnvVars
User Preferences Should Not Be Visible To Anonymous
User Preferences Should Not Be Visible
Admin Settings Should Not Be Visible To Anonymous
Admin Settings Should Not Be Visible

View File

@ -0,0 +1,27 @@
*** Settings ***
Documentation A test suite containing tests related to the about page static content.
Suite Setup Run Keywords
... Open Custom Browser
... AND Play User Sign In Workflow
... AND Go To About Page
... AND Set Footer As Static
Suite Teardown Close All Browsers
Resource ../../Pages/about_page.robot
Resource ../../common.resource
Library String
*** Test Cases ***
Environment Vars Should Be Visible To User
Environment Vars Should Be Visible
User Preferences Should Be Visible To User
User Preferences Should Be Visible
User Preferences Should Have A Value
Block Vars Should Have A Value listUserPreferences
Copying User Preferences Should Notify On Success
Copying Block Vars Should Notify On Success btnCopyUserPreferences
Admin Settings Should Not Be Visible
Page Should Not Contain id:listAdminSettings

View File

@ -16,6 +16,9 @@ ${PASSWORD} password
${ROOT URL} http://${SERVER}
${LOGOUT LINK} lnkSignOut
${SUCCESS NOTIFICATION} css:#vueNotification .is-success
${ALERT NOTIFICATION} css:#vueNotification .is-danger
*** Keywords ***
Open Custom Browser
[Arguments] ${url}=${ROOT URL}
@ -39,10 +42,10 @@ Go Authenticated To
Wait Until Location Is ${url}
A Success Notification Should Appear
Wait Until Element Is Visible css:#vueNotification .is-success
Wait Until Element Is Visible ${SUCCESS NOTIFICATION}
An Error Notification Should Appear
Wait Until Element Is Visible css:#vueNotification .is-danger
Wait Until Element Is Visible ${ALERT NOTIFICATION}
Field Should Show An Error
[Arguments] ${field error}
@ -50,7 +53,7 @@ Field Should Show An Error
Should Not Be Empty ${field error}
Scroll To Bottom
Execute Javascript window.scrollTo(0,document.body.scrollHeight)
Execute Javascript window.scrollTo(0,document.body.scrollHeight)
Element Should Have Class
[Arguments] ${element} ${className}
@ -60,4 +63,8 @@ Element Should Have Class
Element Should Not Have Class
[Arguments] ${element} ${className}
${class}= Get Element Attribute ${element} class
Should Not Contain ${class} ${className}
Should Not Contain ${class} ${className}
Set Footer As Static
execute javascript
... document.querySelector('footer').style = 'position: static';