def __init__(self, web_driver: WebDriver):
     # Initialize web driver
     self.web_driver = web_driver
     self.username_field = TextField(self.web_driver, GitHubLoginPageLocators.USERNAME_FIELD_LOCATOR.arguments)
     self.password_field = TextField(self.web_driver, GitHubLoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
     self.login_button = Button(self.web_driver, GitHubLoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
     self.signup_button = Button(self.web_driver, GitHubLoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
예제 #2
0
class LoginPage(object):
    """
        Test Adaptation Layer
    """
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver

        self.stackoverflow_logo = Image(self.web_driver, CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.google_login_button = Button(self.web_driver, CommonLocators.GOOGLE_LOGIN_BUTTON_LOCATOR.arguments)
        self.facebook_login_button = Button(self.web_driver, CommonLocators.FACEBOOK_BUTTON_LOCATOR.arguments)
        self.username_field = TextField(self.web_driver, LoginPageLocators.USERNAME_FIELD_LOCATOR.arguments)
        self.password_field = TextField(self.web_driver, LoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
        self.login_button = Button(self.web_driver, LoginPageLocators.LOGIN_BUTTON_LOCATOR.arguments)

    @allure.step("Enter username {1}")
    def enter_login(self, username):
        self.username_field.send_keys(username)
        allure.attach(self.web_driver.get_screenshot_as_png(), attachment_type=allure.attachment_type.PNG)
        return self

    @allure.step("Filling in the password")
    def enter_password(self, password):
        self.password_field.send_keys(password)
        allure.attach(self.web_driver.get_screenshot_as_png(), attachment_type=allure.attachment_type.PNG)
        return self

    @allure.step("Clicking on the Login Button")
    def click_on_login_button(self):
        self.login_button.click()
        allure.attach(self.web_driver.get_screenshot_as_png(), attachment_type=allure.attachment_type.PNG)
        return UserWorkSpacePage(self.web_driver)
예제 #3
0
class MainPage(object):
    """
    Test Adaptation Layer
    """
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver
        try:
            self.web_driver.maximize_window()
        except WebDriverException:
            pass
        self.web_driver.get("https://stackoverflow.com")

        # Instantiating web elements
        self.stackoverflow_logo = Image(
            self.web_driver,
            CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.login_link = Link(self.web_driver,
                               MainPageLocators.LOGIN_LINK_LOCATOR.arguments)
        self.sign_up_button = Button(
            self.web_driver, MainPageLocators.SGNUP_BUTTON_LOCATOR.arguments)

    @allure.step("Click on the Sign Up button")
    def click_on_sign_up_button(self):
        self.sign_up_button.click()
        allure.attach(self.web_driver.get_screenshot_as_png(),
                      attachment_type=allure.attachment_type.PNG)
        return SignUpPage(self.web_driver)

    @allure.step("Click on the Sign In button")
    def click_on_login_link(self):
        self.login_link.click()
        allure.attach(self.web_driver.get_screenshot_as_png(),
                      attachment_type=allure.attachment_type.PNG)
        return LoginPage(self.web_driver)
예제 #4
0
 def __init__(self, web_driver: WebDriver):
     # Initialize web driver
     self.web_driver = web_driver
     self.stackoverflow_logo = Image(
         self.web_driver,
         CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
     self.google_login_button = Button(
         self.web_driver,
         CommonLocators.GOOGLE_LOGIN_BUTTON_LOCATOR.arguments)
     self.facebook_login_button = Button(
         self.web_driver, CommonLocators.FACEBOOK_BUTTON_LOCATOR.arguments)
     self.github_login_button = Button(
         self.web_driver, SignupPageLocators.GITHUB_SIGNUP_BUTTON.arguments)
     self.display_name = Header(
         self.web_driver, SignupPageLocators.DISPLAY_NAME_LOCATOR.arguments)
     self.product_updates = Header(
         self.web_driver,
         SignupPageLocators.PRODUCT_UPDATES_LOCATOR.arguments)
     self.username_field = TextField(
         self.web_driver,
         SignupPageLocators.USERNAME_FIELD_LOCATOR.arguments)
     self.password_field = TextField(
         self.web_driver,
         SignupPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
     self.signup_button = Button(
         self.web_driver, SignupPageLocators.GITHUB_SIGNUP_BUTTON.arguments)
예제 #5
0
class SignUpPage(object):
    """
        Test Adaptation Layer
    """
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver
        self.stackoverflow_logo = Image(
            self.web_driver,
            CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.google_login_button = Button(
            self.web_driver,
            CommonLocators.GOOGLE_LOGIN_BUTTON_LOCATOR.arguments)
        self.facebook_login_button = Button(
            self.web_driver, CommonLocators.FACEBOOK_BUTTON_LOCATOR.arguments)
        self.github_login_button = Button(
            self.web_driver, SignupPageLocators.GITHUB_SIGNUP_BUTTON.arguments)
        self.display_name = Header(
            self.web_driver, SignupPageLocators.DISPLAY_NAME_LOCATOR.arguments)
        self.product_updates = Header(
            self.web_driver,
            SignupPageLocators.PRODUCT_UPDATES_LOCATOR.arguments)
        self.username_field = TextField(
            self.web_driver,
            SignupPageLocators.USERNAME_FIELD_LOCATOR.arguments)
        self.password_field = TextField(
            self.web_driver,
            SignupPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
        self.signup_button = Button(
            self.web_driver, SignupPageLocators.GITHUB_SIGNUP_BUTTON.arguments)

    @allure.step("Signing up from GitHub")
    def click_github_signup(self):
        self.github_login_button.click()
        return GitHubLoginPage(self.web_driver)
예제 #6
0
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver

        self.stackoverflow_logo = Image(self.web_driver, CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.google_login_button = Button(self.web_driver, CommonLocators.GOOGLE_LOGIN_BUTTON_LOCATOR.arguments)
        self.facebook_login_button = Button(self.web_driver, CommonLocators.FACEBOOK_BUTTON_LOCATOR.arguments)
        self.username_field = TextField(self.web_driver, LoginPageLocators.USERNAME_FIELD_LOCATOR.arguments)
        self.password_field = TextField(self.web_driver, LoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
        self.login_button = Button(self.web_driver, LoginPageLocators.LOGIN_BUTTON_LOCATOR.arguments)
class UserWorkSpacePage(object):
    """
        Test Adaptation Layer
    """
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver

        self.profile_button = Button(
            self.web_driver,
            UserWorkspaceLocators.PROFILE_BUTTON_LOCATOR.arguments,
            expected_condition=expected_conditions.
            visibility_of_element_located)
        self.stackoverflow_logo = Image(
            self.web_driver,
            CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.inbox_button = Button(
            self.web_driver,
            UserWorkspaceLocators.INBOX_BUTTON_LOCATOR.arguments)
        self.achivements_button = Button(
            self.web_driver,
            UserWorkspaceLocators.ACHIVEMENTS_BUTTON_LOCATOR.arguments)
        self.help_button = Button(
            self.web_driver,
            UserWorkspaceLocators.HELP_BUTTON_LOCATOR.arguments)
        self.user_menu = Button(
            self.web_driver,
            UserWorkspaceLocators.USER_MENU_BUTTON_LOCATOR.arguments)
        self.search_field = TextField(
            self.web_driver,
            UserWorkspaceLocators.SEARCH_FIELD_LOCATOR.arguments)
        self.search_button_mobile = Button(
            self.web_driver,
            UserWorkspaceLocators.SEARCH_BUTTON_MOBILE_LOCATOR.arguments)
        self.found_items_mobile = QueryItems(
            self.web_driver,
            UserWorkspaceLocators.FOUND_ITEMS_MOBILE_LOCATOR.arguments)
        self.found_items = QueryItems(
            self.web_driver,
            UserWorkspaceLocators.FOUND_ITEMS_LOCATOR.arguments)

    @property
    def search_results(self):
        if "deviceName" in self.web_driver.desired_capabilities.keys():
            self.search_button_mobile.click()
        return self.found_items_mobile\
            if "deviceName" in self.web_driver.desired_capabilities.keys()\
            else self.found_items

    @allure.step("Searching for the next pattern: {1}")
    def search(self, request):
        self.search_field.send_keys(request)
        ActionChains(self.web_driver).send_keys(Keys.ENTER).perform()
        return self
예제 #8
0
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver
        try:
            self.web_driver.maximize_window()
        except WebDriverException:
            pass
        self.web_driver.get("https://stackoverflow.com")

        # Instantiating web elements
        self.stackoverflow_logo = Image(
            self.web_driver,
            CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.login_link = Link(self.web_driver,
                               MainPageLocators.LOGIN_LINK_LOCATOR.arguments)
        self.sign_up_button = Button(
            self.web_driver, MainPageLocators.SGNUP_BUTTON_LOCATOR.arguments)
class GitHubLoginPage(object):
    """
        Test Adaptation Layer
    """
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver
        self.username_field = TextField(self.web_driver, GitHubLoginPageLocators.USERNAME_FIELD_LOCATOR.arguments)
        self.password_field = TextField(self.web_driver, GitHubLoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
        self.login_button = Button(self.web_driver, GitHubLoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)
        self.signup_button = Button(self.web_driver, GitHubLoginPageLocators.PASSWORD_FIELD_LOCATOR.arguments)

    @allure.step("Enter username {1}")
    def enter_login(self, username):
        self.username_field.send_keys(username)
        allure.attach(self.web_driver.get_screenshot_as_png(), attachment_type=allure.attachment_type.PNG)
        return self

    @allure.step("Filling in the password")
    def enter_password(self, password):
        self.password_field.send_keys(password)
        allure.attach(self.web_driver.get_screenshot_as_png(), attachment_type=allure.attachment_type.PNG)
        return self

    @allure.step("Clicking on the Login Button")
    def click_on_login_button(self):
        self.login_button.click()
        allure.attach(self.web_driver.get_screenshot_as_png(), name="Login result screenshot", attachment_type=allure.attachment_type.PNG)
        return self

    @allure.step("Accepting signup")
    def accept_signup(self):
        try:
            click_button = self.signup_button\
                if "deviceName" in self.web_driver.desired_capabilities.keys()\
            else self.login_button
            click_button.click()
        finally:
            return UserWorkSpacePage(self.web_driver)
    def __init__(self, web_driver: WebDriver):
        # Initialize web driver
        self.web_driver = web_driver

        self.profile_button = Button(
            self.web_driver,
            UserWorkspaceLocators.PROFILE_BUTTON_LOCATOR.arguments,
            expected_condition=expected_conditions.
            visibility_of_element_located)
        self.stackoverflow_logo = Image(
            self.web_driver,
            CommonLocators.STACKOVERFLOW_LOGO_LOCATOR.arguments)
        self.inbox_button = Button(
            self.web_driver,
            UserWorkspaceLocators.INBOX_BUTTON_LOCATOR.arguments)
        self.achivements_button = Button(
            self.web_driver,
            UserWorkspaceLocators.ACHIVEMENTS_BUTTON_LOCATOR.arguments)
        self.help_button = Button(
            self.web_driver,
            UserWorkspaceLocators.HELP_BUTTON_LOCATOR.arguments)
        self.user_menu = Button(
            self.web_driver,
            UserWorkspaceLocators.USER_MENU_BUTTON_LOCATOR.arguments)
        self.search_field = TextField(
            self.web_driver,
            UserWorkspaceLocators.SEARCH_FIELD_LOCATOR.arguments)
        self.search_button_mobile = Button(
            self.web_driver,
            UserWorkspaceLocators.SEARCH_BUTTON_MOBILE_LOCATOR.arguments)
        self.found_items_mobile = QueryItems(
            self.web_driver,
            UserWorkspaceLocators.FOUND_ITEMS_MOBILE_LOCATOR.arguments)
        self.found_items = QueryItems(
            self.web_driver,
            UserWorkspaceLocators.FOUND_ITEMS_LOCATOR.arguments)