def __do_login(self, credentials=DEFAULT_CREDENTIALS, query_string=""): page = Pages.Login(self.__driver, self.__config["environment"]["base_url"], query_string) page.type_user_name(credentials["user"]) page.type_password(credentials["password"]) page.submit() self.__wait.until(lambda _: Pages.CustomerDashboard(self.__driver).is_loaded())
def __go_to_dashboard(self): self.__page = Pages.Login(self.__driver, self.__config["environment"]["base_url"], query_string="?showAd=true") self.__page.type_user_name(DEFAULT_CREDENTIALS["user"]) self.__page.type_password(DEFAULT_CREDENTIALS["password"]) self.__page.submit() self.__page = Pages.CustomerDashboard(self.__driver) self.__wait.until(lambda _: self.__page.is_loaded())
def __open_customer_dashboard(self, credentials): login_page = Pages.Login(self.__driver, self.__config["environment"]["base_url"]) login_page.type_user_name(credentials["user"]) login_page.type_password(credentials["password"]) login_page.submit() dashboard_page = Pages.CustomerDashboard(self.__driver) self.__wait.until(lambda _: dashboard_page.is_loaded()) return dashboard_page
def test_successful_login(self): page = Pages.Login(self.__driver, self.__config["environment"]["base_url"]) page.type_user_name(DEFAULT_CREDENTIALS["user"]) page.type_password(DEFAULT_CREDENTIALS["password"]) page.submit() self.__wait.until(lambda _: Pages.CustomerDashboard(self.__driver).is_loaded()) self.__eyes.open(self.__driver, "DemoApp", "Successful Login", DEFAULT_VIEWPORT) self.__eyes.check_window("Customer Dashboard") self.__eyes.close()
def test_successful_login(self): self.__page.type_user_name(DEFAULT_CREDENTIALS["user"]) self.__page.type_password(DEFAULT_CREDENTIALS["password"]) self.__page.submit() self.__wait.until(lambda _: Pages.CustomerDashboard(self.__driver).is_loaded()) assert "hackathonApp" in self.__driver.current_url
def setup_class(self): self.__config = configparser.ConfigParser() self.__config.read("config.ini") self.__driver = webdriver.Chrome() self.__page = Pages.Login(self.__driver, self.__config["environment"]["base_url"]) self.__form_fields = self.__page.form_fields self.__social_icons = self.__page.buttons.social_icons
def test_credentials_missing(self, user, password, test_name): page = Pages.Login(self.__driver, self.__config["environment"]["base_url"]) page.type_user_name(user) page.type_password(password) page.submit() self.__wait.until(lambda _: len(page.alerts) == 1) self.__eyes.open(self.__driver, "DemoApp", f"Credentials Missing - {test_name}", DEFAULT_VIEWPORT) self.__eyes.check_window("Login Page With Alert") self.__eyes.close()
def test_table_sorting(self): self.__do_login() page = Pages.CustomerDashboard(self.__driver) self.__eyes.force_full_page_screenshot = True self.__eyes.open(self.__driver, "DemoApp", "Table Sorting", DEFAULT_VIEWPORT) self.__eyes.check_window("Customer Dashboard - Default") page.order_by_amount() self.__eyes.check_window("Customer Dashboard - Sorted by Amount") self.__eyes.close()
def test_credentials_removed(self, missing): page = Pages.Login(self.__driver, self.__config["environment"]["base_url"]) page.type_user_name(DEFAULT_CREDENTIALS["user"]) page.type_password(DEFAULT_CREDENTIALS["password"]) self.__remove_credential(page, missing) page.submit() self.__wait.until(lambda _: len(page.alerts) == 1) self.__eyes.open(self.__driver, "DemoApp", f"Credentials Removed - {missing} Empty", DEFAULT_VIEWPORT) self.__eyes.check_window("Login Page With Alert") self.__eyes.close()
def test_canvas_chart(self, width, height): self.__do_login() page = Pages.CustomerDashboard(self.__driver) page.view_expense_chart() self.__wait_for_canvas_animation() self.__eyes.open(self.__driver, "DemoApp", f"Expenses Chart - {width}x{height}", {'width': width, 'height': height}) self.__eyes.check_window("Chart Two Years") page.include_another_year() self.__wait_for_canvas_animation() self.__eyes.check_window("Chart Three Years") self.__eyes.close()
def setup_method(self): self.__page = Pages.Login(self.__driver, self.__config["environment"]["base_url"])