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

[fix] stabilize the ODS-1864 test by scrolling button into view #1526

Merged
merged 1 commit into from
Jun 14, 2024
Merged
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,6 @@ Create Workbench
Add Environment Variables In Workbench
[Documentation] Adds the environment variables through the workbench creation page
[Arguments] ${env_variables}
${version_check}= Is RHODS Version Greater Or Equal Than 1.20.0
IF ${version_check}==True
${add_key_value_text}= Set Variable Add another key / value pair
ELSE
${add_key_value_text}= Set Variable Add another variable
END
# Use the `Jump to section` links in the page to scroll the section into view
Click Element //a[@href="#environment-variables"]
Click Element ${WORKBENCH_ADD_VAR_BTN_XP}
Expand All @@ -137,14 +131,12 @@ Add Environment Variables In Workbench
Input Text ${ENV_VARIABLES_SECTION_XP}/div[contains(@class, "-l-split")][${idx}]//input[@aria-label="value of item ${pair_idx}"]
... ${value}
IF ${n_pairs}-${pair_idx} > 1
Click Element ${ENV_VARIABLES_SECTION_XP}/div[contains(@class, "-l-split")][${idx}]//button[text()="${add_key_value_text}"]
# The element we want to click might get pushed out of view on every loop, let's scroll by an approx
# amount of pixels for the block of elements that gets added.
IF "${add_key_value_text}" == "Add another key / value pair"
Execute Javascript document.getElementsByClassName("pf-v5-c-drawer__content")[1].scrollBy(0,500) # robocop: disable
ELSE IF "${add_key_value_text}" == "Add another variable"
Execute Javascript document.getElementsByClassName("pf-v5-c-drawer__content")[1].scrollBy(0,700) # robocop: disable
END
${another_key_button_xpath}= Set Variable
... //section[@aria-label="Environment variables"]/div[contains(@class, "-l-split")][${idx}]//button[@data-testid="another-key-value-pair-button"] # robocop: disable:line-too-long
# Assure that the button we want to click is in the view
Execute Javascript
... document.evaluate('${another_key_button_xpath}', document, null, XPathResult.FIRST_ORDERED_NODE_TYPE, null).singleNodeValue.scrollIntoView() # robocop: disable:line-too-long
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

hm, that is good, no? 🙂

Click Element xpath=${another_key_button_xpath}
END
END
ELSE IF "${input_type}" == "${UPLOAD_TYPE}"
Expand Down
Loading