Skip to content
Open
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
16 changes: 16 additions & 0 deletions tests/test_freestyle_project3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import time
from selenium.webdriver.common.by import By

def test_jenkins_create_job(browser):
browser.find_element(By.LINK_TEXT, "Create a job").click()
browser.find_element(By.XPATH, "//input[@id='name']").send_keys("Free")
browser.find_element(By.XPATH, "//span[@class='label' and text()='Freestyle project']").click()
browser.find_element(By.XPATH, "//button[@id='ok-button']").click()
time.sleep(3)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

А тут со слипом 1 сек не работает?

browser.find_element(By.XPATH, "//span[@class='jenkins-mobile-hide' and text()='Jenkins']").click()

assert "Free" in browser.page_source
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

assert "Free" in browser.page_source - я считаю это очень плохой практикой, такой ассерт. Тест может пройти если не создалась джоба. Лучше конкретный элемент проверять(текст какой то который появился(название джобы например) )

time.sleep(3)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Вконец слип не нужен точно.
И убери лишние пустые строки после функции.




Loading