From e58f18bd51ffe81f5e1d7787bfa8846c3cba00d0 Mon Sep 17 00:00:00 2001 From: Yang Jiao <72076317+YangJiao0817@users.noreply.github.com> Date: Thu, 21 Jul 2022 17:40:38 +0800 Subject: [PATCH] Update routing test case (#17221) Add retry to improve test case stability Signed-off-by: Yang Jiao --- .../Harbor-Pages/HomePage_Elements.robot | 2 +- .../Harbor-Pages/Vulnerability.robot | 7 +----- .../Harbor-Pages/Vulnerability_Elements.robot | 4 ++-- tests/resources/Util.robot | 8 ++++++- .../robot-cases/Group1-Nightly/Routing.robot | 22 +++++-------------- 5 files changed, 17 insertions(+), 26 deletions(-) diff --git a/tests/resources/Harbor-Pages/HomePage_Elements.robot b/tests/resources/Harbor-Pages/HomePage_Elements.robot index 541dc113d..bbafdbdb9 100644 --- a/tests/resources/Harbor-Pages/HomePage_Elements.robot +++ b/tests/resources/Harbor-Pages/HomePage_Elements.robot @@ -35,4 +35,4 @@ ${about_btn} //clr-dropdown-menu/a[contains(.,'About')] ${header} xpath=//clr-header[contains(@class,'header-5')] ${color_theme_light} //span[contains(.,'LIGHT')] ${close_btn} //button[contains(.,'CLOSE')] - +${more_info_link_xpath} //sign-in//div//a[contains(.,'More info...')] \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Vulnerability.robot b/tests/resources/Harbor-Pages/Vulnerability.robot index f7b34c498..564d768ba 100644 --- a/tests/resources/Harbor-Pages/Vulnerability.robot +++ b/tests/resources/Harbor-Pages/Vulnerability.robot @@ -118,9 +118,4 @@ Stop Scan All Artifact Check Scan All Artifact Job Status Is Stopped Wait Until Element Is Visible ${stopped_icon} ${stopped_total}= Get Text ${stopped_icon} - Should Be True ${stopped_total} > 0 - -Open Image Scanners Documentation - Switch To Scanners Page - Retry Element Click //clr-signpost//cds-icon - Retry Link Click //clr-signpost-content//a[contains(.,'view documentation')] \ No newline at end of file + Should Be True ${stopped_total} > 0 \ No newline at end of file diff --git a/tests/resources/Harbor-Pages/Vulnerability_Elements.robot b/tests/resources/Harbor-Pages/Vulnerability_Elements.robot index 01542b131..9d2bf67d2 100644 --- a/tests/resources/Harbor-Pages/Vulnerability_Elements.robot +++ b/tests/resources/Harbor-Pages/Vulnerability_Elements.robot @@ -34,5 +34,5 @@ ${scanner_set_default} xpath=//button[@id="set-default"] ${scanner_set_default_success_xpath} //span[contains(.,'Successfully updated')] ${not_scanned_icon} xpath=//span[@class[contains(.,'not-scan')]] ${stopped_icon} //span[@class[contains(.,'badge abort')]] - - +${view_scanner_icon_xpath} //clr-signpost//cds-icon +${view_scanner_doc_xpath} //clr-signpost-content//a[contains(.,'view documentation')] \ No newline at end of file diff --git a/tests/resources/Util.robot b/tests/resources/Util.robot index 8ca7b907b..86244377d 100644 --- a/tests/resources/Util.robot +++ b/tests/resources/Util.robot @@ -301,4 +301,10 @@ Log All New Tab Execute Javascript window.open('') - Select Window title=undefined \ No newline at end of file + Select Window title=undefined + +Click Link New Tab And Switch + [Arguments] ${element_xpath} + Retry Link Click ${element_xpath} + ${handles}= Get Window Handles + Retry Action Keyword Switch Window ${handles}[-1] \ No newline at end of file diff --git a/tests/robot-cases/Group1-Nightly/Routing.robot b/tests/robot-cases/Group1-Nightly/Routing.robot index 196d423ac..22f277125 100644 --- a/tests/robot-cases/Group1-Nightly/Routing.robot +++ b/tests/robot-cases/Group1-Nightly/Routing.robot @@ -75,20 +75,14 @@ Test Case - Open License Page Init Chrome Driver Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} View About - Retry Link Click ${license_xpath} - Sleep 3 - Switch Window locator=NEW - Retry Wait Until Page Contains Apache License + Retry Double Keywords When Error Click Link New Tab And Switch ${license_xpath} Retry Wait Until Page Contains Apache License Close Browser Test Case - Open More Info Page [Tags] more_info_page Init Chrome Driver Go To ${HARBOR_URL} - Retry Link Click //sign-in//div//a[contains(.,'More info...')] - Sleep 3 - Switch Window locator=NEW - Retry Wait Until Page Contains An open source trusted cloud native registry project that stores, signs, and scans content. + Retry Double Keywords When Error Click Link New Tab And Switch ${more_info_link_xpath} Retry Wait Until Page Contains An open source trusted cloud native registry project that stores, signs, and scans content. Close Browser Test Case - Open CVE Details Page @@ -104,18 +98,14 @@ Test Case - Open CVE Details Page Go Into Repo project${d}/${image} Scan Repo ${sha256} Succeed Go Into Artifact ${sha256} - Retry Link Click //hbr-artifact-vulnerabilities//clr-dg-row//a[contains(.,'${cve}')] - Sleep 3 - Switch Window locator=NEW - Retry Wait Element //h1[contains(.,'${cve}')] + Retry Double Keywords When Error Click Link New Tab And Switch //hbr-artifact-vulnerabilities//clr-dg-row//a[contains(.,'${cve}')] Retry Wait Element //h1[contains(.,'${cve}')] Close Browser Test Case - Open Image Scanners Documentation Page [Tags] image_scanners_documentation_page Init Chrome Driver Sign In Harbor ${HARBOR_URL} ${HARBOR_ADMIN} ${HARBOR_PASSWORD} - Open Image Scanners Documentation - Sleep 3 - Switch Window locator=NEW - Retry Wait Until Page Contains Vulnerability Scanning with Pluggable Scanners + Switch To Scanners Page + Retry Element Click ${view_scanner_icon_xpath} + Retry Double Keywords When Error Click Link New Tab And Switch ${view_scanner_doc_xpath} Retry Wait Until Page Contains Vulnerability Scanning with Pluggable Scanners Close Browser