Exemplo n.º 1
0
    def test_setting_menu(self):
        login = LoginPage(self.driver)
        login.enter_username("testUser")
        login.enter_password("testUser.10")
        login.click_login()
        time.sleep(3)
        dashboard = DashboardPage(self.driver)
        dashboard.dashboardPageİsOpened()
        time.sleep(3)

        self.driver.find_element(By.CSS_SELECTOR,
                                 'a[href="/settings"]').click()
        time.sleep(2)

        #assert user is on Simple Search page
        element = self.driver.find_element(
            By.XPATH,
            "/html/body/div[1]/div/section/div[1]/div[2]/div[1]/div[2]")
        print(element.text)
        assert element.text == "Settings"

        profilePage = self.driver.find_element(By.CLASS_NAME,
                                               'ant-card-head-title')
        assert profilePage.text == 'Profile Page'

        #assert the texts ara exist on the page
        assert self.driver.page_source.find('Username : testUser')
        assert self.driver.page_source.find('Email : [email protected]')
        assert self.driver.page_source.find('Language : en')
Exemplo n.º 2
0
    def test_news_search(self):
        login = LoginPage(self.driver)
        login.enter_username("testUser")
        login.enter_password("testUser.10")
        login.click_login()

        self.driver.find_element(By.CSS_SELECTOR,
                                 'a[href="/simple-search"]').click()
        time.sleep(2)

        # assert user is on Simple Search page
        element = self.driver.find_element(
            By.XPATH,
            "/html/body/div[1]/div/section/div[1]/div[2]/div[1]/div[2]")
        print(element.text)
        assert element.text == "Simple Search"

        self.driver.find_element(
            By.XPATH,
            '//*[@id="search-tab"]/div/div/div[2]/div/div/div/div/div/div/img'
        ).click()
        time.sleep(3)
        # assert opened Options includes 'Eksisozluk' and 'News'
        openedOptions = self.driver.find_elements(
            By.CLASS_NAME, 'ant-select-dropdown-menu-item')
        print(openedOptions[0].text)
        print(openedOptions[1].text)
        assert openedOptions[0].text == "Eksisozluk"
        assert openedOptions[1].text == "News"

        openedOptions[1].click()  # select News from opened slectionbox
        time.sleep(3)

        # click on anywhere (DataBoss logo) to close dropdown menü and focus to serrch button
        self.driver.find_element(
            By.XPATH, '//*[@id="search-tab"]/div/div/div[1]/img').click()

        # click on seach button to navigate search results page
        self.driver.find_element(
            By.XPATH,
            '/html/body/div[1]/div/section/div[1]/div[2]/div[2]/div/div/div/div[2]/span/span'
        ).click()
        time.sleep(3)

        # search specific tag/index from search result page
        self.driver.find_element(
            By.XPATH,
            '/html/body/div[1]/div/section/div[1]/div[2]/div[2]/div/div[1]/div/div[2]/span/input'
        ).send_keys("Marsilya'dan Gustavo açıklaması: Zor durumdayız")

        self.driver.find_element(
            By.XPATH,
            '//*[@id="search-tab"]/div[1]/div/div[2]/span/span').click()
        time.sleep(3)

        contentisExist = self.driver.find_element_by_xpath(
            '//*[@id="content-tab"]/div/div/div[2]/div/div[1]/div/div/div/div/div[1]/div[2]/div[1]/div/div[1]'
        )
        print(contentisExist.text)
        assert contentisExist.text == "Marsilya'dan Gustavo açıklaması: Zor durumdayız"
 def test_login_invalid(self):
     login = LoginPage(self.driver)
     login.enter_username("DataBoss")
     login.enter_password("DataBoss.10")
     login.click_login()
     element = self.driver.find_element(By.XPATH, "/html/body/div[2]/div/span/div/div/div")
     print(element.text)
     assert element.text == "400:Kullanıcı adı veya şifre hatalı."
Exemplo n.º 4
0
 def test_login_valid(self):
     login = LoginPage(self.driver)
     login.enter_username("testUser")
     login.enter_password("testUser.10")
     login.click_login()
     time.sleep(3)
     dashboard = DashboardPage(self.driver)
     dashboard.dashboardPageİsOpened()
     time.sleep(3)
Exemplo n.º 5
0
    def test_02_login_invalid_username(self):
            driver = self.driver
            driver.get("https://opensource-demo.orangehrmlive.com/")

            login = LoginPage(driver)
            login.enter_username("Admin1")
            login.enter_password("admin123")
            login.click_login()
            message = self.driver.find_element_by_xpath("").text
            self.assertEquals(message,"Invalid credentials")
Exemplo n.º 6
0
 def test_logout(self):
     login = LoginPage(self.driver)
     login.enter_username("testUser")
     login.enter_password("testUser.10")
     login.click_login()
     time.sleep(3)
     dashboard = DashboardPage(self.driver)
     dashboard.dashboardPageİsOpened()
     time.sleep(3)
     logout = LogoutPage(self.driver)
     logout.logout_from_system()
Exemplo n.º 7
0
class Test_home(Test_Base):
    def test_laptop(self):

        self.loginpage = LoginPage(self.driver)
        self.loginpage.click_login(LoginPage.login_button)
        self.loginpage.input_username(LoginPage.username_text,
                                      config_data.username)
        self.loginpage.input_password(LoginPage.password_text,
                                      config_data.password)
        self.loginpage.click_submit(LoginPage.submit_button)
        self.homepage = HomePage(self.driver)
        self.homepage.laptop_click(HomePage.laptop_click_button)
        self.homepage.laptop_select(HomePage.laptop_select_button)
Exemplo n.º 8
0
class Test_Login(Test_Base):

    def test_login(self):

        self.loginpage = LoginPage(self.driver)
        self.loginpage.click_login(LoginPage.login_button)
        self.loginpage.input_username(LoginPage.username_text,config_data.username)
        self.loginpage.input_password(LoginPage.password_text,config_data.password)
        self.loginpage.click_submit(LoginPage.submit_button)

    def test_title(self):
        self.loginpage = LoginPage(self.driver)
        self.loginpage.verify_title(config_data.homepage_title)
Exemplo n.º 9
0
    def test_01_login_valid(self):
        driver = self.driver
        driver.get("https://opensource-demo.orangehrmlive.com/")

        login = LoginPage(driver)
        login.enter_username("Admin")
        login.enter_password("admin123")
        login.click_login()


        homepage = HomePage(driver)
        homepage.click_welcome()
        homepage.click_logout()
Exemplo n.º 10
0
 def test_login_fail(self):
     driver = self.driver
     login = LoginPage(driver)
     login.enter_email(self.df.loc[1,"username"])
     login.enter_password(self.df.loc[1,"pass"])
     login.click_login()
     try:
         # Allure screenshot for the test
         allure.attach(driver.get_screenshot_as_png(), name='screenshot', attachment_type=allure.attachment_type.PNG)
         assert "Giriş - Dava & İcra Takip" == driver.title
         print("Title is ok")
     except Exception as e:
         raise
         print("Title is wrong", format(e))
Exemplo n.º 11
0
 def test_invalid_login(self):
     #Get invalid login credentials from file
     commonobj = CommonFunctions()
     username = str(
         commonobj.get_value_from_conf_file('login.credentials',
                                            'INVALID_LOGIN_USER'))
     password = str(
         commonobj.get_value_from_conf_file('login.credentials',
                                            'INVALID_LOGIN_PASSWORD'))
     driver = self.driver
     loginobj = LoginPage(driver)
     loginobj.enter_username(username)
     loginobj.click_login()
     loginobj.enter_password(password)
     loginobj.click_login()
     loginobj.verify_login_failure()
Exemplo n.º 12
0
    def login_user(self, username, password):
        login = LoginPage(self.driver)

        try:
            # Navigating to Application URL
            # self.driver.get(util.URL)
            login.navigate_to_app_URL(util.URL)

            # Entering User Credentials
            login.enter_user_credentials(username, password)

            # Clicking on Login Button
            text = login.click_login()
            print(text)
            return text

        except:
            print("There is an exception")
            curr_time = moment.now().strftime("%d-%m-%Y_%H-%M-%S")
            screenshot_name = "screenshot_" + curr_time

            # To get Function name
            # test_name = util.func_name()

            # allure.attach(self.driver.get_screenshot_as_png(), name=screenshot_name,
            #               attachment_type=allure.attachment_type.PNG)
            # self.driver.get_screenshot_as_file(
            #     "C:/KBData/PyCharmProjects/SeleniumPython/Screenshots/" + screenshot_name + ".png")
            raise
Exemplo n.º 13
0
 def test_l2_login_with_valid_data(self):
     loginpage = LoginPage(self.driver)
     loginpage.enter_username("Admin")
     loginpage.enter_password("admin123")
     loginpage.click_login()
Exemplo n.º 14
0
 def login(self):
     driver = self.driver
     login = LoginPage(driver)
     login.enter_email(self.df.loc[0,"username"])
     login.enter_password(self.df.loc[0,"pass"])
     login.click_login()
Exemplo n.º 15
0
def user_clicks_on_login(browser):
    """user clicks on "login"."""
    # browser.find_element_by_id('btn-login').click()
    login = LoginPage(browser)
    login.click_login()
def user_clicks_on_login(browser):
    """user clicks on "login"."""
    login = LoginPage(browser)
    login.click_login()