Skip to content

Commit

Permalink
Fix: Dashboard UI tests (red-hat-data-services#1922)
Browse files Browse the repository at this point in the history
* fix: ODS-2206, wrong pipelines xpath

* fix: ODS-1813

* fix ODS-1818

* fix: ODS-2276
  • Loading branch information
FedeAlonso authored Oct 13, 2024
1 parent f0b8600 commit dc6e870
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ Serving Runtime Template Should Be Listed
[Arguments] ${displayed_name} ${serving_platform}
Run Keyword And Continue On Failure
... Wait Until Page Contains Element
... //table//tr/td[@data-label="Name"]//div[text()="${displayed_name}"]
... //td[@data-label="Name"]//span[text()="${displayed_name}"]
... timeout=10s
Run Keyword And Continue On Failure
... Wait Until Page Contains Element
... xpath=//table//tr[td[@data-label="Name"]//div[text()="${displayed_name}"]]/td[@data-label="Serving platforms supported"] # robocop: disable
... xpath=//td[@data-label="Name"]//span[text()="${displayed_name}"]/ancestor::td/following-sibling::td[@data-label="Serving platforms supported"] # robocop: disable
${actual_platform_labels_str}= Get Text
... xpath=//table//tr[td[@data-label="Name"]//div[text()="${displayed_name}"]]/td[@data-label="Serving platforms supported"] # robocop: disable
... xpath=//td[@data-label="Name"]//span[text()="${displayed_name}"]/ancestor::td/following-sibling::td[@data-label="Serving platforms supported"] # robocop: disable
${actual_platform_labels}= Split To Lines ${actual_platform_labels_str}
IF "${serving_platform}" == "both"
Run Keyword And Continue On Failure Length Should Be ${actual_platform_labels} ${2}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,20 @@ Workbench Status Should Be From Projects Home Page
${namespace}= Get Openshift Namespace From Data Science Project project_title=${project_title}
${_} ${workbench_cr_name}= Get Openshift Notebook CR From Workbench workbench_title=${workbench_title}
... namespace=${namespace}
Run Keyword And Continue On Failure Page Should Contain Element xpath=//a[text()="${project_title}"]/ancestor::tr/td[@data-label="Status"]//p[text()="${status}"] # robocop: disable

${xpath_exists}= Run Keyword And Return Status
... Element Should Be Visible xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]

IF not ${xpath_exists}
Click Element xpath=//td[@data-testid="notebook-column-expand"]
ELSE
Log XPath element found, no need to click alternative
END

# We need to wait it to render
${status_xpath}= Set Variable //a[text()="${workbench_title}"]/ancestor::tr//td[@data-label="Status"]//*[text()="${status}"]
Run Keyword And Continue On Failure Wait Until Element Is Visible ${status_xpath} timeout=10s
Run Keyword And Continue On Failure Page Should Contain Element ${status_xpath}

Start Workbench From Projects Home Page
[Documentation] Triggers the workbench "start" process from DS Projects home page.
Expand All @@ -298,8 +311,12 @@ Start Workbench From Projects Home Page
... Get Openshift Notebook CR From Workbench workbench_title=${workbench_title}
... namespace=${namespace}
END
Click Element xpath=//a[text()="${workbench_title}"]/ancestor::tr//a[text()="${project_title}"]/ancestor::tr//td[@data-label="Status"]//label[@class="pf-v5-c-switch"] # robocop: disable

${kebab_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible ${kebab_button} timeout=10s
Click Element ${kebab_button}
${start_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"]
Wait Until Element Is Visible ${start_button} timeout=10s
Click Element ${start_button}
ELSE
Fail msg=Cannot start ${workbench_title} workbench because it is not stopped.
END
Expand Down Expand Up @@ -328,7 +345,12 @@ Stop Workbench From Projects Home Page
END
${_} ${workbench_cr_name}= Get Openshift Notebook CR From Workbench workbench_title=${workbench_title} namespace=${namespace}
END
Click Element xpath=//a[text()="${workbench_title}"]/ancestor::tr//a[text()="${project_title}"]/ancestor::tr//td[@data-label="Status"]//label[@class="pf-v5-c-switch"] # robocop: disable
${kebab_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible ${kebab_button} timeout=10s
Click Element ${kebab_button}
${stop_button}= Set Variable xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]/ancestor::tr[@data-testid="project-notebooks-table-row"]//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"]
Wait Until Element Is Visible ${stop_button} timeout=10s
Click Element ${stop_button}
Handle Stop Workbench Confirmation Modal press_cancel=${press_cancel}
ELSE
Fail msg=Cannot stop ${workbench_title} workbench because it is neither starting nor running.
Expand All @@ -338,7 +360,7 @@ Stop Workbench From Projects Home Page

Wait Until Workbench Is Started From Projects Home Page
[Documentation] Waits until the workbench status is "RUNNING", from the DS Project home page
[Arguments] ${workbench_title} ${project_title} ${timeout}=30s
[Arguments] ${workbench_title} ${project_title} ${timeout}=60s
Wait Until Keyword Succeeds ${timeout} 5s Workbench Status Should Be From Projects Home Page
... workbench_title=${workbench_title} status=${WORKBENCH_STATUS_RUNNING} project_title=${project_title}

Expand All @@ -356,7 +378,7 @@ Launch And Access Workbench From Projects Home Page
${is_started}= Run Keyword And Return Status Workbench Status Should Be From Projects Home Page
... workbench_title=${workbench_title} status=${WORKBENCH_STATUS_RUNNING} project_title=${project_title}
IF ${is_started} == ${TRUE}
Click Element xpath=//tr//a[text()="${project_title}"]/ancestor::tr/td[@data-label="workbenchName"]//a[text()="${workbench_title}"]
Click Element xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"]
Switch Window NEW
Access To Workbench username=${username} password=${password}
... auth_type=${auth_type} expected_ide=${expected_ide}
Expand All @@ -368,7 +390,7 @@ Workbench Launch Link Should Be Disabled
[Documentation] Checks the workbench launch link is disabled from DS Projects home page.
[Arguments] ${workbench_title} ${project_title}
${link_status}= Get Element Attribute
... xpath=//tr//a[text()="${project_title}"]/ancestor::tr/td[@data-label="workbenchName"]//a[text()="${workbench_title}"] aria-disabled
... xpath=//a[@data-testid="notebook-route-link" and text()="${workbench_title}"] aria-disabled
Should Be Equal As Strings ${link_status} true
... msg=Workbench launch link should be disabled for workbench ${workbench_title} in project ${project_title}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -333,9 +333,9 @@ Start Workbench
${is_stopped}= Run Keyword And Return Status Workbench Status Should Be
... workbench_title=${workbench_title} status=${WORKBENCH_STATUS_STOPPED}
IF ${is_stopped} == ${TRUE}
Click Button xpath=//div[@data-testid="table-row-title"]//div[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible xpath=//div[@data-testid="table-row-title"]//div[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"] timeout=10
Click Element xpath=//div[@data-testid="table-row-title"]//div[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"]
Click Button xpath=//div[@data-testid="table-row-title"]//*[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible xpath=//div[@data-testid="table-row-title"]//*[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"] timeout=10
Click Element xpath=//div[@data-testid="table-row-title"]//*[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Start"]
ELSE
Log msg=Cannot start ${workbench_title} workbench because it is not stopped.
END
Expand Down Expand Up @@ -407,9 +407,9 @@ Stop Workbench
${is_starting}= Run Keyword And Return Status Workbench Status Should Be
... workbench_title=${workbench_title} status=${WORKBENCH_STATUS_STARTING}
IF ${is_started} == ${TRUE} or ${is_starting} == ${TRUE}
Click Button xpath=//div[@data-testid="table-row-title"]//div[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible xpath=//div[@data-testid="table-row-title"]//div[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"] timeout=10
Click Element xpath=//div[@data-testid="table-row-title"]//div[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"]
Click Button xpath=//div[@data-testid="table-row-title"]//*[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]
Wait Until Element Is Visible xpath=//div[@data-testid="table-row-title"]//*[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"] timeout=10
Click Element xpath=//div[@data-testid="table-row-title"]//*[text()="${workbench_title}"]/ancestor::tr//button[@aria-label="Kebab toggle"]/following::div//span[text()="Stop"]
Wait Until Generic Modal Appears
Handle Stop Workbench Confirmation Modal press_cancel=${press_cancel}
... from_running=${from_running}
Expand Down

0 comments on commit dc6e870

Please sign in to comment.