Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tests for Data Science Projects page #583

Merged
merged 70 commits into from
Nov 23, 2022
Merged
Show file tree
Hide file tree
Changes from 63 commits
Commits
Show all changes
70 commits
Select commit Hold shift + click to select a range
19e4665
first files for DSG testing
bdattoma Sep 29, 2022
958a492
add first 2 tests for project creation
bdattoma Sep 30, 2022
77aa3a9
fix generic modal handling
bdattoma Sep 30, 2022
ed684de
add polarion ids
bdattoma Oct 4, 2022
9ad6738
add check on NS creation
bdattoma Oct 4, 2022
01486bb
add teardown to delete NS using OC
bdattoma Oct 7, 2022
4334b08
add workspace + delete all notebook from CLI
bdattoma Oct 13, 2022
5abfca4
minor variable name change
bdattoma Oct 14, 2022
4035274
add kw to wait for Dashboard spinner
bdattoma Oct 14, 2022
3f40004
add workspace basic testing (to be finished)
bdattoma Oct 14, 2022
f21a4c4
draft for template testing version
bdattoma Oct 14, 2022
784b548
add generic cancel button
bdattoma Oct 14, 2022
d27bdd9
add workspace v2 kw + new template
bdattoma Oct 17, 2022
51881d1
add workspace with PV storage testing
bdattoma Oct 18, 2022
9e65d18
minor changes
bdattoma Oct 18, 2022
93c7fa0
fix existing pv + add polarion ids
bdattoma Oct 18, 2022
e4dca43
fix prj selection in existing pv
bdattoma Oct 19, 2022
d54e84b
fix prj selection in existing pv (2)
bdattoma Oct 19, 2022
dc0a12a
add workspace + pv creation test + misc fixes
bdattoma Oct 19, 2022
e368e01
remove temporarily the custom pv size. leave default
bdattoma Oct 19, 2022
f6d2fc6
add TC to stop workspaces
bdattoma Oct 20, 2022
b62c2b0
add TC to delete workspaces
bdattoma Oct 20, 2022
eaa54eb
add polarion ids + add start wrksp in creation TCs
bdattoma Oct 20, 2022
487a13f
fix keywords + add TC for handling wrksp from home
bdattoma Oct 21, 2022
6419394
adapt code after new UI changes
bdattoma Oct 24, 2022
b4ba2ed
minor changes
bdattoma Oct 25, 2022
47ec0cf
add storage creation testing + test for existing PV
bdattoma Oct 25, 2022
6948108
add missing resource file for storage
bdattoma Oct 25, 2022
ff20239
add pv size gt 1
bdattoma Oct 25, 2022
9e147bd
add data connection resources + minore fixes
bdattoma Oct 25, 2022
0840cc8
add data connection first test
bdattoma Oct 26, 2022
df7524d
add missing storages file
bdattoma Oct 26, 2022
e9a4981
add deletions
bdattoma Oct 26, 2022
ff2aef9
migrate from workspaces to workbenches
bdattoma Oct 27, 2022
607bd79
remove create and start option
bdattoma Oct 27, 2022
70434ae
add storage deletion TC + check on storage resources
bdattoma Oct 27, 2022
5005d8c
misc fixes
bdattoma Oct 27, 2022
be6e9cb
refactoring + misc fixes
bdattoma Oct 28, 2022
969856e
misc fixes on deletion + more refactoring
bdattoma Oct 28, 2022
6ccb399
add check on button enablement in storage modal
bdattoma Nov 2, 2022
623e85a
add kw to add key-values env variables
bdattoma Nov 4, 2022
f9034c5
fix latest html changes
bdattoma Nov 8, 2022
88aea39
fix latest html changes + env variable test
bdattoma Nov 10, 2022
3bea1f7
minor changes
bdattoma Nov 11, 2022
ebbdd66
remove unnecessary code
bdattoma Nov 11, 2022
5fe02ed
add test for user access
bdattoma Nov 14, 2022
50bced5
remove duplication
bdattoma Nov 14, 2022
f9f4bed
various fixes
bdattoma Nov 15, 2022
9337332
fix test with multiple env variables
bdattoma Nov 16, 2022
3f15342
fix teardown to remove specific projects
bdattoma Nov 16, 2022
f5e48d1
fix teardown to remove specific projects
bdattoma Nov 16, 2022
67260c7
fix launch dashboard
bdattoma Nov 16, 2022
9ec1168
fix launch dashboard
bdattoma Nov 16, 2022
2ef1b41
fix launch dashboard
bdattoma Nov 17, 2022
db48a20
reduce timeout of wait + add modal close + fix modal closure
bdattoma Nov 17, 2022
9bf9b85
add some docs + minor fixes
bdattoma Nov 17, 2022
8e72894
add rhosi setup/teardown
bdattoma Nov 17, 2022
a6a2c1d
add documentation attributes
bdattoma Nov 17, 2022
e6d4a8a
add documentation attributes for DC resource file
bdattoma Nov 17, 2022
11ea825
add QG tags + smoke tests
bdattoma Nov 17, 2022
6697c63
fix typo
bdattoma Nov 17, 2022
b11c771
add some dummy values
bdattoma Nov 17, 2022
f2a5e35
fix copy paste error
bdattoma Nov 17, 2022
8fbe979
fix robocp alerts
bdattoma Nov 18, 2022
bf47e3e
remove unused template file
bdattoma Nov 18, 2022
2f714a1
fix robocop alerts
bdattoma Nov 18, 2022
bb321ac
fix inconsistency in generic modal kw names
bdattoma Nov 22, 2022
9e88ac4
fix comments by reviewers (1)
bdattoma Nov 22, 2022
a8aeccf
fix comments by reviewers (2)
bdattoma Nov 22, 2022
89af893
fix robocop alerts
bdattoma Nov 23, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 54 additions & 0 deletions tests/Resources/Common.robot
Original file line number Diff line number Diff line change
Expand Up @@ -189,3 +189,57 @@ Get OAuth Cookie
... It assumes Dashboard UI has been launched and login performed using UI.
${cookie}= Get Cookie _oauth_proxy
[Return] ${cookie.value}

Is Generic Modal Displayed
[Documentation] Checks if a modal window is displayed on the page.
... It assumes the html "id" contains "pf-modal", but it can be
... piloted with ${id} and ${partial_match} arguments
[Arguments] ${id}=pf-modal- ${partial_match}=${TRUE} ${timeout}=10s
IF ${partial_match} == ${TRUE}
${is_displayed}= Run Keyword And Return Status
... Page Should Contain Element xpath=//*[contains(@id,"${id}")]
ELSE
${is_displayed}= Run Keyword And Return Status
... Page Should Contain Element xpath=//*[@id="${id}")]
END
[Return] ${is_displayed}

Wait Until Modal Disappears
[Documentation] Waits until a modal window disappears from the page.
... It assumes the html "id" contains "pf-modal", but it can be
... piloted with ${id} and ${partial_match} arguments
[Arguments] ${id}=pf-modal- ${partial_match}=${TRUE} ${timeout}=10s
${is_modal}= Is Generic Modal Displayed
IF ${is_modal} == ${TRUE}
IF ${partial_match} == ${TRUE}
Wait Until Page Does Not Contain Element xpath=//*[contains(id,"${id}")] timeout=${timeout}
ELSE
Wait Until Page Does Not Contain Element xpath=//*[@id="${id}")] timeout=${timeout}
END
ELSE
Log No Modals on the screen right now.. level=WARN
END

Wait Until Modal Appears
[Documentation] Waits until a modal window appears on the page.
... It assumes the html "id" contains "pf-modal", but it can be
... piloted with ${id} and ${partial_match} arguments
[Arguments] ${id}=pf-modal- ${partial_match}=${TRUE} ${timeout}=10s
${is_modal}= Is Generic Modal Displayed
IF ${is_modal} == ${FALSE}
IF ${partial_match} == ${TRUE}
Wait Until Page Contains Element xpath=//*[contains(@id,"${id}")] timeout=${timeout}
ELSE
Wait Until Page Contains Element xpath=//*[@id="${id}")] timeout=${timeout}
END
ELSE
Log No Modals on the screen right now.. level=WARN
END

Close Generic Modal If Present
[Documentation] Close a modal window from the page and waits for it to disappear
${is_modal}= Is Generic Modal Displayed
IF ${is_modal} == ${TRUE}
Click Element xpath=//button[@aria-label="Close"]
Wait Until Modal Disappears
END
6 changes: 6 additions & 0 deletions tests/Resources/OCP.resource
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,12 @@ Verify CR Status
Should Be Equal ${cr_obj_dictionary.status.conditions[0].type} Available
Should Be Equal ${cr_obj_dictionary.status.conditions[0].status} True

Namespace Should Not Exist
[Arguments] ${namespace}
${present}= Run Keyword And Return Status OpenshiftLibrary.Oc Get kind=Project label_selector=metadata.name=${namespace}
IF ${present} == ${TRUE}
Fail msg=The namespace ${namespace} exists!
END
Is RHODS Self-Managed
[Documentation] Returns ${FALSE} if RHODS Managed (i.e., Cloud version) is installed
... in the cluster (e.g., usually on OSD, ROSA).
Expand Down
9 changes: 9 additions & 0 deletions tests/Resources/Page/ODH/ODHDashboard/ODHDashboard.robot
Original file line number Diff line number Diff line change
Expand Up @@ -700,3 +700,12 @@ Get Links From Switcher
Open Application Switcher Menu
[Documentation] Clicks on the App Switcher in the top navigation bar of RHODS Dashboard
Click Button //button[@class="pf-c-app-launcher__toggle"]

Maybe Wait For Dashboard Loading Spinner Page
[Documentation] Detecs the loading symbol (spinner) and wait for it to disappear.
... If the spinner does not appear, the keyword ignores the error.
[Arguments] ${timeout}=5s
Run Keyword And Ignore Error Run Keywords
... Wait Until Page Contains Element xpath=//span[@class="pf-c-spinner__tail-ball"] timeout=${timeout}
... AND
... Wait Until Page Does Not Contain Element xpath=//span[@class="pf-c-spinner__tail-ball"] timeout=${timeout}
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
*** Settings ***
Resource ../../../../Page/Components/Components.resource
Resource ../../../../Common.robot
Resource Projects.resource


*** Variables ***
${S3_NAME_DC_INPUT_XP}= xpath=//input[@aria-label="AWS field Name"]
${S3_KEY_DC_INPUT_XP}= xpath=//input[@aria-label="AWS field AWS_ACCESS_KEY_ID"]
${S3_SECRET_DC_INPUT_XP}= xpath=//input[@aria-label="AWS field AWS_SECRET_ACCESS_KEY"]
${S3_ENDPOINT_DC_INPUT_XP}= xpath=//input[@aria-label="AWS field AWS_S3_ENDPOINT"]
${S3_REGION_DC_INPUT_XP}= xpath=//input[@aria-label="AWS field AWS_DEFAULT_REGION"]
${DC_SECTION_XP}= xpath=//div[div//h4[@id="data-connections"]]
${DC_ADD_BTN_1_XP}= ${DC_SECTION_XP}/div/button[text()="Add data connection"]
${DC_ADD_BTN_2_XP}= xpath=//footer/button[text()="Add data connection"]


*** Keywords ***
Create S3 Data Connection
[Documentation] Creates a S3 Data Connection from DS Project details page
[Arguments] ${project_title} ${dc_name} ${aws_access_key} ${aws_secret_access} ${aws_s3_endpoint} ${aws_region} ${connected_workbench}=${NONE} ${press_cancel}=${FALSE}
Click Button ${DC_ADD_BTN_1_XP}
Wait Until Page Contains Element ${S3_NAME_DC_INPUT_XP}
Input Text ${S3_NAME_DC_INPUT_XP} ${dc_name}
Input Text ${S3_KEY_DC_INPUT_XP} ${aws_access_key}
Input Text ${S3_SECRET_DC_INPUT_XP} ${aws_secret_access}
Input Text ${S3_ENDPOINT_DC_INPUT_XP} ${aws_s3_endpoint}
Input Text ${S3_REGION_DC_INPUT_XP} ${aws_region}
IF ${press_cancel} == ${TRUE}
Click Button ${GENERIC_CANCEL_BTN_XP}
ELSE
Wait Until Element Is Enabled ${STORAGE_ADD_BTN_2_XP}
Click Button ${STORAGE_ADD_BTN_2_XP}
END
Wait Until Modal Disappears
Wait Until Project Is Open project_title=${project_title}

Data Connection Should Be Listed
[Documentation] Checks a Data Connection is listed in DS Project details page
[Arguments] ${name} ${type} ${connected_workbench}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other keywords ${name} is called ${dc_name}. I think it could be used here too. Also it could be ${dc_type}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, sorry for the mixed approach. I thought to spare character and improve readability/development to remove the prefix where not needed. So for example if a kw is called "Data Connection Is Listed" the ${name} argument cannot be anything else than th data connection name.

Where the prefix is added, like in "Create S3 Data connection" is to avoid ambiguity because there are many arguments. Same approach applied with storages for example. While workbench resource file was the first one created and I didn't follow the same rule. Changing it now it's very error-prone process IMO.

If you all prefer me to change it, I can do in another PR if you don't mind since we need these tests for validating 1.19

Run keyword And Continue On Failure Page Should Contain Element ${DC_SECTION_XP}//td[@data-label="Name"]/h4/div[text()="${name}"]
Run keyword And Continue On Failure Page Should Contain Element ${DC_SECTION_XP}//tr[td[@data-label="Name"]/h4/div[text()="${name}"]]/td[text()=" ${type}"]
IF "${connected_workbench}" == "${NONE}"
Run Keyword And Continue On Failure Page Should Contain Element ${DC_SECTION_XP}//tr[td[@data-label="Name"]/h4/div[text()="${name}"]]/td[text()="No connections"]
ELSE
FOR ${index} ${workbench_title} IN ENUMERATE @{connected_workbench}
Log ${index}: ${workbench_title}
Run Keyword And Continue On Failure Page Should Contain Element ${DC_SECTION_XP}//tr[td[@data-label="Name"]/h4/div[text()="${name}"]]/td[@data-label="Connected workbenches"]/ul/li[text()="${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_XP}//tr[td[@data-label="Name"]/h4/div[text()="${name}"]]

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
[Arguments] ${dc_name} ${namespace}
${rc} ${secret_name}= Run And Return Rc And Output oc get secret -n ${namespace} -o jsonpath='{.items[?(@.metadata.annotations.openshift\\.io/display-name=="${dc_name}")].metadata.name}'
[Return] ${rc} ${secret_name}

Delete Data Connection
[Documentation] Deletes a Data Connection from DS Project details page
[Arguments] ${name} ${press_cancel}=${FALSE}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Parameter could be ${dc_name}. Is ${press_cancel} needed (it could be just passed false when calling the other keyword)?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

about the ${dc_name}, pls read the comment above #583 (comment)

${press_cancel} is needed only for specific tests, so I thought these keywords will be re-used for other scenarios (e.g., model serving), then it would spare an argument (very likely always set to FALSE) to the developer who is gonna them

Click Action From Actions Menu item_title=${name} item_type=data connection action=Delete
Handle Deletion Confirmation Modal item_title=${name} item_type=data connection press_cancel=${press_cancel}
Loading