Skip to content

Commit

Permalink
Fix Dashboard Suite 0410__ods_dashboard_projects Tests and Keywords
Browse files Browse the repository at this point in the history
Including fixes to numerous keywords within:
- DataConnections.resource
- Projects.resource
- Storages.resource
- Workbenches.resource

Signed-off-by: manosnoam <nmanos@redhat.com>
  • Loading branch information
manosnoam committed Dec 30, 2024
1 parent bbeec51 commit ab3158d
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 237 deletions.
9 changes: 9 additions & 0 deletions ods_ci/tests/Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,15 @@ Get All Text Under Element
END
RETURN ${text_list}

Scroll And Input Text Into Element
[Documentation] Scrolls element into view and inputs text into the element
[Arguments] ${element} ${text}
Scroll Element Into View ${element}
${text_entered}= Run Keyword And Return Status Input Text ${element} ${text}
IF ${text_entered} RETURN
Click Element ${element}
Press Keys NONE ${text}

Get All Strings That Contain
[Documentation] Returns new list of strings, for each item in ${list_of_strings} that contains ${substring_to_search}
[Arguments] ${list_of_strings} ${substring_to_search}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,16 @@ Resource Projects.resource


*** Variables ***

${S3_NAME_DC_INPUT}= xpath=//input[@data-testid="connection-name-desc-name"]
${S3_KEY_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_ACCESS_KEY_ID"]//input
${S3_SECRET_DC_INPUT}= xpath=//div[@data-testid="field hidden AWS_SECRET_ACCESS_KEY"]//input
${S3_ENDPOINT_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_S3_ENDPOINT"]//input
${S3_REGION_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_DEFAULT_REGION"]//input
${DC_SECTION}= xpath=//section[@id="data-connections"]
${S3_KEY_DC_INPUT}= xpath=//*[contains(@data-testid,"AWS_ACCESS_KEY_ID")]//input
${S3_SECRET_DC_INPUT}= xpath=//*[contains(@data-testid,"AWS_SECRET_ACCESS_KEY")]//input
${S3_ENDPOINT_DC_INPUT}= xpath=//*[contains(@data-testid,"AWS_S3_ENDPOINT")]//input
${S3_REGION_DC_INPUT}= xpath=//*[contains(@data-testid,"AWS_DEFAULT_REGION")]//input
${S3_BUCKET_DC_INPUT}= xpath=//*[contains(@data-testid,"AWS_S3_BUCKET")]//input
${DC_SECTION}= xpath=//*[@data-testid="connection-table"]
${DC_ADD_BTN_1}= xpath=//*[@data-testid="create-connection-button"]
${DC_ADD_BTN_2}= xpath=//button[@data-testid="add-connection-button"]
${S3_BUCKET_DC_INPUT}= xpath=//div[@data-testid="field short-text AWS_S3_BUCKET"]//input
${S3_DC_SUBMIT_BTN}= xpath=//*[@data-testid="modal-submit-button"]
${DC_WORKBENCH_SELECTOR}= xpath=//div[@data-testid="connect-existing-workbench-group"]//ul/li
${CONNECTION_TYPE_DROPDOWN}= xpath=//label[@for="connection-type"]/parent::div/parent::div//input


Expand All @@ -36,7 +35,7 @@ Create S3 Data Connection
END
Select Connection Type From Add Connection Modal S3 compatible object storage - v1
Fill Data Connection Form ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access}
... ${S3_DC_SUBMIT_BTN} aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... connected_workbench=${connected_workbench} press_cancel=${press_cancel}
... aws_bucket_name=${aws_bucket_name}

Expand All @@ -45,42 +44,36 @@ Edit S3 Data Connection
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access} ${new_dc_name}=${dc_name}
... ${aws_s3_endpoint}=${S3.AWS_DEFAULT_ENDPOINT} ${aws_region}=${S3.AWS_DEFAULT_REGION}
... ${connected_workbench}=${NONE} ${press_cancel}=${FALSE} ${aws_bucket_name}=${NONE}
ODHDashboard.Click Action From Actions Menu item_title=${dc_name} action=Edit
Click Action From Actions Menu item_title=${dc_name} action=Edit
Fill Data Connection Form ${project_title} ${new_dc_name} ${aws_access_key} ${aws_secret_access}
... ${S3_DC_SUBMIT_BTN} aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... aws_s3_endpoint=${aws_s3_endpoint} aws_region=${aws_region}
... connected_workbench=${connected_workbench} press_cancel=${press_cancel}
... aws_bucket_name=${aws_bucket_name}

Set Connection Between Data Connection And Workbench
[Documentation] Connects a DataConnection to an existent workbench
[Arguments] ${workbench_title}
Wait Until Element Is Enabled xpath=//button[@aria-label="Notebook select"]
Click Element xpath=//button[@aria-label="Notebook select"]
Wait Until Page Contains Element ${DC_WORKBENCH_SELECTOR}/button[.="${workbench_title}"]
Click Element ${DC_WORKBENCH_SELECTOR}/button[.="${workbench_title}"]

Data Connection Should Be Listed
[Documentation] Checks a Data Connection is listed in DS Project details page
[Arguments] ${name} ${type} ${connected_workbench}
${connection}= Set Variable ${DC_SECTION}//tr[td[@data-label="Name"]//div[.="${name}"]]
Move To Tab tab_title=Connections
${connection}= Set Variable ${DC_SECTION}//tr[td[@data-label="Name"]//*[.="${name}"]]

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '' but got '=' instead
Run Keyword And Continue On Failure Page Should Contain Element ${connection}
Run Keyword And Continue On Failure Page Should Contain Element ${connection}/td[.=" ${type}"]
Run Keyword And Continue On Failure Page Should Contain Element ${connection}//*[contains(.,"${type}")]
IF "${connected_workbench}" == "${NONE}"
Run Keyword And Continue On Failure Page Should Contain Element
... ${connection}/td[.="No connections"]
... ${connection}//*[@data-label="Connected resources" and .="-"]
ELSE
FOR ${index} ${workbench_title} IN ENUMERATE @{connected_workbench}
Log ${index}: ${workbench_title}
Run Keyword And Continue On Failure Page Should Contain Element
... ${connection}/td[@data-label="Connected workbenches"]//*[.="${workbench_title}"]
... ${connection}/td[@data-label="Connected resources"]//*[.="${workbench_title}"]
END
END

Data Connection Should Not Be Listed
[Documentation] Checks a Data Connection is not listed in DS Project details page
[Arguments] ${name}
Run Keyword And Continue On Failure Wait Until Page Does Not Contain Element
... ${DC_SECTION}//tr[td[@data-label="Name"]/*/div[.="${name}"]]
Move To Tab tab_title=Connections
${connection}= Set Variable ${DC_SECTION}//tr[td[@data-label="Name"]//*[.="${name}"]]

Check warning

Code scanning / Robocop

The assignment sign is not consistent within the file. Expected '{{ expected_sign }}' but got '{{ actual_sign }}' instead Warning test

The assignment sign is not consistent within the file. Expected '' but got '=' instead
Run Keyword And Continue On Failure Wait Until Page Does Not Contain Element ${connection}

Get Openshift Secret From Data Connection
[Documentation] Retrieves name of Openshift secret corresponding to a given S3 Data Connection based on Dispayed name in DS Project details page
Expand All @@ -91,43 +84,44 @@ Get Openshift Secret From Data Connection
Delete Data Connection
[Documentation] Deletes a Data Connection from DS Project details page
[Arguments] ${name} ${press_cancel}=${FALSE}
ODHDashboard.Click Action From Actions Menu item_title=${name} action=Delete
Click Action From Actions Menu item_title=${name} action=Delete
Handle Deletion Confirmation Modal item_title=${name} item_type=data connection press_cancel=${press_cancel}

Fill Data Connection Form
[Documentation] Data Connection Form can be used in the create or edit
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access} ${action_btn}
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access}
... ${aws_s3_endpoint}=${S3.AWS_DEFAULT_ENDPOINT} ${aws_region}=${S3.AWS_DEFAULT_REGION}
... ${connected_workbench}=${NONE} ${press_cancel}=${FALSE} ${aws_bucket_name}=${NONE}
Wait Until Page Contains Element ${S3_NAME_DC_INPUT}
Input Text ${S3_NAME_DC_INPUT} ${dc_name}
Input Text ${S3_KEY_DC_INPUT} ${aws_access_key}
Input Text ${S3_SECRET_DC_INPUT} ${aws_secret_access}
Input Text ${S3_ENDPOINT_DC_INPUT} ${aws_s3_endpoint}
Input Text ${S3_REGION_DC_INPUT} ${aws_region}
Input Text ${S3_BUCKET_DC_INPUT} ${aws_bucket_name}
Scroll And Input Text Into Element ${S3_NAME_DC_INPUT} ${dc_name}
Scroll And Input Text Into Element ${S3_KEY_DC_INPUT} ${aws_access_key}
Scroll And Input Text Into Element ${S3_SECRET_DC_INPUT} ${aws_secret_access}
Scroll And Input Text Into Element ${S3_ENDPOINT_DC_INPUT} ${aws_s3_endpoint}
Scroll And Input Text Into Element ${S3_REGION_DC_INPUT} ${aws_region}
Scroll And Input Text Into Element ${S3_BUCKET_DC_INPUT} ${aws_bucket_name}
IF ${press_cancel} == ${TRUE}

Check notice

Code scanning / Robocop

'{{ block_name }}' condition can be simplified Note test

'IF' condition can be simplified
Click Button ${GENERIC_CANCEL_BTN_XP}
ELSE
Wait Until Element Is Enabled ${GENERIC_CREATE_BTN_XP}
Click Button ${GENERIC_CREATE_BTN_XP}
END
Wait Until Generic Modal Disappears
Wait Until Project Is Open project_title=${project_title}
IF "${connected_workbench}" == "${NONE}"
Log msg=you are not connecting any workbenchs to ${dc_name} DataConnection
ELSE
Run Keyword And Continue On Failure
... Element Should Be Enabled xpath=//div[contains(@class,"modal")]//button[@aria-label="Notebook select"]
FOR ${workbench_title} IN @{connected_workbench}
Set Connection Between Data Connection And Workbench ${workbench_title}
Run Keyword And Continue On Failure Element Should Be Enabled ${S3_DC_SUBMIT_BTN}
Move To Tab tab_title=Workbenches
Click Action From Actions Menu item_title=${workbench_title} action=Edit
Add Existing Data Connection In Workbench data_connection=${dc_name}
Click Element ${GENERIC_SUBMIT_BTN_XP}
Wait Until Element Is Not Visible ${GENERIC_SUBMIT_BTN_XP} 10s
END
END
IF ${press_cancel} == ${TRUE}
Click Button ${GENERIC_CANCEL_BTN}
ELSE
Wait Until Element Is Enabled ${action_btn}
Click Button ${action_btn}
END
Wait Until Generic Modal Disappears
Wait Until Project Is Open project_title=${project_title}

Get Data Connection Form Values
[Arguments] ${dc_name}
ODHDashboard.Click Action From Actions Menu item_title=${dc_name} action=Edit
Click Action From Actions Menu item_title=${dc_name} action=Edit
Wait Until Page Contains Element ${S3_NAME_DC_INPUT}
${s3_name} Get Element Attribute ${S3_NAME_DC_INPUT} value
${s3_key} Get Element Attribute ${S3_KEY_DC_INPUT} value
Expand Down
Loading

0 comments on commit ab3158d

Please sign in to comment.