def test_contact_page(browser): page = ContactPage(browser, link) page.open() page.contact_link() page.go_tu_contact_page() page.social_link() time.sleep(5)
def classSetup(self, oneTimeSetup): """ Run the setup before the test starts :return: """ self.contact = ContactPage(self.driver) self.ts = TestStatus(self.driver) self.util = util.Util()
def test_guest_contact_page(self, browser): link = "https://htmlpreview.github.io/?https://raw.githubusercontent.com/Irina622/portfolio/master/contact.html" page = ContactPage(browser=browser, url=link) page.open() page.should_be_contact_page() page.should_be_base_links_on_page() page.should_be_order_form_on_contact_page() time.sleep(2)
def test_contact_form(self): MainPage(self.driver).click_contact_button() ContactPage(self.driver).wait_for_page_to_load() ContactPage(self.driver).click_send_button() self.assertTrue(ContactPage(self.driver).is_checkbox_error_present()) self.assertTrue(ContactPage(self.driver).is_email_error_present()) ContactPage(self.driver).enter_email(Faker("pl_PL").email()) ContactPage(self.driver).click_checkbox() ContactPage(self.driver).click_send_button() self.assertFalse(ContactPage(self.driver).is_checkbox_error_present()) self.assertFalse(ContactPage(self.driver).is_email_error_present())
class ContactTests(unittest.TestCase): @pytest.fixture(autouse=True) def classSetup(self, oneTimeSetup): """ Run the setup before the test starts :return: """ self.contact = ContactPage(self.driver) self.ts = TestStatus(self.driver) self.util = util.Util() @pytest.mark.run(order=1) def test_scrollToContactSection(self): """ Test the default state of contact section :return: """ self.contact.scrollToContactSection() result_resumeOpacity = self.contact.verifyContactIconOpacity( icon="Resume", hover=False) self.ts.mark(result_resumeOpacity, "Resume icon is fully visible by default") result_workExpOpacity = self.contact.verifyContactIconOpacity( icon="Work Experience", hover=False) self.ts.mark(result_workExpOpacity, "Work Experience icon is fully visible by default") result_linkedinOpacity = self.contact.verifyContactIconOpacity( icon="LinkedIn", hover=False) self.ts.markFinal("test_scrollToContactSection", result_linkedinOpacity, "LinkedIn icon is fully visible by default") @pytest.mark.run(order=2) def test_hoverResumeIcon(self): """ Test hovering over the resume icon changes its opacity :return: """ self.contact.scrollToContactSection() self.contact.hoverContactIcon(icon="Resume") self.util.sleep(sec=2) result_resumeOpacity = self.contact.verifyContactIconOpacity( icon="Resume", hover=True) self.ts.markFinal("test_hoverResumeIcon", result_resumeOpacity, "Resume icon should be fading") @pytest.mark.run(order=3) def test_hoverWorkExpIcon(self): """ Test hovering over the work experience icon changes its opacity :return: """ self.contact.scrollToContactSection() self.contact.hoverContactIcon(icon="Work Experience") self.util.sleep(sec=2) result_workExpOpacity = self.contact.verifyContactIconOpacity( icon="Work Experience", hover=True) self.ts.markFinal("test_hoverWorkExpIcon", result_workExpOpacity, "Work Experience icon should be fading") @pytest.mark.run(order=4) def test_hoverLinkedinIcon(self): """ Test hovering over the LinkedIn icon changes its opacity :return: """ self.contact.scrollToContactSection() self.contact.hoverContactIcon(icon="LinkedIn") self.util.sleep(sec=2) result_linkedInOpacity = self.contact.verifyContactIconOpacity( icon="LinkedIn", hover=True) self.ts.markFinal("test_hoverLinkedinIcon", result_linkedInOpacity, "Linkedin icon should be fading") # @pytest.mark.run(order=5) # def test_clickResumeIcon(self): # self.contact.scrollToContactSection() # self.contact.clickContactIcon(icon="Resume") # result_pdfOpen = self.contact.verifyPDFOpen(icon="Resume") # self.ts.markFinal("test_clickResumeIcon", result_pdfOpen, "Resume pdf should open") # @pytest.mark.run(order=6) # def test_clickWorkExpIcon(self): # self.contact.scrollToContactSection() # self.contact.clickContactIcon(icon="Work Experience") # result_pdfOpen = self.contact.verifyPDFOpen(icon="Work Experience") # self.ts.markFinal("test_clickWorkExpIcon", result_pdfOpen, "Work experience pdf should open") @pytest.mark.run(order=7) def test_clickLinkedinIcon(self): """ Test clicking the LinkedIn Icon opens the correct page :return: """ self.contact.scrollToContactSection() self.contact.clickContactIcon(icon="LinkedIn") result_pdfOpen = self.contact.verifyPageOpenAfterClick(icon="LinkedIn") self.ts.markFinal("test_clickLinkedinIcon", result_pdfOpen, "LinkedIn page should open")
def go_to_contact(self): #对contactpage类进行实例化,表示业务逻辑的转换关系 return ContactPage(self.driver)
def setup_class(cls): cls.driver = browser.start_driver() cls.contact_page = ContactPage(cls.driver) cls.login_page = LoginPage(cls.driver) cls.driver.get(URL_HOME) cls.login_page.log_in()
def save_member(self): self.driver.find_element(By.CSS_SELECTOR,".js_btn_save" ).click() return ContactPage(self.driver)