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 operations for automation #4250

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NamrathaRao24
Copy link

Description

Please include Automation development guidelines. Source of Test case - New Feature/Regression Test/Close loop of customer BZs

click to expand checklist
  • Create a test case in Polarion reviewed and approved.
  • Create a design/automation approach doc. Optional for tests with similar tests already automated.
  • Review the automation design
  • Implement the test script and perform test runs
  • Submit PR for code review and approve
  • Update Polarion Test with Automation script details and update automation fields
  • If automation is part of Close loop, update BZ flag qe-test_coverage “+” and link Polarion test

Copy link
Contributor

openshift-ci bot commented Nov 25, 2024

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: NamrathaRao24

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

from selenium.webdriver.support.ui import WebDriverWait


def take_ss(driver, filename: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please give meaningful method name. "capture_screen" or "screenshot" etc

def take_ss(driver, filename: str):
"""Takes a screenshot and saves it to the specified filename."""
try:
driver.save_screenshot(filename)
Copy link
Contributor

Choose a reason for hiding this comment

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

Add logic on returning the screenshot path. The user should be able to get the file name upon calling this method

raise RuntimeError(f"Failed to take screenshot: {e}")


def wait_for_element(driver, element_id: str, timeout: int = 10):
Copy link
Contributor

Choose a reason for hiding this comment

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

Extend the logic for all element types like class, name, xpath, css selector etc and not just to id.

try:
username_field = self.driver.find_element_by_id("username")
password_field = self.driver.find_element_by_id("password")
login_button = self.driver.find_element_by_id("login")
Copy link
Contributor

Choose a reason for hiding this comment

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

Add logic to make it generic. Not always its the id, it can accept all other identifiers.

Copy link
Contributor

@pranavprakash20 pranavprakash20 left a comment

Choose a reason for hiding this comment

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

Please revisit the changes requested

@pranavprakash20
Copy link
Contributor

@NamrathaRao24 Please add a more meaningful commit message

Signed-off-by: nrao <nrao@redhat.com>
@psathyan psathyan changed the base branch from master to main December 19, 2024 05:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ceph-dashboard For Ceph dashboard GUI Automation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants