harbor/tests/resources/Harbor-Pages/Project-Tag-Retention.robot
danfengliu 7fb9dbd0fa Upgrade docker and containerd
1. Fix E2E quotas issue, push the same image but with different name;
2. Add checkpoint for robot account test;
3. Upgraded docker and containerd in E2E image;
4. Package base image sample(busybox) into E2E image, so in E2E
container, all local docker images can be cleaned up, once base image is needed for
building image, it can be loaded locally;
5. Adapt OIDC service of supporting LDAP user, and add OIDC group user
test;
6. Restart docker deamon before content trust test, both in API and UI
test;
7. Add retry for keyword "Add A Tag Immutability Rule";
8. Fix tag retention test issue, missing click angle icon, and enhance
checkpoint of dry run and real run;
9. Fix schedule test issue for wrong cron string;
10. Disable quotas verification, it's not stable for script defect;

Signed-off-by: danfengliu <danfengl@vmware.com>
2021-02-24 15:43:11 +08:00

120 lines
6.6 KiB
Plaintext

# Copyright Project Harbor Authors
#
# 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 ***
Documentation This resource provides any keywords related to the Harbor private registry appliance
Resource ../../resources/Util.robot
*** Variables ***
*** Keywords ***
Add A Tag Retention Rule
Retry Element Click xpath=${project_tag_retention_add_rule_xpath}
Retry Element Click xpath=${project_tag_retention_template_xpath}
Retry Element Click xpath=${project_tag_retention_option_always_xpath}
Retry Element Click xpath=${project_tag_retention_save_add_button_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath}
Retry Add A Tag Immutability Rule
[Arguments] @{param}
Retry Keyword N Times When Error 5 Add A Tag Immutability Rule @{param}
Add A Tag Immutability Rule
[Arguments] ${scope} ${tag}
Reload Page
Sleep 3
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_retention_add_rule_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_immutability_save_add_button_xpath}
Retry Clear Element Text ${project_tag_immutability_scope_input_xpath}
Retry Text Input ${project_tag_immutability_scope_input_xpath} ${scope}
Retry Clear Element Text ${project_tag_immutability_tag_input_xpath}
Retry Text Input ${project_tag_immutability_tag_input_xpath} ${tag}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_save_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath}
Retry Wait Until Page Contains ${scope}
Retry Wait Until Page Contains ${tag}
Delete A Tag Retention Rule
Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_delete_button_xpath}
Retry Wait Until Page Not Contains Element xpath=${project_tag_retention_rule_name_xpath}
Delete A Tag Immutability Rule
Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_delete_button_xpath}
Retry Wait Until Page Not Contains Element xpath=${project_tag_retention_rule_name_xpath}
Edit A Tag Retention Rule
[Arguments] ${repos} ${tags}
Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_edit_button_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_modal_title_edit_xpath}
Input Text ${project_tag_retention_repo_input_xpath} ${repos}
Input Text ${project_tag_retention_tags_input_xpath} ${tags}
Retry Element Click xpath=${project_tag_retention_save_add_button_xpath}
Retry Wait Until Page Contains Element xpath=//span[contains(@class, 'rule-name')]//span[contains(.,'${tags}')]
Edit A Tag Immutability Rule
[Arguments] ${scope} ${tag}
Retry Element Click xpath=${project_tag_retention_action_button_xpath}
Retry Element Click xpath=${project_tag_retention_edit_button_xpath}
Retry Clear Element Text ${project_tag_immutability_scope_input_xpath}
Retry Text Input ${project_tag_immutability_scope_input_xpath} ${scope}
Retry Clear Element Text ${project_tag_immutability_tag_input_xpath}
Retry Text Input ${project_tag_immutability_tag_input_xpath} ${tag}
Retry Double Keywords When Error Retry Element Click xpath=${project_tag_immutability_save_add_button_xpath} Retry Wait Until Page Contains Element xpath=${project_tag_retention_rule_name_xpath}
Retry Wait Until Page Contains ${scope}
Retry Wait Until Page Contains ${tag}
Set Daily Schedule
Retry Element Click xpath=${project_tag_retention_edit_schedule_xpath}
Retry Element Click xpath=${project_tag_retention_select_policy_xpath}
Retry Element Click xpath=${project_tag_retention_option_daily_xpath}
Retry Element Click xpath=${project_tag_retention_config_save_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_schedule_ok_xpath}
Retry Element Click xpath=${project_tag_retention_schedule_ok_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_span_daily_xpath}
Execute Result Should Be
[Arguments] ${image} ${result}
FOR ${idx} IN RANGE 0 20
${out} Run Keyword And Ignore Error Retry Wait Until Page Contains Element xpath=//div[contains(@role, 'grid')]//div[contains(@class, 'datagrid-row-master') and contains(@role, 'row')]//clr-datagrid//div[contains(@role, 'grid')]//div[contains(@class, 'datagrid-row-master') and contains(@role, 'row')]//div[contains(@class, 'datagrid-row-scrollable') and contains(., '${result}') and contains(., '${image}')]
Exit For Loop If '${out[0]}'=='PASS'
Sleep 1
Retry Element Click ${project_tag_retention_refresh_xpath}
Sleep 5
Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_yes_xpath}
Retry Element Click ${project_tag_retention_list_expand_icon_xpath}
END
Should Be Equal As Strings '${out[0]}' 'PASS'
Execute Dry Run
[Arguments] ${image} ${result}
Retry Element Click xpath=${project_tag_retention_dry_run_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_yes_xpath}
Sleep 5
Retry Element Click xpath=${project_tag_retention_record_yes_xpath}
# memcached:123 should be deleted and hello-world:latest should be retained
Execute Result Should Be ${image} ${result}
Execute Run
[Arguments] ${image} ${result}
Retry Element Click xpath=${project_tag_retention_run_now_xpath}
Retry Element Click xpath=${project_tag_retention_execute_run_xpath}
Retry Wait Until Page Contains Element xpath=${project_tag_retention_record_no_xpath}
Sleep 5
Retry Element Click xpath=${project_tag_retention_record_no_xpath}
# memcached:123 should be deleted and hello-world:latest should be retained
Execute Result Should Be ${image} ${result}