def test_follow_and_retweet(self, login_credentials, searched_phrase,
                                profile_name, tweet_number):
        # Test retweeting, following and unfollowing someone, deleting the retweet after

        login_page = LoginPage(self.driver)
        home_page = HomePage(self.driver)
        profile_page = ProfilePage(self.driver)
        logout_page = LogoutPage(self.driver)

        login_page.navigate_to_url()
        login_page.fill_in_email_and_password(login_credentials)
        login_page.click_log_in_button()
        login_page.verify_identity_if_required(login_credentials)

        home_page.close_cookies_use_info_bar()
        home_page.search_twitter(searched_phrase)
        home_page.pick_found_profile(profile_name)

        profile_page.retweet_chosen_tweet(tweet_number)
        profile_page.follow_profile()
        self.assertTrue(profile_page.check_if_profile_is_followed(),
                        "Profile is not followed.")
        profile_page.unfollow_profile()

        home_page.click_profile_menu_item()

        self.assertTrue(profile_page.check_if_retweet_is_visible(),
                        "Retweet is not visible on profile page.")
        profile_page.undo_retweet()
        self.assertTrue(profile_page.check_if_profile_has_no_tweets(),
                        "Retweet was not deleted successfully.")

        home_page.log_out()

        logout_page.confirm_log_out()
예제 #2
0
    def test_send_tweet(self, login_credentials, tweet):
        # Test sending single tweet and deleting it after

        login_page = LoginPage(self.driver)
        home_page = HomePage(self.driver)
        profile_page = ProfilePage(self.driver)
        logout_page = LogoutPage(self.driver)

        login_page.navigate_to_url()
        login_page.fill_in_email_and_password(login_credentials)
        login_page.click_log_in_button()
        login_page.verify_identity_if_required(login_credentials)

        home_page.close_cookies_use_info_bar()
        home_page.send_tweet_with_emoji(tweet)
        home_page.click_profile_menu_item()

        self.assertTrue(profile_page.check_if_tweet_is_visible(tweet),
                        "Tweet is not visible on profile page.")
        profile_page.delete_tweet()
        profile_page.confirm_delete_tweet()
        self.assertTrue(profile_page.check_if_tweet_successfully_deleted(),
                        "Tweet was not deleted successfully.")

        home_page.log_out()

        logout_page.confirm_log_out()
예제 #3
0
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.wait = WebDriverWait(self.driver, 5)

        self.login_page = LoginPage(self.driver)
        self.new_report_page = NewReportPage(self.driver)
        self.logout_page = LogoutPage(self.driver)

        # self.driver.get('http://hrm.seleniumminutes.com')
        self.login_page.goto_page()
예제 #4
0
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get('http://hrm.seleniumminutes.com')

        self.wait = WebDriverWait(self.driver, 10)
        self.login_page = LoginPage(self.driver)
        self.pim_page = PimPage(self.driver)
        self.reports_page = ReportsPage(self.driver)
        self.new_report_page = NewReportPage(self.driver)
        self.report_run_page = ReportRunPage(self.driver)
        self.logout_page = LogoutPage(self.driver)
def after_step(context, step):
    if settings.update_jira:
        if step.status == "failed":
            driver.capture_screenshot()
            jira.attach_screenshots_in_jira(
                driver.capture_screenshots_for_jira())
            LogoutPage().logout()
예제 #6
0
def login_step(context, role, username):
    try:
        LoginPage().login(username, settings.password + role)
        LoginPage().verify_user_loggedin(username)
        driver.capture_screenshot()
    except:
        LogoutPage().logout()
예제 #7
0
 def __init__(self, driver, wait, base_url):
     self.driver = driver
     self.wait = wait
     self.base_url = base_url
     self.init_page = InitPage(driver, base_url)
     self.login_page = LoginPage(driver, base_url)
     self.internal_page = InternalPage(driver, base_url)
     self.logout_page = LogoutPage(driver, base_url)
예제 #8
0
class ReportCreate(unittest.TestCase):

    def setUp(self):
        self.driver = webdriver.Chrome()
        self.driver.get('http://hrm.seleniumminutes.com')

        self.wait = WebDriverWait(self.driver, 10)
        self.login_page = LoginPage(self.driver)
        self.pim_page = PimPage(self.driver)
        self.reports_page = ReportsPage(self.driver)
        self.new_report_page = NewReportPage(self.driver)
        self.report_run_page = ReportRunPage(self.driver)
        self.logout_page = LogoutPage(self.driver)

    def test_create_report(self):
        report_name = "DC report: " + str(randint(1, 100))
        selection_ctiteria = 'Job Title'
        display_field_group = 'Personal '
        expected_report_header = 'Report Name : {}'.format(report_name)

        self.login_page.login()
        self.pim_page.go_to_reports_page()
        self.reports_page.add_report()
        self.new_report_page.set_report_name(report_name)
        self.new_report_page.select_selection_criteria(selection_ctiteria)
        self.new_report_page.select_display_field_group(display_field_group)
        self.new_report_page.enable_display_fields()
        self.new_report_page.save()
        self.assertTrue(self.reports_page.find_report_name(report_name))
        self.report_name = report_name
        self.reports_page.search(report_name)
        self.reports_page.run(report_name)
        report_header = self.report_run_page.get_header()
        self.assertEqual(expected_report_header,report_header)

    def tearDown(self):
        if self.report_name:
            self.report_run_page.go_to_pim_page()
            self.pim_page.go_to_reports_page()
            self.reports_page.search(self.report_name)
            self.reports_page.report_delete()
            self.logout_page.logout()
            self.driver.quit()
    def test_log_in_and_log_out(self, login_credentials):
        # Test logging in and logging out

        login_page = LoginPage(self.driver)
        home_page = HomePage(self.driver)
        logout_page = LogoutPage(self.driver)

        login_page.navigate_to_url()
        self.assertTrue(login_page.check_if_sidebar_headers_are_visible(),
                        "Not all sidebar headers are visible.")
        login_page.fill_in_email_and_password(login_credentials)
        login_page.click_log_in_button()
        login_page.verify_identity_if_required(login_credentials)
        self.assertTrue(login_page.was_login_successful(),
                        "Login not successful - check your credentials.")

        home_page.close_cookies_use_info_bar()
        home_page.log_out()

        logout_page.confirm_log_out()
예제 #10
0
class ReportCreate(unittest.TestCase):
    def setUp(self):
        self.driver = webdriver.Chrome()
        self.wait = WebDriverWait(self.driver, 5)

        self.login_page = LoginPage(self.driver)
        self.new_report_page = NewReportPage(self.driver)
        self.logout_page = LogoutPage(self.driver)

        # self.driver.get('http://hrm.seleniumminutes.com')
        self.login_page.goto_page()

    def test_create_report(self):
        self.login_page.login()
        self.new_report_page.goto_page()
        current_page_url = self.driver.current_url

    def tearDown(self):
        self.logout_page.logout()
        self.driver.quit()
예제 #11
0
 def test_login_and_logout(self, base_url, selenium, existing_user):
     ulg = UnloginPage(base_url, selenium)
     ig = HomePage(base_url, selenium)
     logout_pg = LogoutPage(base_url, selenium)
     ulg.get_relative_path('/')
     assert ulg.header.is_user_not_login, '刚开始网页是没有登录, 但检测为登录了'
     ulg.header.login(existing_user['username'], existing_user['password'])
     assert ig.header.is_user_logged_in, '登录完后用户 {} 应该是进入登录状态, 但依然为未登录状态'.format(existing_user)
     ig.close_ad_intercept()
     ig.header.click_logout()
     assert logout_pg.header.is_user_not_login
def logout(context):
    LogoutPage().logout()
    driver.capture_screenshot()
예제 #13
0
def select_role(context, role):
    try:
        HomePage().select_user_role(role)
        driver.capture_screenshot()
    except:
        LogoutPage().logout()
예제 #14
0
def load_website(context):
    try:
        driver.navigate(settings.url)
        driver.capture_screenshot()
    except:
        LogoutPage().logout()