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 user evaluation form tests #201

Closed
wants to merge 4 commits into from

Conversation

aliwaleed1
Copy link

No description provided.



def generate_random_link():
scheme = random.choice(["http", "https", " "])
Copy link

Choose a reason for hiding this comment

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

Why does it have an empty string? same with the extension?

Copy link
Author

Choose a reason for hiding this comment

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

because , i need generate valid link and invalid ,and then check in test ,if valid must button will clickable .

pages/evaluation.py Outdated Show resolved Hide resolved
from utils.utils import create_links, create_numbers


class Login:
Copy link

Choose a reason for hiding this comment

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

Why did you implement the Login class in the evaluation page??

Comment on lines 36 to 37
# '/html/body/div[20]/div[1]/nav/div/div/a[5]'
# "//a[contains(@href, '/dashboard')]"
Copy link

Choose a reason for hiding this comment

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

Don't forget to review and clean the code from all the unused comments

tests/contest.py Outdated
@pytest.fixture(name="browse", scope="function")
def browsee():
"""Function to save driver fixture."""
driver = webdriver.Edge()
Copy link

Choose a reason for hiding this comment

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

Why are u using Edge and not the chrome?

Copy link
Author

Choose a reason for hiding this comment

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

i just try another browser to check the VPN , i changed it .

Comment on lines +76 to +79
wait = WebDriverWait(self.browser, 30)
wait.until(EC.visibility_of_element_located(self.selected_user))
select_usered = self.browser.find_element(*Evaluation.selected_user)
select_usered.click()
Copy link

Choose a reason for hiding this comment

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

These 4 lines could be shorter into 2 like

WebDriverWait(self.browser, 30).until(EC.visibility_of_element_located(self.selected_user))
self.browser.find_element(*Evaluation.selected_user).click()

Copy link
Author

Choose a reason for hiding this comment

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

I split it into more lines because flake extension , need the line be less than 79 character.

from pages.evaluation import Login, Evaluation


def to_login(browse):
Copy link

Choose a reason for hiding this comment

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

To_login isn't the best description maybe it would be better like before_test_setup, setup_for_test

Comment on lines 12 to 13
login_button = login_page.click_login_button()
login_button.click()
Copy link

Choose a reason for hiding this comment

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

Why didn't u just click the button on the function itself and just call it here?

login_page.click_login_button()

def click_login_button(self):
        self.browser.find_element(*self.login_button).click()

Comment on lines 18 to 20
to_login(browse)
evaluation_page = Evaluation(browse)
evaluation_page.click_dashboard_button()
Copy link

Choose a reason for hiding this comment

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

I can see that these lines (maybe more) are repeated in every test, so why not just call them once in the to_login function and return the object

So only this instead of the repeated 3 lines
evaluation_page = to_login(browse)
And add this to the to_login

evaluation_page = Evaluation(browse)
evaluation_page.click_dashboard_button()
return evaluation_page

@Mahmoud-Emad Mahmoud-Emad deleted the user_evaluation_form branch November 26, 2023 11:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants