def test_validation_message_caused_by_sending_empty_field(web_driver): """Check if the validation message 'Поле обов'зкове для заповнення' has correct function with empty input field""" homepage = MainPage(web_driver) loginpage = homepage.click_to_login_button(web_driver) loginpage.login_with_empty_fieldweb_driver validation_message_text = loginpage.validation_message(web_driver) assert validation_message_text == 'Поле обов\'зкове для заповнення'
def test_voting_if_user_is_unlogined(web_driver): """ Checks if the voting by unlogined user is impossible """ homepage = MainPage(web_driver) vote_page = homepage.click_voting_button(web_driver) login_page = vote_page.choose_category('').with_subcategory( '').first_product(web_driver).click() assert "Вхід до голосування" in login_page(web_driver)
def Main(): """Set up the environment and run the main loop """ config = configparser.ConfigParser() config.read('MikroKam.ini') ws = root.winfo_screenwidth() hs = root.winfo_screenheight() root.title("MikroKam") root.geometry('%dx%d+%d+%d' % (int(config['app']['screen_width']), int(config['app']['screen_height']), 0, 0)) root.resizable(width=FALSE, height=FALSE) mainPage = Frame(root) mainPage.grid(row=0, column=0) mainPage.minsize = ws gui = MainPage(mainPage, config, root) root.protocol("WM_DELETE_WINDOW", gui.close) root.mainloop() print("we are done") config['app']['last_run'] = datetime.datetime.now().strftime( "%Y-%m-%d %H:%M:%S") with open('MikroKam.ini', 'w') as configfile: config.write(configfile)
def test_click_on_mychoise_button_from_mainpage_logined(web_driver): """Check if the action of 'МІЙ ВИБІР' button is correct - logined user""" homepage = MainPage(web_driver) login_page = homepage.click_to_login_button(web_driver) my_choise_page = login_page.login_with_valid_card( web_driver, card_number='0291077164447') assert "Мій вибір" in my_choise_page.page_content(web_driver)
def test_title_font_family(web_driver): """ Check if the font family of the block content is 'sans-serif' """ homepage = MainPage(web_driver) rules_pages = homepage.click_to_rules_topmenu_item(web_driver) assert rules_pages.title_font_family( web_driver ) == 'Segoe, Frutiger, "Frutiger Linotype", "Dejavu Sans", "Helvetica Neue", Arial, sans-serif'
def test_validation_message_caused_by_invalid_card_number_1_symbol(web_driver): """Check if the validation message 'Номер має містити 13 цифр' has correct function with invalid card numder - 0""" homepage = MainPage(web_driver) loginpage = homepage.click_to_login_button(web_driver) loginpage.login_with_not_full_card_number(driver=web_driver, card_number='0') validation_text_message = loginpage.get_validation_message(web_driver) assert validation_text_message.lower() == 'номер має містити 13 цифр'
def test_checkDisplay(self): # Create instance of MainPage class main_page = MainPage(self.driver) # Call the required functions from MainPage main_page.headline_news_is_displayed() main_page.advert_is_displayed() main_page.planetf1_logo_is_displayed() main_page.social_media_is_displayed()
def test_error_message_does_not_exists_with_valid_card_number(web_driver): """Check if the validation message does not exists after entering the valid card number - 0291077164447""" homepage = MainPage(web_driver) loginpage = homepage.click_to_login_button(web_driver) loginpage.fill_the_card_number_field(driver=web_driver, card_number='0291077164447') error_message = loginpage.get_validation_message(web_driver) assert len(error_message) == 0
def test_validation_message_caused_by_invalid_card_number(web_driver): """Check if the validation message 'Невірний номер карти' has correct function with invalid card numder - 1111111111111""" homepage = MainPage(web_driver) loginpage = homepage.click_to_login_button(web_driver) loginpage.login_with_not_full_card_number(driver=web_driver, card_number='1111111111111') validation_text_message = loginpage.validation_message(web_driver) assert validation_text_message == 'Невірний номер карти'
def test_login_with_correct_card_number(web_driver): """Check if the loginisation has correct functioning with valid card numder (029 0226351066). Cardnumber contains one space""" homepage = MainPage(web_driver) loginpage = homepage.click_to_login_button(web_driver) my_choise_page = loginpage.login_with_valid_card( driver=web_driver, card_number='029 0226351066') search_word = 'Мій вибір' assert search_word in my_choise_page.page_content(web_driver)
def test_validation_message_caused_by_sending_short_card_number_5_symbols( web_driver): """Check if the validation message 'Номер має містити 13 цифр' has correct function with notfull card numder - 02910""" homepage = MainPage(web_driver) loginpage = homepage.click_to_login_button(web_driver) loginpage.login_with_not_full_card_number(driver=web_driver, card_number='02910') validation_text_message = loginpage.validation_message(web_driver) assert validation_text_message == 'Номер має містити 13 цифр'
def initModule(self): self.mainpage = MainPage(self) self.sidebar = SideBar(self) self.sidebar.hide() self.tray = TraySet(self) self.tray.show() self.about = AboutMemo() self.about.hide() self.setting = SettingBar(self) self.setting.hide() self.windowIcon = QtGui.QIcon(css.AppIconPath) self.setWindowIcon(self.windowIcon) self.grabKeyboard()
def loginCheck(self): ipaddr = self.ipaddr.get() name = self.username.get() secret = self.password.get() ipflag = self.chk_ip(ipaddr) if ipflag: if not name or not secret: self.cfg.logger.warning("用户名或密码为空") showinfo(title="Warning", message="用户名或密码为空") elif not subprocess.call(self.tool + " -H %s -U %s -P %s raw 6 1" % (ipaddr, name, secret)): self.ipmi = self.tool + " -H %s -U %s -P %s " % (ipaddr, name, secret) self.cfg.logger.info(self.ipmi) # try: cmd = self.ipmi + "fru list 0" self.cfg.logger.info(cmd) try: subpro = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stdout, stderr = subpro.communicate() if not subpro.returncode: self.cfg.logger.info(stdout) self.page.destroy() if re.search("Product Extra", stdout.decode('utf-8')): self.extraflag = True else: self.extraflag = False else: self.cfg.logger.error(stderr) self.cfg.logger.error("Get fru fail") showwarning(message="Get fru fail!!") except Exception as e: showinfo(message=str(e)) else: print(self.extraflag) MainPage(self.root, self.cfg, self.ipmi, self.extraflag) else: showinfo(title="Warning", message="BMC over lan fail, Please check it!")
def login(self, user, password): from mainpage import MainPage from homepage import HomePage box = TextBox(self._browser, self._config.get_locator('username')) box.set_text(user) box.set_locator(self._config.get_locator('password')) box.set_text(password) elem = Element(self._browser, self._config.get_locator('submit')) elem.click() page = HomePage(self._browser, False) if not page.is_logged_in(): msg = "Login failed" box.set_locator(self._config.get_locator('err_msg')) if (box.exists()): msg = box.get_text() assert msg == '' return MainPage(self._browser, False)
def __init__(self): tk.Tk.__init__(self) # colours self.bg_colour = "#202020" self.playlist_bg_colour = "#151515" self.taskbar_bg_colour = "#333333" self.sb_bar_colour = "#505050" self.sb_selected_colour = "#656565" self.dark_white_colour = "#8a8a8a" # fonts self.header_font = "Arial 32 bold" self.normal_font = "Arial 15" # font for playlist names and songs self.song_font = "Arial 12 bold" # images # basic setup self.default_width = 1000 # calculate this? self.default_height = 750 # calculate this? self.title("alphatunes") self.geometry(f"{self.default_width}x{self.default_height}") self.resizable(0, 0) self.minsize(self.default_width, self.default_height) # view mode (current frame) # frames, make resizable container = tk.Frame(self) container.place(x=0, y=0, width=self.default_width, height=self.default_height) self.frames = {"MAIN": MainPage(container, self)} # call main frame self.frames["MAIN"].tkraise()
def test_content_contains_10_questions(web_driver): """ Check if the content block is enabled on the FAQ page """ homepage = MainPage(web_driver) faq_page = homepage.click_to_faq_topmenu_item(web_driver) assert faq_page.number_of_question(web_driver) == 10
def test_click_to_logo_topmenu_item(web_driver): """Check if the action of the 'Elefant' logo is correct""" homepage = MainPage(web_driver) homepage.click_to_my_choice_topmenu_item(web_driver) homepage.click_to_logo_topmenu_item(web_driver) assert homepage.vote_button_is_enabled(web_driver)
def test_awards_title_two(web_driver): """Check if the title of 'Вхід до голосування' page is correct""" homepage = MainPage(web_driver) homepage.click_to_login_button(web_driver) assert "Голосуйте" in homepage.title_text(web_driver)
def test_block_content_is_enabled(web_driver): """ Check if the text content is enabled on the page""" homepage = MainPage(web_driver) rules_pages = homepage.click_to_rules_topmenu_item(web_driver) assert rules_pages.block_content_is_enabled(web_driver)
def test_click_to_rules_from_mainpage(web_driver): """Check if the action of 'ЯКОГО СЛОНА ОБРАТИ?' on Top-Menu button is correct""" homepage = MainPage(web_driver) homepage.click_to_rules_topmenu_item(web_driver) assert 'ПРАВИЛА ПРОВЕДЕННЯ' in homepage.page_content(web_driver)
def test_click_to_faq_from_mainpage(web_driver): """Check if the action of 'ПИТАННЯ ТА ВІДПОВІДІ' button on Top-Menu is correct""" homepage = MainPage(web_driver) homepage.click_to_faq_topmenu_item(web_driver) assert 'Питання та відповіді' in homepage.page_content(web_driver)
def test_title_of_the_current_page(web_driver): """ Check if the title is appropriate """ homepage = MainPage(web_driver) rules_pages = homepage.click_to_rules_topmenu_item(web_driver) assert rules_pages.title_text( web_driver) == "Голосуйте за улюбленні товари"
def test_existing_elephant_image(web_driver): """ Check if the elephant image is enable on the page """ homepage = MainPage(web_driver) rules_pages = homepage.click_to_rules_topmenu_item(web_driver) assert rules_pages.elephant_img_is_enabled(web_driver)
def test_click_on_login_button_from_mainpage(web_driver): """Check action of the button 'Увійти'""" homepage = MainPage(web_driver) login_page = homepage.click_to_login_button(web_driver) assert "Вхід до голосування" in login_page.page_content(web_driver)
def goto_main(self): """ 进入首页 :return: """ return MainPage(self.driver)
def test_click_to_about_button_from_topmenu(web_driver): """Check if the action of 'ПРОЕКТ «СЛОН' on Top-Menu button is correct""" homepage = MainPage(web_driver) about_page = homepage.click_to_about_project_topmenu_item(web_driver) assert 'ЛЕГЕНДА' in about_page.page_content(web_driver)
from mainpage import MainPage from mysql_commands import execute_cmd #Creating database and table try: execute_cmd('CREATE DATABASE school') #Creates database execute_cmd(""" CREATE TABLE student_data (id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, Name VARCHAR(256), Class VARCHAR(10), Phone VARCHAR(15), DOB DATE, DOA DATE) """, database='school') #Creates table except Exception as e: pass #__main__ win = MainPage() win.add_notebooks() win.mainpage.mainloop()
def test_title_font_size(web_driver): """ Check if font size of the title of the content is 32px """ homepage = MainPage(web_driver) rules_pages = homepage.click_to_rules_topmenu_item(web_driver) assert rules_pages.title_font_size(web_driver) == '32px'
def Create(self): self.gpInfo = GPInfo() self.wizard = NewWizard(self) self.mainPage = MainPage(self.wizard) # patent rerord self.prGeneralPage = GeneralPage(self.wizard) self.prMedicalPage = MedicalPage(self.wizard) self.prOtherPage = OtherPage(self.wizard) self.prHistoryPage = HistoryPage(self.wizard) self.mainPage.SetPrev(None) self.prGeneralPage.SetPrev(self.mainPage) self.prGeneralPage.SetNext(self.prMedicalPage) self.prMedicalPage.SetPrev(self.prMedicalPage) self.prMedicalPage.SetNext(self.prOtherPage) self.prOtherPage.SetNext(self.prHistoryPage) self.prOtherPage.SetPrev(self.prMedicalPage) self.prHistoryPage.SetNext(None) self.prHistoryPage.SetPrev(self.prOtherPage) # appointment self.apPatentPage = App_PatentPage(self.wizard) self.apTimePage = App_TimePage(self.wizard) self.apPatentPage.SetNext(self.apTimePage) self.apPatentPage.SetPrev(self.mainPage) self.apTimePage.SetNext(None) self.apTimePage.SetPrev(self.apPatentPage) # gps self.gpGeneralPage = GP_GeneralPage(self.wizard, self.gpInfo) self.gpOtherPage = GP_OtherPage(self.wizard, self.gpInfo) self.gpGeneralPage.SetNext(self.gpOtherPage) self.gpGeneralPage.SetPrev(self.mainPage) self.gpOtherPage.SetNext(None) self.gpOtherPage.SetPrev(self.gpGeneralPage) #cpd self.cpdGeneralPage = CPD_GeneralPage(self.wizard, self.gpInfo) self.cpdOtherPage = CPD_OtherPage(self.wizard, self.gpInfo) self.cpdGeneralPage.SetNext(self.cpdOtherPage) self.cpdGeneralPage.SetPrev(self.mainPage) self.cpdOtherPage.SetNext(None) self.cpdOtherPage.SetPrev(self.cpdGeneralPage) #equ self.eqpGeneralPage = Eqp_GeneralPage(self.wizard, self.gpInfo) self.eqpOtherPage = Eqp_OtherPage(self.wizard, self.gpInfo) self.eqpGeneralPage.SetNext(self.eqpOtherPage) self.eqpGeneralPage.SetPrev(self.mainPage) self.eqpOtherPage.SetNext(None) self.eqpOtherPage.SetPrev(self.eqpGeneralPage) self.mainPage.SetOptions([ self.apPatentPage, self.prGeneralPage, self.gpGeneralPage, self.cpdGeneralPage, self.eqpGeneralPage ]) self.wizard.SetPageSize((600, 400))
def test_click_on_my_choise_from_mainpage_unlogined(web_driver): """Check if the action of 'МІЙ ВИБІР' button is correct - unlogined user""" homepage = MainPage(web_driver) my_choise_page = homepage.click_to_my_choice_topmenu_item() assert 'Вхід до голосування' in my_choise_page.content(web_driver)