test_sign_yourself.py 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. import time
  2. import unittest
  3. import page_official
  4. import page_login
  5. import page_main
  6. import page_sign_and_send_prepare
  7. import page_sign_and_send_assign
  8. import page_task
  9. import os
  10. from selenium import webdriver
  11. from selenium.webdriver.support.ui import WebDriverWait
  12. class test_sign_yourself(unittest.TestCase):
  13. pdf_path = os.getcwd() + "/test.pdf"
  14. baseURL = "https://www.dottedsign.com/"
  15. email = "user_email"
  16. password = "user_password"
  17. driver = webdriver.Chrome()
  18. wait = WebDriverWait(driver, 60)
  19. @classmethod
  20. def setUpClass(cls):
  21. cls.driver.get(cls.baseURL)
  22. cls.driver.maximize_window()
  23. def test(self):
  24. try:
  25. official = page_official.page_official(self.driver, self.wait)
  26. official.wait_sign_in_button()
  27. official.click_sign_in_button()
  28. except Exception as e:
  29. print("An exception occured when working on Official Page.")
  30. print(e)
  31. try:
  32. login = page_login.page_login(self.driver, self.wait)
  33. login.wait_email_textbox()
  34. login.input_email_textbox(self.email)
  35. login.wait_1st_next_step_button()
  36. login.click_1st_next_step_button()
  37. login.wait_password_textbox()
  38. login.input_password_textbox(self.password)
  39. login.wait_2nd_next_step_button()
  40. login.click_2nd_next_step_button()
  41. except Exception as e:
  42. print("An exception occured when working on Login Page")
  43. print(e)
  44. try:
  45. main = page_main.page_main(self.driver,self.wait)
  46. main.wait_purple_circle()
  47. main.click_purple_circle()
  48. main.wait_sign_yourself_button()
  49. main.click_sign_yourself_button()
  50. except Exception as e:
  51. print("An exception occured when working on Main Page")
  52. print(e)
  53. try:
  54. sign_and_send_prepare = page_sign_and_send_prepare.page_sign_and_send_prepare(self.driver,self.wait)
  55. sign_and_send_prepare.wait_pdf_button(3)
  56. sign_and_send_prepare.upload_pdf_button(self.pdf_path)
  57. sign_and_send_prepare.wait_next_step_button()
  58. sign_and_send_prepare.click_next_step_button()
  59. except Exception as e:
  60. print("An exception occured when working on Sign and Send Prepare Page")
  61. print(e)
  62. try:
  63. sign_and_send_assign = page_sign_and_send_assign.page_sign_and_send_assign(self.driver,self.wait)
  64. sign_and_send_assign.wait_radio_button_item()
  65. sign_and_send_assign.click_radio_button_item()
  66. sign_and_send_assign.wait_document()
  67. sign_and_send_assign.click_document()
  68. sign_and_send_assign.wait_next_step_button()
  69. sign_and_send_assign.click_next_step_button()
  70. sign_and_send_assign.wait_finish_button()
  71. sign_and_send_assign.click_finish_button()
  72. except Exception as e:
  73. print("An exception occured when working on Sign and Send Assign Page")
  74. print(e)
  75. try:
  76. task = page_task.page_task(self.driver, self.wait)
  77. task.wait_back_to_main_button()
  78. task.click_back_to_main_button()
  79. except Exception as e:
  80. print("An exception occured when working on Task Page")
  81. print(e)
  82. try:
  83. main.wait_completed_tab()
  84. main.click_completed_tab()
  85. main.wait_latest_task_option()
  86. main.click_latest_task_option()
  87. except Exception as e:
  88. print("An exception occured when working on Main Page")
  89. print(e)
  90. @classmethod
  91. def tearDownClass(cls):
  92. time.sleep(10)
  93. cls.driver.close()
  94. if __name__ == '__main__':
  95. unittest.main()