From ac70a1439731f1da4836d88c261c9383699503ed Mon Sep 17 00:00:00 2001 From: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com> Date: Fri, 19 May 2023 16:31:01 +0800 Subject: [PATCH] Add Retain image last pull time UI test case (#18695) Fix #18690 Signed-off-by: Yang Jiao --- .../Harbor-Pages/Configuration.robot | 8 ++++- .../Harbor-Pages/Configuration_Elements.robot | 4 ++- tests/robot-cases/Group1-Nightly/Common.robot | 32 +++++++++++++++++++ 3 files changed, 42 insertions(+), 2 deletions(-) diff --git a/tests/resources/Harbor-Pages/Configuration.robot b/tests/resources/Harbor-Pages/Configuration.robot index 55a5f7ad9..a2a9edb0a 100644 --- a/tests/resources/Harbor-Pages/Configuration.robot +++ b/tests/resources/Harbor-Pages/Configuration.robot @@ -370,4 +370,10 @@ Set Audit Log Forward Enable Skip Audit Log Database Switch To System Settings Retry Double Keywords When Error Click Element ${skip_audit_log_database_label} Checkbox Should Be Selected ${skip_audit_log_database_checkbox} - Retry Double Keywords When Error Retry Element Click ${config_save_button_xpath} Retry Wait Until Page Contains Configuration has been successfully saved. \ No newline at end of file + Retry Double Keywords When Error Retry Element Click ${config_save_button_xpath} Retry Wait Until Page Contains Configuration has been successfully saved. + +Set Up Retain Image Last Pull Time + [Arguments] ${action} + Run Keyword If '${action}'=='enable' Retry Double Keywords When Error Click Element ${retain_image_last_pull_time_label} Checkbox Should Be Selected ${retain_image_last_pull_time_checkbox} + ... ELSE Retry Double Keywords When Error Click Element ${retain_image_last_pull_time_label} Checkbox Should Not Be Selected ${retain_image_last_pull_time_checkbox} + Retry Double Keywords When Error Retry Element Click ${config_save_button_xpath} Retry Wait Until Page Contains Configuration has been successfully saved. diff --git a/tests/resources/Harbor-Pages/Configuration_Elements.robot b/tests/resources/Harbor-Pages/Configuration_Elements.robot index 691e17d86..b84a4ee4f 100644 --- a/tests/resources/Harbor-Pages/Configuration_Elements.robot +++ b/tests/resources/Harbor-Pages/Configuration_Elements.robot @@ -59,4 +59,6 @@ ${filter_dist_input} //hbr-filter//input ${audit_log_forward_syslog_endpoint_input_id} //*[@id='auditLogForwardEndpoint'] ${skip_audit_log_database_checkbox} //*[@id='skipAuditLogDatabase'] -${skip_audit_log_database_label} //clr-checkbox-wrapper//label[contains(@for,'skipAuditLogDatabase')] \ No newline at end of file +${skip_audit_log_database_label} //clr-checkbox-wrapper//label[contains(@for,'skipAuditLogDatabase')] +${retain_image_last_pull_time_label} //clr-checkbox-wrapper//label[contains(@for,'scannerSkipUpdatePullTime')] +${retain_image_last_pull_time_checkbox} //*[@id='scannerSkipUpdatePullTime'] diff --git a/tests/robot-cases/Group1-Nightly/Common.robot b/tests/robot-cases/Group1-Nightly/Common.robot index 73f8be783..18e71e154 100644 --- a/tests/robot-cases/Group1-Nightly/Common.robot +++ b/tests/robot-cases/Group1-Nightly/Common.robot @@ -1133,3 +1133,35 @@ Test Case - Job Service Dashboard Workers Retry Wait Until Page Not Contains Element //clr-datagrid[.//button[text()='Worker ID']]//clr-dg-row//clr-dg-cell[text()='REPLICATION'] Retry Wait Until Page Contains Element //app-donut-chart//div[text()=' 0/10 '] Close Browser + +Test Case - Retain Image Last Pull Time + [Tags] retain_image_last_pull_time + Init Chrome Driver + ${d}= Get Current Date result_format=%m%s + ${image}= Set Variable alpine + ${tag}= Set Variable 3.10 + ${project_name}= Set Variable project${d} + Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} + Create An New Project And Go Into Project ${project_name} + Push Image With Tag ${ip} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} ${project_name} ${image} ${tag} ${tag} + Switch To Configuration System Setting + Set Up Retain Image Last Pull Time enable + Go Into Project ${project_name} + Go Into Repo ${project_name}/${image} + Scan Repo ${tag} Succeed + Sleep 15 + Reload Page + Retry Wait Element Visible //clr-dg-row//clr-dg-cell[10] + ${last_pull_time}= Get Text //clr-dg-row//clr-dg-cell[10] + Should Be Empty ${last_pull_time} + Switch To Configuration System Setting + Set Up Retain Image Last Pull Time disable + Go Into Project ${project_name} + Go Into Repo ${project_name}/${image} + Scan Repo ${tag} Succeed + Sleep 15 + Reload Page + Retry Wait Element Visible //clr-dg-row//clr-dg-cell[10] + ${last_pull_time}= Get Text //clr-dg-row//clr-dg-cell[10] + Should Not Be Empty ${last_pull_time} + Close Browser