def test_erase_symbol(driver_setup, num_len): if num_len == 'long': a = randint(10, 10000) elif num_len == 'short': a = randint(1, 9) m_page = MainPage(driver_setup) m_page.input_number(a) m_page.click_erase_symbol() if num_len == 'long': assert m_page.is_int_result_correct(int(str(a)[:-1])) elif num_len == 'short': assert m_page.is_int_result_correct(0)
class TestAddMember(): def setup_class(self): self.main = MainPage() def test_add_member(self): #main = MainPage() #1.首页跳转添加成员页面,2.添加成员,3.获取成员信息 self.result = self.main.go_to_add_member().add_member().get_member_list() print(self.result) assert '皮2' in self.result def test_add_depar(self): self.result = self.main.go_to_contact().go_to_dep().add_depar().get_depar_list() print(self.result) assert '质量保障' in self.result def teardown_class(self): self.main.driver.close() self.main.driver.quite()
def test_screen(): MainPage().work_tab.click() assert MainPage().compare_canvas(folder, 'Canvas', WORK_PLATE, 'Canvas_error')
def test_pl_header(): MainPage()._header.should(have.exact_text('Welcome to'))
def test_compare_language(): MainPage().en.click() assert MainPage().compare(folder, 'EN', EN_LANGUAGE, 'English not selected')
def test_pl_header(): MainPage()._header.should(have.exact_text('Witamy w'))
def test_compare_language_selection(): MainPage().pl.click() assert MainPage().compare(folder, 'PL', PL_LANGUAGE, 'Polish not selected')
def test_clear_entry(driver_setup): a = randint(0, 1000) m_page = MainPage(driver_setup) m_page.input_number(a) m_page.click_clear_entry() assert m_page.is_int_result_correct(0)
def Main(self): return MainPage(self.basedriver)
def test_remove_one_job(): MainPage().remove_job('test') MainPage().jobs_list.should(have.exact_texts('giant', 'chine', 'destro')) time.sleep(1)
def test_user_add_jos(): MainPage().add_job('destro').add_job('test').add_job('chine').add_job('giant').jobs_list.should(have.size(4)) MainPage().jobs_list.should(have.exact_texts('giant', 'chine', 'test', 'destro'))
def test_login(): browser.should(have.title('Trotec Production Center')) MainPage().remove_all_jobs()
def login_as(self, user): self.user_name.set(user.name) self.password.set(user.password) self.submit.click() return MainPage()
def setup_class(self): self.main = MainPage()
def test_point(driver_setup): a = gen_random_float() m_page = MainPage(driver_setup) m_page.input_number(a) assert m_page.is_displayed_number_correct(a)
def test_int_operations(driver_setup, operation): a = randint(0, 100) b = randint(0, 100) if operation == '/': a = a * b c = OPS[operation](a, b) m_page = MainPage(driver_setup) m_page.input_number(a) m_page.click_operation(operation) m_page.input_number(b) m_page.click_equals() assert m_page.is_int_result_correct(c)
def test_remove_all(): MainPage().remove_all_jobs().jobs_list.should(have.size(0))
def test_no_name_job(): MainPage()._add_button.click() MainPage().allert.should(have.text('Job name cannot be empty')) MainPage().jobs_list.should(have.size(0)) time.sleep(2)
def test_change_sign(driver_setup): a = gen_random_float() m_page = MainPage(driver_setup) m_page.input_number(a) m_page.click_change_sign() assert m_page.is_displayed_number_correct(-a)
def test_float_operations(driver_setup, operation): a = gen_random_float() b = gen_random_float() c = OPS[operation](a, b) m_page = MainPage(driver_setup) m_page.input_number(a) m_page.click_operation(operation) m_page.input_number(b) m_page.click_equals() assert m_page.is_float_result_correct(c)