From 257eebfebe5a3926ca11fbd501d8450d426ca57a Mon Sep 17 00:00:00 2001 From: danfengliu Date: Thu, 24 Jan 2019 09:38:46 +0800 Subject: [PATCH] Add space adaptor for regexp when create a new project, we loose the criteria to match the project name because the return json datat may be shown in different lines . (#6768) Signed-off-by: danfengliu --- tests/resources/Harbor-Pages/Project.robot | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/resources/Harbor-Pages/Project.robot b/tests/resources/Harbor-Pages/Project.robot index b359ac9ad..51a431528 100644 --- a/tests/resources/Harbor-Pages/Project.robot +++ b/tests/resources/Harbor-Pages/Project.robot @@ -34,10 +34,12 @@ Create An New Project ${element}= Set Variable xpath=//button[contains(.,'OK')] Wait Until Element Is Visible And Enabled ${element} Click Element ${element} + #Try to get Project Infomation 5 times at most and sleep 1 second each time if we fail to get it. ${found_project}= Set Variable ${false} :For ${n} IN RANGE 1 5 \ ${rc} ${output}= Run And Return Rc And Output curl -u ${HARBOR_ADMIN}:${HARBOR_PASSWORD} -k -X GET --header 'Accept: application/json' ${HARBOR_URL}/api/projects?name=${projectname} - \ ${match} ${regexp_project_name} Should Match Regexp ${output} ,\"name\":\"(\\w+)\",\"creation_time\": + \ Log To Console ${output} + \ ${match} ${regexp_project_name} Should Match Regexp ${output} \"name\"\\s*:\\s*\"(\\w+)\"\\s*, \ ${found_project} Set Variable If '${rc}' == '0' and '${regexp_project_name}' == '${projectname}' ${true} \ Run Keyword If ${found_project} == ${true} Exit For Loop \ Sleep 1