def test_03d_visit_company_page(self): driver = Login_Admin(self) with allure.step('Click Công ty'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[5]/a').click() time.sleep(2) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/company/1') driver.save_screenshot(admin_images+"/test_03d_visit_company_page.png")
def test_04a_see_account_info(self): driver = Login_Admin(self) with allure.step('Click Tài Khoản'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[2]/a').click() time.sleep(1) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/account/1') with allure.step('Click Random Account'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[3]').click() time.sleep(1) bodyText = driver.find_element_by_tag_name('body').text self.assertTrue("Thông tin chi tiết tài khoản" in bodyText) driver.save_screenshot(admin_images+"/test_04a_see_account_info.png")
def test_08g_update_phone_project(self): driver = Login_Admin(self) with allure.step('Click Dự án'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[3]/a').click() time.sleep(2) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/project/1') with allure.step('Click to choose project'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[1]').click() time.sleep(1) with allure.step('Update phone project'): driver.find_element_by_xpath('//*[@id="phone"]').clear() driver.find_element_by_xpath('//*[@id="phone"]').send_keys('0903000111') driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div[1]/div/form/div[4]/div[1]/button').click() time.sleep(2) test=driver.find_elements_by_class_name("ant-message") text=test[0].text self.assertEqual(text,'Update Done') driver.save_screenshot(admin_images+"/test_08g_update_phone_project.png")
def test_04d_same_description_account_info(self): driver = Login_Admin(self) with allure.step('Click Tài Khoản'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[2]/a').click() time.sleep(1) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/account/1') with allure.step('Click Random Account'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[3]').click() time.sleep(1) bodyText = driver.find_element_by_tag_name('body').text self.assertTrue("Thông tin chi tiết tài khoản" in bodyText) with allure.step('Update description'): driver.find_element_by_xpath('//*[@id="description"]').send_keys(Keys.SPACE) driver.find_element_by_xpath('//*[@id="description"]').send_keys(Keys.BACK_SPACE) driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div[1]/div[2]/form/div[4]/div[1]/button').click() time.sleep(3) test=driver.find_elements_by_class_name("ant-message") text=test[0].text self.assertEqual(text,'Update Error, please try again') driver.save_screenshot(admin_images+"/test_04d_same_description_account_info.png")
def test_10_switch_comment_project(self): driver = Login_Admin(self) with allure.step('Click Dự án'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[3]/a').click() time.sleep(2) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/project/1') with allure.step('Click to choose project'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[1]').click() time.sleep(1) driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div[3]/div/div[1]/div[2]/button').location_once_scrolled_into_view driver.save_screenshot(admin_images+'/test_10_before_switch_comment_project.png') with allure.step('Click button switch comment project'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div[3]/div/div[1]/div[2]/button').click() time.sleep(1) driver.save_screenshot(admin_images+'/test_10_after_switch_comment_project.png')
def test_04c_update_address_account_info(self): driver = Login_Admin(self) with allure.step('Click Tài Khoản'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[2]/a').click() time.sleep(1) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/account/1') with allure.step('Click Random Account'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[3]').click() time.sleep(1) bodyText = driver.find_element_by_tag_name('body').text self.assertTrue("Thông tin chi tiết tài khoản" in bodyText) with allure.step('Update address'): i=random.randint(1,10) driver.find_element_by_xpath('//*[@id="address"]').clear() driver.find_element_by_xpath('//*[@id="address"]').send_keys('Ho Chi Minh',i) driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div[1]/div[2]/form/div[4]/div[1]/button').click() time.sleep(3) test=driver.find_elements_by_class_name("ant-message") text=test[0].text self.assertEqual(text,'Update Done') driver.save_screenshot(admin_images+"/test_04c_update_phone_account_info.png")
def test_04e_update_status_account_info(self): driver = Login_Admin(self) with allure.step('Click Tài Khoản'): driver.find_element_by_xpath( '//*[@id="wrapper"]/div[1]/ul/li[2]/a').click() time.sleep(1) self.assertEqual(driver.current_url, 'https://admin.myreales.tk/account/1') with allure.step('Click Random Account'): driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div/div/div/div/div/table/tbody/tr[3]').click() time.sleep(1) bodyText = driver.find_element_by_tag_name('body').text self.assertTrue("Thông tin chi tiết tài khoản" in bodyText) with allure.step('Update status'): statusAccount=Select(driver.find_element_by_id('statusAccount')) statusAccount.select_by_index(1) driver.find_element_by_xpath('//*[@id="content-wrapper"]/div/div[2]/div[2]/div[1]/div[2]/form/div[4]/div[1]/button').click() time.sleep(3) test=driver.find_elements_by_class_name("ant-message") text=test[0].text self.assertEqual(text,'Update Done') driver.save_screenshot(admin_images+"/test_04e_update_status_account_info.png")