fix test selenium
This commit is contained in:
parent
b7aaa20879
commit
cfb8706598
|
@ -2,6 +2,7 @@
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from selenium import webdriver
|
from selenium import webdriver
|
||||||
|
from selenium.webdriver.common.action_chains import ActionChains
|
||||||
from selenium.webdriver.common.by import By
|
from selenium.webdriver.common.by import By
|
||||||
from selenium.webdriver.firefox.options import Options
|
from selenium.webdriver.firefox.options import Options
|
||||||
|
|
||||||
|
@ -19,6 +20,7 @@ class TestSelenium:
|
||||||
self.driver.quit()
|
self.driver.quit()
|
||||||
|
|
||||||
def test_selenium(self):
|
def test_selenium(self):
|
||||||
|
# import pdb; pdb.set_trace()
|
||||||
# setup
|
# setup
|
||||||
self.driver.get("http://localhost:5000/login/")
|
self.driver.get("http://localhost:5000/login/")
|
||||||
self.driver.set_window_size(1920, 1063)
|
self.driver.set_window_size(1920, 1063)
|
||||||
|
@ -41,7 +43,7 @@ class TestSelenium:
|
||||||
lot_id = self.driver.current_url.split("/")[5]
|
lot_id = self.driver.current_url.split("/")[5]
|
||||||
|
|
||||||
# go to unassigned
|
# go to unassigned
|
||||||
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(3) span").click()
|
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(5) span").click()
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.implicitly_wait(3)
|
||||||
|
|
||||||
# select the first device
|
# select the first device
|
||||||
|
@ -57,6 +59,19 @@ class TestSelenium:
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.implicitly_wait(3)
|
||||||
self.driver.find_element(By.ID, "ApplyDeviceLots").click()
|
self.driver.find_element(By.ID, "ApplyDeviceLots").click()
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
element = self.driver.find_element(By.ID, "ApplyDeviceLots")
|
||||||
|
time.sleep(3)
|
||||||
|
actions = ActionChains(self.driver)
|
||||||
|
time.sleep(3)
|
||||||
|
actions.move_to_element(element).perform()
|
||||||
|
time.sleep(3)
|
||||||
|
element = self.driver.find_element(By.CSS_SELECTOR, "body")
|
||||||
|
time.sleep(3)
|
||||||
|
actions = ActionChains(self.driver)
|
||||||
|
time.sleep(3)
|
||||||
|
# actions.move_to_element(element, 0, 0).perform()
|
||||||
|
actions.move_to_element(element).perform()
|
||||||
|
time.sleep(3)
|
||||||
self.driver.find_element(By.ID, "SaveAllActions").click()
|
self.driver.find_element(By.ID, "SaveAllActions").click()
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
|
@ -81,10 +96,10 @@ class TestSelenium:
|
||||||
self.driver.find_element(By.ID, "SaveAllActions").click()
|
self.driver.find_element(By.ID, "SaveAllActions").click()
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(3) span").click()
|
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(5) span").click()
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.implicitly_wait(3)
|
||||||
|
|
||||||
# logout
|
# logout
|
||||||
self.driver.find_element(By.CSS_SELECTOR, ".d-md-block").click()
|
self.driver.find_element(By.CSS_SELECTOR, ".d-md-block:nth-child(2)").click()
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.implicitly_wait(3)
|
||||||
self.driver.find_element(By.LINK_TEXT, "Sign Out").click()
|
self.driver.find_element(By.LINK_TEXT, "Sign Out").click()
|
||||||
|
|
Reference in New Issue