2019-06-24 12:09:34 +02:00
|
|
|
f# Copyright Project Harbor Authors
|
2017-08-07 08:02:38 +02:00
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License
|
|
|
|
|
|
|
|
*** Settings ***
|
|
|
|
Library OperatingSystem
|
|
|
|
Library String
|
|
|
|
Library Collections
|
|
|
|
Library requests
|
|
|
|
Library Process
|
|
|
|
Library SSHLibrary 1 minute
|
|
|
|
Library DateTime
|
2018-10-11 09:04:57 +02:00
|
|
|
Library Selenium2Library 60 10
|
2018-07-25 11:46:09 +02:00
|
|
|
Library JSONLibrary
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource Nimbus-Util.robot
|
|
|
|
Resource Vsphere-Util.robot
|
|
|
|
Resource VCH-Util.robot
|
|
|
|
Resource Drone-Util.robot
|
|
|
|
Resource Github-Util.robot
|
|
|
|
Resource Harbor-Util.robot
|
2019-04-11 09:15:35 +02:00
|
|
|
Resource Harbor-Pages/Public_Elements.robot
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource Harbor-Pages/HomePage.robot
|
|
|
|
Resource Harbor-Pages/HomePage_Elements.robot
|
|
|
|
Resource Harbor-Pages/Project.robot
|
|
|
|
Resource Harbor-Pages/Project_Elements.robot
|
|
|
|
Resource Harbor-Pages/Project-Members.robot
|
|
|
|
Resource Harbor-Pages/Project-Members_Elements.robot
|
2019-10-24 11:07:30 +02:00
|
|
|
Resource Harbor-Pages/Project-Webhooks.robot
|
|
|
|
Resource Harbor-Pages/Project-Webhooks_Elements.robot
|
2018-01-23 06:04:19 +01:00
|
|
|
Resource Harbor-Pages/Project-Repository.robot
|
|
|
|
Resource Harbor-Pages/Project-Repository_Elements.robot
|
2018-07-03 17:42:26 +02:00
|
|
|
Resource Harbor-Pages/Project-Config.robot
|
2019-08-21 08:12:12 +02:00
|
|
|
Resource Harbor-Pages/Project-Config-Elements.robot
|
2018-09-04 09:08:51 +02:00
|
|
|
Resource Harbor-Pages/Project-Helmcharts.robot
|
|
|
|
Resource Harbor-Pages/Project-Helmcharts_Elements.robot
|
2018-11-15 11:57:30 +01:00
|
|
|
Resource Harbor-Pages/Project-Retag.robot
|
|
|
|
Resource Harbor-Pages/Project-Retag_Elements.robot
|
2019-11-11 09:58:33 +01:00
|
|
|
Resource Harbor-Pages/Project-Tag-Retention.robot
|
|
|
|
Resource Harbor-Pages/Project-Tag-Retention_Elements.robot
|
2019-11-29 07:28:51 +01:00
|
|
|
Resource Harbor-Pages/Project_Robot_Account.robot
|
|
|
|
Resource Harbor-Pages/Project_Robot_Account_Elements.robot
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource Harbor-Pages/Replication.robot
|
|
|
|
Resource Harbor-Pages/Replication_Elements.robot
|
|
|
|
Resource Harbor-Pages/UserProfile.robot
|
2019-05-09 09:44:48 +02:00
|
|
|
Resource Harbor-Pages/UserProfile_Elements.robot
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource Harbor-Pages/Administration-Users.robot
|
|
|
|
Resource Harbor-Pages/Administration-Users_Elements.robot
|
2019-09-12 07:56:56 +02:00
|
|
|
Resource Harbor-Pages/GC.robot
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource Harbor-Pages/Configuration.robot
|
|
|
|
Resource Harbor-Pages/Configuration_Elements.robot
|
2018-01-12 03:42:17 +01:00
|
|
|
Resource Harbor-Pages/ToolKit.robot
|
2018-07-19 11:02:09 +02:00
|
|
|
Resource Harbor-Pages/ToolKit_Elements.robot
|
2018-03-12 07:20:37 +01:00
|
|
|
Resource Harbor-Pages/Vulnerability.robot
|
2019-06-24 12:09:34 +02:00
|
|
|
Resource Harbor-Pages/Vulnerability_Elements.robot
|
2018-03-28 10:45:49 +02:00
|
|
|
Resource Harbor-Pages/LDAP-Mode.robot
|
2019-05-22 05:19:08 +02:00
|
|
|
Resource Harbor-Pages/OIDC_Auth.robot
|
|
|
|
Resource Harbor-Pages/OIDC_Auth_Elements.robot
|
2018-07-25 11:46:09 +02:00
|
|
|
Resource Harbor-Pages/Verify.robot
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource Docker-Util.robot
|
2019-07-16 08:00:30 +02:00
|
|
|
Resource Helm-Util.robot
|
2017-08-07 08:02:38 +02:00
|
|
|
Resource OVA-Util.robot
|
|
|
|
Resource Cert-Util.robot
|
|
|
|
Resource SeleniumUtil.robot
|
2018-01-23 06:04:19 +01:00
|
|
|
Resource Nightly-Util.robot
|
2018-11-02 10:06:22 +01:00
|
|
|
Resource APITest-Util.robot
|
2019-03-28 07:37:03 +01:00
|
|
|
Resource TestCaseBody.robot
|
2018-11-02 10:06:22 +01:00
|
|
|
|
|
|
|
*** Keywords ***
|
2019-01-11 04:26:10 +01:00
|
|
|
Wait Until Element Is Visible And Enabled
|
|
|
|
[Arguments] ${element}
|
|
|
|
Wait Until Element Is Visible ${element}
|
|
|
|
Wait Until Element Is Enabled ${element}
|
|
|
|
|
2019-01-30 07:22:31 +01:00
|
|
|
Retry Action Keyword
|
2019-02-22 07:11:56 +01:00
|
|
|
[Arguments] ${keyword} @{param}
|
|
|
|
Retry Keyword When Error ${keyword} @{param}
|
2019-01-30 07:22:31 +01:00
|
|
|
|
|
|
|
Retry Wait Element
|
|
|
|
[Arguments] ${element_xpath}
|
2019-02-22 07:11:56 +01:00
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Wait Until Element Is Visible And Enabled @{param}
|
2019-01-31 10:58:05 +01:00
|
|
|
|
2019-08-05 10:13:39 +02:00
|
|
|
Retry Wait Element Visible
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Wait Until Element Is Visible @{param}
|
|
|
|
|
2019-01-31 10:58:05 +01:00
|
|
|
Retry Wait Element Not Visible
|
|
|
|
[Arguments] ${element_xpath}
|
2019-02-22 07:11:56 +01:00
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Wait Until Element Is Not Visible @{param}
|
|
|
|
|
2019-10-10 04:36:19 +02:00
|
|
|
Retry Wait Element Should Be Disabled
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Element Should Be Disabled @{param}
|
|
|
|
|
2019-02-22 07:11:56 +01:00
|
|
|
Retry Element Click
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Element Click @{param}
|
2019-01-30 07:22:31 +01:00
|
|
|
|
|
|
|
Retry Button Click
|
|
|
|
[Arguments] ${element_xpath}
|
2019-02-22 07:11:56 +01:00
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Button Click @{param}
|
|
|
|
|
|
|
|
Retry Text Input
|
|
|
|
[Arguments] ${element_xpath} ${text}
|
|
|
|
@{param} Create List ${element_xpath} ${text}
|
|
|
|
Retry Action Keyword Text Input @{param}
|
|
|
|
|
2019-09-12 07:56:56 +02:00
|
|
|
Retry Clear Element Text
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Clear Element Text @{param}
|
|
|
|
|
2019-05-09 09:44:48 +02:00
|
|
|
Retry Link Click
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Link Click @{param}
|
|
|
|
|
2019-03-15 10:18:44 +01:00
|
|
|
Retry Checkbox Should Be Selected
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Checkbox Should Be Selected @{param}
|
|
|
|
|
|
|
|
Retry Checkbox Should Not Be Selected
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Checkbox Should Not Be Selected @{param}
|
|
|
|
|
2019-02-22 07:11:56 +01:00
|
|
|
Retry Wait Until Page Contains
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Wait Until Page Contains @{param}
|
|
|
|
|
|
|
|
Retry Wait Until Page Contains Element
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Wait Until Page Contains Element @{param}
|
2019-01-30 07:22:31 +01:00
|
|
|
|
2019-03-11 03:34:53 +01:00
|
|
|
Retry Wait Until Page Not Contains Element
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
@{param} Create List ${element_xpath}
|
|
|
|
Retry Action Keyword Wait Until Page Does Not Contain Element @{param}
|
|
|
|
|
2019-06-03 10:58:24 +02:00
|
|
|
Retry Select Object
|
2019-10-10 04:36:19 +02:00
|
|
|
[Arguments] ${obj_name}
|
|
|
|
@{param} Create List ${obj_name}
|
|
|
|
Retry Action Keyword Select Object @{param}
|
2019-06-03 10:58:24 +02:00
|
|
|
|
|
|
|
Retry Textfield Value Should Be
|
2019-10-10 04:36:19 +02:00
|
|
|
[Arguments] ${element} ${text}
|
|
|
|
@{param} Create List ${element} ${text}
|
|
|
|
Retry Action Keyword Wait And Textfield Value Should Be @{param}
|
2019-06-03 10:58:24 +02:00
|
|
|
|
|
|
|
Retry List Selection Should Be
|
2019-10-10 04:36:19 +02:00
|
|
|
[Arguments] ${element} ${text}
|
|
|
|
@{param} Create List ${element} ${text}
|
|
|
|
Retry Action Keyword Wait And List Selection Should Be @{param}
|
|
|
|
|
2019-05-09 09:44:48 +02:00
|
|
|
Link Click
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
Click Link ${element_xpath}
|
2019-10-10 04:36:19 +02:00
|
|
|
|
2019-06-03 10:58:24 +02:00
|
|
|
Wait And List Selection Should Be
|
2019-10-10 04:36:19 +02:00
|
|
|
[Arguments] ${element} ${text}
|
|
|
|
Wait Until Element Is Visible And Enabled ${element}
|
|
|
|
List Selection Should Be ${element} ${text}
|
2019-06-03 10:58:24 +02:00
|
|
|
|
|
|
|
Wait And Textfield Value Should Be
|
2019-10-10 04:36:19 +02:00
|
|
|
[Arguments] ${element} ${text}
|
|
|
|
Wait Until Element Is Visible And Enabled ${element}
|
|
|
|
Textfield Value Should Be ${element} ${text}
|
2019-05-09 09:44:48 +02:00
|
|
|
|
2019-01-30 07:22:31 +01:00
|
|
|
Element Click
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
Wait Until Element Is Visible And Enabled ${element_xpath}
|
|
|
|
Click Element ${element_xpath}
|
2019-07-29 07:37:02 +02:00
|
|
|
Sleep 1
|
2019-01-30 07:22:31 +01:00
|
|
|
|
|
|
|
Button Click
|
|
|
|
[Arguments] ${element_xpath}
|
|
|
|
Wait Until Element Is Visible And Enabled ${element_xpath}
|
|
|
|
Click button ${element_xpath}
|
|
|
|
|
2019-02-22 07:11:56 +01:00
|
|
|
Text Input
|
|
|
|
[Arguments] ${element_xpath} ${text}
|
|
|
|
Wait Until Element Is Visible And Enabled ${element_xpath}
|
|
|
|
Input Text ${element_xpath} ${text}
|
|
|
|
|
2019-06-03 10:58:24 +02:00
|
|
|
Clear Field Of Characters
|
2019-10-10 04:36:19 +02:00
|
|
|
[Arguments] ${field} ${character count}
|
|
|
|
[Documentation] This keyword pushes the delete key (ascii: \8) a specified number of times in a specified field.
|
|
|
|
: FOR ${index} IN RANGE ${character count}
|
2019-12-12 10:01:31 +01:00
|
|
|
\ Press Keys ${field} \\8
|
2019-06-03 10:58:24 +02:00
|
|
|
|
2019-01-31 09:08:58 +01:00
|
|
|
Wait Unitl Command Success
|
2019-05-24 09:45:08 +02:00
|
|
|
[Arguments] ${cmd} ${times}=8
|
2019-01-31 09:08:58 +01:00
|
|
|
:FOR ${n} IN RANGE 1 ${times}
|
|
|
|
\ Log Trying ${cmd}: ${n} ... console=True
|
|
|
|
\ ${rc} ${output}= Run And Return Rc And Output ${cmd}
|
2019-05-24 09:45:08 +02:00
|
|
|
\ Exit For Loop If '${rc}'=='0'
|
2019-01-31 09:08:58 +01:00
|
|
|
\ Sleep 2
|
2019-02-26 06:37:16 +01:00
|
|
|
Log Command Result is ${output}
|
2019-05-24 09:45:08 +02:00
|
|
|
Should Be Equal As Strings '${rc}' '0'
|
|
|
|
[Return] ${output}
|
|
|
|
|
|
|
|
Command Should be Failed
|
|
|
|
[Arguments] ${cmd}
|
|
|
|
${rc} ${output}= Run And Return Rc And Output ${cmd}
|
|
|
|
Should Not Be Equal As Strings '${rc}' '0'
|
2019-01-31 09:08:58 +01:00
|
|
|
[Return] ${output}
|
|
|
|
|
2019-01-24 10:09:32 +01:00
|
|
|
Retry Keyword When Error
|
2019-02-22 07:11:56 +01:00
|
|
|
[Arguments] ${keyword} @{elements}
|
|
|
|
:For ${n} IN RANGE 1 6
|
2019-10-29 11:18:05 +01:00
|
|
|
\ Log To Console Trying ${keyword} elements @{elements} ${n} times ...
|
2019-02-22 07:11:56 +01:00
|
|
|
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
|
2019-01-30 07:22:31 +01:00
|
|
|
\ Log To Console Return value is ${out[0]}
|
2019-01-28 09:32:45 +01:00
|
|
|
\ Exit For Loop If '${out[0]}'=='PASS'
|
2019-02-13 07:48:09 +01:00
|
|
|
\ Sleep 2
|
|
|
|
Run Keyword If '${out[0]}'=='FAIL' Capture Page Screenshot
|
2019-02-26 06:37:16 +01:00
|
|
|
Should Be Equal As Strings '${out[0]}' 'PASS'
|
2019-12-31 04:31:52 +01:00
|
|
|
[Return] ${out[1]}
|
2019-03-11 03:34:53 +01:00
|
|
|
|
2019-09-24 08:47:19 +02:00
|
|
|
Retry Keyword When Return Value Mismatch
|
2019-10-02 10:43:50 +02:00
|
|
|
[Arguments] ${keyword} ${expected_value} ${count} @{elements}
|
2019-09-24 08:47:19 +02:00
|
|
|
:For ${n} IN RANGE 1 ${count}
|
|
|
|
\ Log To Console Trying ${keyword} ${n} times ...
|
|
|
|
\ ${out} Run Keyword And Ignore Error ${keyword} @{elements}
|
|
|
|
\ Log To Console Return value is ${out[1]}
|
|
|
|
\ ${status}= Set Variable If '${out[1]}'=='${expected_value}' 'PASS' 'FAIL'
|
|
|
|
\ Exit For Loop If '${out[1]}'=='${expected_value}'
|
|
|
|
\ Sleep 2
|
|
|
|
Run Keyword If ${status}=='FAIL' Capture Page Screenshot
|
|
|
|
Should Be Equal As Strings ${status} 'PASS'
|
|
|
|
|
2019-03-11 03:34:53 +01:00
|
|
|
Retry Double Keywords When Error
|
2019-11-25 04:49:19 +01:00
|
|
|
[Arguments] ${keyword1} ${element1} ${keyword2} ${element2} ${DoAssert}=${true}
|
2019-11-22 03:37:33 +01:00
|
|
|
:For ${n} IN RANGE 1 5
|
2019-04-09 07:41:56 +02:00
|
|
|
\ Log To Console Trying ${keyword1} and ${keyword2} ${n} times ...
|
2019-03-11 03:34:53 +01:00
|
|
|
\ ${out1} Run Keyword And Ignore Error ${keyword1} ${element1}
|
|
|
|
\ Capture Page Screenshot
|
2019-08-30 11:12:07 +02:00
|
|
|
\ Sleep 1
|
2019-03-11 03:34:53 +01:00
|
|
|
\ ${out2} Run Keyword And Ignore Error ${keyword2} ${element2}
|
|
|
|
\ Capture Page Screenshot
|
|
|
|
\ Log To Console Return value is ${out1[0]} ${out2[0]}
|
2019-06-18 08:59:46 +02:00
|
|
|
\ Exit For Loop If '${out2[0]}'=='PASS'
|
|
|
|
\ Sleep 1
|
2019-11-25 04:49:19 +01:00
|
|
|
Return From Keyword If ${DoAssert} == ${false} '${out2[0]}'
|
2019-05-22 05:19:08 +02:00
|
|
|
Should Be Equal As Strings '${out2[0]}' 'PASS'
|
|
|
|
|
|
|
|
Run Curl And Return Json
|
|
|
|
[Arguments] ${curl_cmd}
|
|
|
|
${json_data_file}= Set Variable ${CURDIR}${/}cur_user_info.json
|
|
|
|
${rc} ${output}= Run And Return Rc And Output ${curl_cmd}
|
|
|
|
Should Be Equal As Integers 0 ${rc}
|
|
|
|
Create File ${json_data_file} ${output}
|
|
|
|
${json}= Load Json From File ${json_data_file}
|
2019-11-11 09:58:33 +01:00
|
|
|
[Return] ${json}
|