def test_registration_empty_input_field(browser):
    link = "https://robo.market/"
    page = MainPage(browser, link)
    page.go_to_site()
    page.geo_accept_moscow()
    page_reg = RegistrationPage(browser, link)
    page_reg.registration_empty_input_field()
Example #2
0
class PopularCategory(unittest.TestCase):
    def setUp(self) -> None:
        default_setup(self)
        self.sphere = 'Государственные организации'
        self.main_page = MainPage(self.driver)
        self.vacancies_page = VacanciesPage(self.driver)
        self.reg_page = RegistrationPage(self.driver)
        self.create_resume_page = CreateResumePage(self.driver)
        self.main_page.open()

    def tearDown(self):
        self.driver.quit()

    def test_check_vacancy_by_sphere(self):
        self.main_page.click_on_sphere(self.sphere)
        self.assertTrue(self.vacancies_page.is_open())
        self.vacancies_page.click_on_first_vacancy()
        self.assertEqual(self.vacancies_page.get_sphere(), self.sphere)

    def test_check_footer_btn_not_auth(self):
        text = self.main_page.click_footer_btn()
        self.assertEqual(text, 'Создать аккаунт')
        self.reg_page.wait_for_page_open()
        self.assertTrue(self.reg_page.is_open())

    def test_check_footer_btn_auth(self):
        setup_auth(self)
        text = self.main_page.click_footer_btn()
        self.assertEqual(text, 'Создать резюме')
        self.create_resume_page.wait_for_page_open()
        self.assertTrue(self.create_resume_page.is_open())
Example #3
0
 def __init__(self):
     self.driver = webdriver.Chrome(executable_path="D:/Python36/chromedriver.exe")
     self.wait = WebDriverWait(self.driver, 10)
     self.registration_page = RegistrationPage(self.driver)
     self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
     self.customer_list_page = CustomerListPage(self.driver)
     self.customer_login_page = CustomerLandingPage(self.driver)
Example #4
0
    def setUp(self):
        if Mail.email_address is None:
            Mail.generate_email_address()

        self.browser = webdriver.Chrome()
        self.registration_page = RegistrationPage(driver=self.browser)
        self.registration_page.go()
    def __init__(self):
        self.driver = webdriver.Chrome()
        self.registration_page = RegistrationPage(self.driver)
        self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
        self.customer_list_page = CustomerListPage(self.driver)

        self.product_list_page = ProductListPage(self.driver)
        self.cart_page = CartPage(self.driver)
Example #6
0
 def setUp(self) -> None:
     default_setup(self)
     self.sphere = 'Государственные организации'
     self.main_page = MainPage(self.driver)
     self.vacancies_page = VacanciesPage(self.driver)
     self.reg_page = RegistrationPage(self.driver)
     self.create_resume_page = CreateResumePage(self.driver)
     self.main_page.open()
def setup_for_module(browser):
    global page
    page = RegistrationPage(browser, Links.LOGIN_LINK)
    page.check_new_user_exist()
    page.change_sys_paran(auth_ad="False")
    page.open()
    page.go_to_reg_page()
    yield page
 def __init__(self):
     self.driver = webdriver.Chrome()
     self.driver.implicitly_wait(2)
     self.registration_page = RegistrationPage(self.driver)
     self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
     self.customer_list_page = CustomerListPage(self.driver)
     self.store_main_page = StoreMainPage(self.driver)
     self.shopping_cart_page = ShoppingCartPage(self.driver)
Example #9
0
 def __init__(self):
     self.driver = webdriver.Chrome()
     self.registration_page = RegistrationPage(self.driver)
     self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
     self.admin_panel_main_page = AdminPanelMainPage(self.driver)
     self.app_main_page = AppMainPage(self.driver)
     self.customer_list_page = CustomerListPage(self.driver)
     self.admin_countries_page = AdminCountriesPage(self.driver)
     self.admin_geo_zones_page = AdminGeoZonesPage(self.driver)
     self.admin_catalog_page = AdminCatalogPage(self.driver)
Example #10
0
    def setUp(self):
        if Mail.email_address is None:
            Mail.generate_email_address()

        self.browser = webdriver.Chrome()
        self.registration_page = RegistrationPage(driver=self.browser)
        self.registration_page.go()
        self.registration_page.go_to_second_registration_page(
            Mail.email_address, TestData.password)
        Mail.get_registration_pin()
Example #11
0
 def test_wrong_password_during_confirmation(self, email, password):
     # Stworzenie instancji klasy RegistrationPage (rp)
     rp = RegistrationPage(self.driver)
     td = TestData()
     ut = VerifyErrors(self.driver)
     rp.fill_login(td.username)
     rp.fill_password(td.password)
     rp.confirm_password("3")
     rp.fill_email(email)
     # UWAGA TEST!
     ut.verify_visible_errors(1, ["Hasło i potwierdzenie hasła muszą być takie same."])
Example #12
0
 def setup(self, browser, db_connection):
     self.browser = browser
     self.conn, self.cursor = (db_connection)
     self.registration_page = RegistrationPage(self.browser,
                                               REGISTRATIONPAGE_URL,
                                               self.cursor)
     self.registration_page.open()
     self.registration_page.is_it_registration_page()
     yield
     sql = "DELETE FROM auth_user"
     self.cursor.execute(sql)
     self.conn.commit()
Example #13
0
 def setUp(self):
     """
     Initialize all page objects
     """
     super().setUp()
     self.browser.maximize_window()
     self.home_page = HomePage(self.browser)
     self.registration_page = RegistrationPage(self.browser)
     self.registration_success = RegistrationSuccess(self.browser)
     self.login_page = LoginPage(self.browser)
     self.logged_in_home_page = LoggedInHomePage(self.browser)
     self.notification_target_page = NotificationTargetPage(self.browser)
Example #14
0
    def setUp(self) -> None:
        default_setup(self)

        self.auth_page = AuthPage(self.driver)
        self.reg_page = RegistrationPage(self.driver)

        self.incorrect_password = '******'
        self.invalid_password = '******'
        self.incorrect_email = 'margot.ru'
        self.invalid_email = '*****@*****.**'
        self.correct_email = self.EMAIL_APPL
        self.correct_password = self.PASSWORD_APPL
Example #15
0
def registration_applicant(test, data=None):
    if data is None:
        name = ''.join(random.choice(string.ascii_letters) for i in range(10))
        surname = ''.join(
            random.choice(string.ascii_letters) for i in range(10))
        email = (''.join(
            random.choice(string.ascii_letters)
            for i in range(10))) + '@mail.ru'
        password = ''.join(
            random.choice(string.ascii_letters) for i in range(10))
        data = {
            'NAME': name,
            'SURNAME': surname,
            'EMAIL': email,
            'PASSWORD': password,
            'CONFIRM_PASSWORD': password,
        }

    registration_page = RegistrationPage(test.driver)
    registration_page.open()

    registration_page.set_data(data)
    registration_page.wait_for_reg_is_done()

    return data
def test_registration_input_too_long_name(browser, name1, name2):
    link = "https://robo.market/"
    page = MainPage(browser, link)
    page.go_to_site()
    page.geo_accept_moscow()
    window0 = browser.window_handles[0]
    page_reg = RegistrationPage(browser, link)
    page_reg.go_to_sec_mail()
    window1 = browser.window_handles[1]
    browser.switch_to.window(window1)
    page_reg.get_email_adress()
    browser.switch_to.window(window0)
    page_reg.go_to_robomarket_reg(name1, name2)
    page_reg.error_to_long_name()
Example #17
0
    def setUp(self) -> None:
        default_setup(self)

        self.incorrect_name = 'name123'
        self.incorrect_surname = 'surname123'
        self.incorrect_email = 'margot.ru'
        self.correct_name = 'margotName'
        self.correct_surname = 'margotSurname'
        self.correct_email = '*****@*****.**'
        self.correct_password = self.PASSWORD_APPL

        self.auth_page = AuthPage(self.driver)
        self.reg_page = RegistrationPage(self.driver)
        self.profile_page = ProfilePage(self.driver)
        self.main_page = MainPage(self.driver)
Example #18
0
def setup(request):
    config = getattr(request, '_funcargs')['config']
    reg_page = RegistrationPage(config)
    user = GkrUserSteps(config)
    user.logout()
    user.opens(Urls.REGISTRATION)
    user.should_see_element(reg_page)
Example #19
0
 def test_mobile_field_limit(self, config, setup):
     user = GkrUserSteps(config)
     reg_page = RegistrationPage(config)
     expected_phone = '12345678901234'
     user.enters_text(reg_page.MOBILE, expected_phone + '5')
     user.submit_regform()
     user.should_see_field_value(reg_page.MOBILE, expected_phone)
def test_recovery_password_email_not_found(browser, email):
    link = "https://robo.market/"
    page = MainPage(browser, link)
    page.go_to_site()
    page.geo_accept_moscow()
    page_reg = RegistrationPage(browser, link)
    page_reg.forget_password()
    page_reg.recovery_password_input_email(email)
    page_reg.error_recovery_password_email_not_found()
Example #21
0
    def registration_applicant(self, data=None):

        registration_page = RegistrationPage(self.test.driver)
        registration_page.open()

        registration_page.set_data(self.data)
        registration_page.wait_for_reg_is_done()

        return self.data
Example #22
0
    def test_email_field(self, config, email, message, setup):
        user = GkrUserSteps(config)
        reg_page = RegistrationPage(config)

        user.enters_text(reg_page.EMAIL, email)
        user.submit_regform()
        user.waits_for_element_displayed(reg_page.ERROR)
        user.should_see_element_contains_text(reg_page.ERROR, message)
Example #23
0
def setup_for_module(browser):
    global page
    global reg_page
    reg_page = RegistrationPage(browser, Links.LOGIN_LINK)
    page = AdmUserPage(browser, Links.LOGIN_LINK)
    page.open()
    page.change_user_stat()
    yield page
Example #24
0
 def __init__(self, config):
     super().__init__(config)
     self.mysqlhost = config.mysqlhost
     self.login_form = LoginForm(config)
     self.main_menu = MainMenu(config)
     self.top_menu = TopMenu(config)
     self.reg_page = RegistrationPage(config)
     self.queue_page = QueuePage(config)
     self.news_page = NewsAdminPage(config)
Example #25
0
    def test_passport_issue_field(self, config, issue, message, setup):
        user = GkrUserSteps(config)
        reg_page = RegistrationPage(config)

        user.enters_text(reg_page.ISSUE, issue)
        user.submit_regform()
        user.waits_for_element_displayed(reg_page.ERROR)
        user.should_see_element_contains_text(reg_page.ERROR,
                                              ErrorMessages.PASSPORT_SERIAL)
Example #26
0
    def test_customer_self_registration(self, config, teardown):
        global self_reg_mobile
        customer = random_user(UserRoles.CUSTOMER)
        user = GkrUserSteps(config)
        db_user = GkrDbSteps(config)
        reg_page = RegistrationPage(config)
        profile_page = ProfilePage(config)
        main_page = MainPage(config)
        dialogs = Dialogs(config)

        self_reg_mobile = customer.customers_data.mobile_phone
        user.logout()
        user.clicks(main_page.top_menu.REG_LINK)
        user.fill_registration_form(customer)
        user.submit_regform()
        user.should_see_dialog_text(dialogs.REG_SUCCESS_DIALOG, Messages.REGISTRATION_SUCCESSFUL)

        t_customer = db_user.query_first(TCustomers, TCustomers.mobile_phone == self_reg_mobile)
        user.opens(Urls.REGISTRATION.url + '/customer/?code=' + str(t_customer.code) + '&id=' + str(t_customer.id))
        customer.password = db_user.query_first(AclUsers, AclUsers.name == customer.customers_data.mobile_phone).pwd
        user.should_see_dialog_text(dialogs.EMAIL_SUCCESS_DIALOG, Messages.EMAIL_CONFIRMED)
        user.close(dialogs.EMAIL_SUCCESS_DIALOG)

        user.login(customer.customers_data.mobile_phone, customer.password)
        user.should_see_element(profile_page)

        # проверка доступности полей
        disabled = 'disabled'
        user.should_see_attribute_value(reg_page.NAME, disabled, True)
        user.should_see_attribute_value(reg_page.SURNAME, disabled, True)
        user.should_see_attribute_value(reg_page.PATRONYMIC, disabled, True)
        user.should_see_element_enabled(reg_page.BIRTHDAY)
        user.should_see_attribute_value(reg_page.EMAIL, disabled, True)
        user.should_see_attribute_value(reg_page.MOBILE, disabled, True)
        user.should_see_attribute_value(reg_page.HOME_PHONE, disabled, True)
        user.should_see_attribute_value(reg_page.PASSPORT_SERIAL, disabled, True)
        user.should_see_attribute_value(reg_page.PASSPORT_NUMBER, disabled, True)
        user.should_see_attribute_value(reg_page.ISSUE_DATE, disabled, True)
        user.should_see_attribute_value(reg_page.ISSUE, disabled, True)
        user.should_see_element_enabled(profile_page.PASSWORD)
        user.should_see_element_enabled(profile_page.PASSWORD_CONFIRM)

        # проверка значений
        app_format = '%d.%m.%Y'
        user.should_see_element(profile_page)
        user.should_see_field_value(reg_page.NAME, customer.customers_data.name)
        user.should_see_field_value(reg_page.SURNAME, customer.customers_data.surname)
        user.should_see_field_value(reg_page.PATRONYMIC, customer.customers_data.patronymic)
        user.should_see_field_value(reg_page.BIRTHDAY, customer.customers_data.birthday.strftime(app_format))
        user.should_see_field_value(reg_page.EMAIL, customer.customers_data.email)
        user.should_see_field_value(reg_page.MOBILE, customer.customers_data.mobile_phone)
        user.should_see_field_value(reg_page.HOME_PHONE, '')
        user.should_see_field_value(reg_page.PASSPORT_SERIAL, customer.customers_data.serial)
        user.should_see_field_value(reg_page.PASSPORT_NUMBER, customer.customers_data.no)
        user.should_see_field_value(reg_page.ISSUE, customer.customers_data.issue)
        user.should_see_field_value(reg_page.ISSUE_DATE,
                                    customer.customers_data.when_at.strftime(app_format))
Example #27
0
    def __init__(self, driver):
        self.driver = driver

        self.main_page = MainPage(self.driver)
        self.search_results_page = Search(self.driver)
        self.registration_page = RegistrationPage(self.driver)
        self.my_account_page = AccountPage(self.driver)
        self.cart_page = CartPage(self.driver)
        self.product_page = ProductPage(self.driver)
Example #28
0
    def test_mobile_field(self, config, mobile, setup):
        user = GkrUserSteps(config)

        reg_page = RegistrationPage(config)
        user.enters_text(reg_page.MOBILE, mobile)
        user.submit_regform()
        user.waits_for_element_displayed(reg_page.ERROR)
        user.should_see_field_value(reg_page.MOBILE,
                                    ''.join(re.findall('\d', mobile)))
        user.should_see_element_contains_text(reg_page.ERROR,
                                              ErrorMessages.MOBILE)
Example #29
0
    def test_legal_inn_field(self, config, inn, message, setup):
        user = GkrUserSteps(config)
        reg_page = RegistrationPage(config)

        user.clicks(reg_page.LEGAL_TYPE)
        user.waits_for_element_displayed(reg_page.LEGAL_HEADER)
        user.enters_text(reg_page.INN, inn)
        user.clicks(reg_page.CHECKBOX)
        user.waits_for_element_enabled(reg_page.SUBMIT)
        user.clicks(reg_page.SUBMIT)
        user.waits_for_element_displayed(reg_page.ERROR)
        user.should_see_element_contains_text(reg_page.ERROR, message)
 def setUp(self):
     """
     Initialize all page objects
     """
     super(TestAddNotifications, self).setUp()
     self.browser.maximize_window()
     self.home_page = HomePage(self.browser)
     self.registration_page = RegistrationPage(self.browser)
     self.registration_success = RegistrationSuccess(self.browser)
     self.login_page = LoginPage(self.browser)
     self.logged_in_home_page = LoggedInHomePage(self.browser)
     self.notification_target_page = NotificationTargetPage(self.browser)
class Application:

    def __init__(self):
        self.driver = webdriver.Chrome()
        self.registration_page = RegistrationPage(self.driver)
        self.admin_panel_login_page = AdminPanelLoginPage(self.driver)
        self.customer_list_page = CustomerListPage(self.driver)

    def quit(self):
        self.driver.quit()

    def register_new_customer(self, customer):
        self.registration_page.open()
        self.registration_page.firstname_input.send_keys(customer.firstname)
        self.registration_page.lastname_input.send_keys(customer.lastname)
        self.registration_page.address1_input.send_keys(customer.address)
        self.registration_page.postcode_input.send_keys(customer.postcode)
        self.registration_page.city_input.send_keys(customer.city)
        self.registration_page.select_country(customer.country)
        self.registration_page.select_zone(customer.zone)
        self.registration_page.email_input.send_keys(customer.email)
        self.registration_page.phone_input.send_keys(customer.phone)
        self.registration_page.password_input.send_keys(customer.password)
        self.registration_page.confirmed_password_input.send_keys(customer.password)
        self.registration_page.create_account_button.click()

    def get_customer_ids(self):
        if self.admin_panel_login_page.open().is_on_this_page():
            self.admin_panel_login_page.enter_username("admin").enter_password("pass").submit_login()
        return self.customer_list_page.open().get_customer_ids()
class TestAddNotifications(WebAppTest):

    notification_dict = {
        'open-edx.studio.announcements.new-announcement': 'Gettysburg Address',
        'open-edx.lms.discussions.reply-to-thread': 'testuser responded to your post in ',
        'open-edx.lms.discussions.thread-followed': 'A demo posting to the discussion forums was followed 3 times',
        'open-edx.lms.discussions.post-upvoted': 'post A demo posting to the discussion forums was upvoted 5 times',
        'open-edx.lms.discussions.cohorted-thread-added': 'testuser posted: Four score and seven years ago',
        'open-edx.lms.discussions.cohorted-comment-added': 'testuser responded: Four score and seven years ago',
        'open-edx.lms.discussions.comment-upvoted': 'response to A demo posting to the discussion forums was upvoted',
        'open-edx.lms.leaderboard.progress.rank-changed': 'You are now #2 for Progress in the cohort!',
        'open-edx.lms.leaderboard.gradebook.rank-changed': 'You are now #3 for Proficiency in the cohort!',
        'open-edx.lms.leaderboard.engagement.rank-changed': 'You are now #1 for Engagement in the cohort!',
        'open-edx.xblock.group-project.file-uploaded': 'First Activity: testuser uploaded a file',
        'open-edx.xblock.group-project.stage-open': 'First Activity: Upload(s) are open',
        'open-edx.xblock.group-project.stage-due': 'First Activity: Upload(s) due 4/25',
        'open-edx.xblock.group-project.grades-posted': 'First Activity: Grade(s) are posted',
    }

    short_notification_dict = {
        'open-edx.studio.announcements.new-announcement': 'Gettysburg Address',
        'open-edx.lms.discussions.reply-to-thread': 'testuser responded to your post in ',
        'open-edx.lms.discussions.cohorted-thread-added': 'testuser posted: Four score and seven years ago',
        'open-edx.lms.leaderboard.progress.rank-changed': 'You are now #2 for Progress in the cohort!',
        'open-edx.xblock.group-project.grades-posted': 'First Activity: Grade(s) are posted',
    }

    if HIDE_LINK_IS_VISIBLE:
        notifications_container_tabs = ['View unread', 'View all', 'Mark as read', 'Hide', 'Settings']
    else:
        notifications_container_tabs = ['View unread', 'View all', 'Mark as read', 'Settings']

    namespaces = ['foo/bar/baz', 'test/test/test']

    def setUp(self):
        """
        Initialize all page objects
        """
        super(TestAddNotifications, self).setUp()
        self.browser.maximize_window()
        self.home_page = HomePage(self.browser)
        self.registration_page = RegistrationPage(self.browser)
        self.registration_success = RegistrationSuccess(self.browser)
        self.login_page = LoginPage(self.browser)
        self.logged_in_home_page = LoggedInHomePage(self.browser)
        self.notification_target_page = NotificationTargetPage(self.browser)

    def test_00_show_notification_pane(self):
        """
        Scenario: User is able to show the notification container
        Given that I am on the notification home page
        And notifications container is hidden
        When I click the notification icon
        Then I should see the notification container
        When I click on the hide link
        Then notification container becomes invisible again
        """
        self.login()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.verify_notifications_container_is_invisible()

    def test_01_hide_notification_pane(self):
        """
        Scenario: User is able to hide the notification container
        Given that I am on the notification home page
        And notifications container is visible
        When I click on the notification icon again
        Then notification container should hide
        """
        self.login()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.verify_notifications_container_is_invisible()

    @skipUnless(HIDE_LINK_IS_VISIBLE, "Test only runs if Hide link is visible")
    def test_02_hide_link(self):
        """
        Scenario: User is able to hide the notification container using hide link
        Given that I am on the notification home page
        And notifications container is visible
        When I click on the notification icon again
        Then notification container should hide
        """
        self.login()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.hide_notification_container_using_hide_link()
        self.logged_in_home_page.verify_notifications_container_is_invisible()

    def test_03_verify_tabs(self):
        """
        Scenario: User is able to view 4 tabs namely view unread, view all, Mark as read and hide
        in notification container
        Given that I am on the notification home page
        And notifications container is hidden
        When I click the notification icon
        Then I should see the notification container
        And notification container should display 4 tabs(unread, view all, Mark as read, Hide)
        """
        self.login()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        fetched_notifications_container_tabs = self.logged_in_home_page.return_notifications_container_tabs()
        self.assertEqual(fetched_notifications_container_tabs, self.notifications_container_tabs)

    def test_04_verify_default_tab(self):
        """
        Scenario: When notification container becomes visible, by default the View Unread tab is selected
        Given that I am on the notification home page
        And notifications container is hidden
        When I click the notification icon
        Then I should see the notification container
        And by default the View Unread tab should be selected
        """
        self.login()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        fetched_selected_tab = self.logged_in_home_page.return_selected_tab()
        self.assertEqual(fetched_selected_tab, self.notifications_container_tabs[0])

    def test_05_unread_notifications_count(self):
        """
        Scenario: Clicking on the add notification button after selecting a notification type increases the
        unread notification count by 1.
        Given that I am on the notification home page
        When I click the notification icon after adding a notification
        Then I should see the increase in unread notification count by 1
        """
        self.login()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        initial_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        for key in self.notification_dict:
            self.logged_in_home_page.select_notification_type(key)
            self.logged_in_home_page.add_notification()
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            final_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
            self.logged_in_home_page.hide_notification_container()
            self.logged_in_home_page.verify_notifications_container_is_invisible()
            self.assertEqual(final_unread_notification_count, initial_unread_notification_count + 1)
            initial_unread_notification_count = final_unread_notification_count

    def test_06_view_all_notification_count(self):
        """
        Scenario: Clicking on the add notification button after selecting a notification type increases the
        notification count in view all tab by 1.
        Given that I am on the notification home page
        When I click the notification icon after adding a notification
        Then I should see the increase in notification count by 1 in view all tab
        """
        self.login()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.select_view_all_tab()
        initial_notification_count = self.logged_in_home_page.return_view_all_notifications_count()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        for key in self.short_notification_dict:
            self.logged_in_home_page.select_notification_type(key)
            self.logged_in_home_page.add_notification()
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.select_view_all_tab()
            final_notification_count = self.logged_in_home_page.return_view_all_notifications_count()
            self.logged_in_home_page.hide_notification_container()
            self.logged_in_home_page.verify_notifications_container_is_invisible()
            self.assertEqual(final_notification_count, initial_notification_count + 1)
            initial_notification_count = final_notification_count

    def test_07_unread_notifications_text(self):
        """
        Scenario: When user adds a new notification type, the relevant message for this notification type
        appears in unread notifications tab
        Given that I am on the notification home page
        And notifications container is hidden
        When I add a specific notification type
        And click the notification icon
        Then I should see the unread notifications
        And a relevant message for the added notification type should be visible in unread notification tab
        """
        self.login()
        for key, value in self.notification_dict.iteritems():
            self.logged_in_home_page.select_notification_type(key)
            self.logged_in_home_page.add_notification()
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            unread_notification_list = self.logged_in_home_page.return_notifications_list(key)
            self.logged_in_home_page.hide_notification_container()
            self.logged_in_home_page.verify_notifications_container_is_invisible()
            self.assertIn(value, unread_notification_list[0])

    def test_08_view_all_notifications_text(self):
        """
        Scenario: When user adds a new notification type, the relevant message for this notification type
        appears in view all notifications tab
        Given that I am on the notification home page
        And notifications container is hidden
        When I add a specific notification type
        And click the notification icon
        Then I should see the unread notifications
        And a relevant message for the added notification type should be visible in view all notification tab
        """
        self.login()
        for key, value in self.short_notification_dict.iteritems():
            self.logged_in_home_page.select_notification_type(key)
            self.logged_in_home_page.add_notification()
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.select_view_all_tab()
            notification_list = self.logged_in_home_page.return_notifications_list(key)
            self.logged_in_home_page.hide_notification_container()
            self.logged_in_home_page.verify_notifications_container_is_invisible()
            self.assertIn(value, notification_list[0])

    def test_09_mark_as_read(self):
        """
        Scenario: When user clicks on mark as read tab, notifications disappear from unread notifications
        tab
        Given that I am on the notification home page
        And there are some notifications present in unread notification tab
        When I click on mark as read link
        Then all notifications should disappear from unread notifications tab
        And notification count on panel should also become 0
        """
        self.login()
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
        self.assertTrue(unread_notification_count > 0)
        self.logged_in_home_page.mark_as_read()
        unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
        self.assertEqual(unread_notification_count, 0)
        display_notification_count = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(display_notification_count, 0)

    def test_10_page_redirect(self):
        """
        Scenario: When user clicks on any notification, it should redirect user to a specific page
        Given that I am on the notification home page
        And there are some notifications present
        When I click on any notification
        Then it should redirect me to a specific page
        And the resulting page url should be same as click link
        """
        for key in self.notification_dict:
            if key != 'testserver.type1':
                self.login()
                self.logged_in_home_page.select_notification_type(key)
                self.logged_in_home_page.add_notification()
                self.logged_in_home_page.show_notifications_container()
                self.logged_in_home_page.verify_notifications_container_is_visible()
                notification_link = self.logged_in_home_page.click_on_notification()
                self.notification_target_page.verify_target_page_url(notification_link)
                self.browser.back()
                self.logged_in_home_page.log_out()

    def test_11_page_refresh(self):
        """
        Scenario: When user clicks on any notification without target link, it should just refresh
        the page
        Given that I am on the notification home page
        And there are some notifications present
        When I click on any notification
        Then it should just refresh the page
        """
        self.login()
        self.logged_in_home_page.select_notification_type('testserver.type1')
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        notification_link = self.logged_in_home_page.click_on_notification()
        self.assertEqual(notification_link, 'No target link')

    def test_12_status_change_one(self):
        """
        Scenario: When user clicks on any unread notification, it should change
        it's status to read
        When I click on any unread notification
        Then it's status should change to unread
        """
        self.login()
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
        self.logged_in_home_page.click_on_notification()
        self.browser.back()
        self.logged_in_home_page.log_out()
        self.login()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        new_unread_notification_count = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(new_unread_notification_count, unread_notification_count - 1)

    def test_13_status_change_two(self):
        """
        Scenario: When user clicks on any notification without target link, it should change
        it's status to read
        When I click on any unread notification
        Then it's status should change to unread
        """
        self.login()
        self.logged_in_home_page.select_notification_type('testserver.type1')
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
        self.logged_in_home_page.click_on_notification()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        new_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
        self.assertEqual(new_unread_notification_count, unread_notification_count - 1)

    def test_14_notification_count_decrease_one(self):
        """
        Scenario: When user clicks on any notification, the notification count should decrease
        by 1
        Given that I am on the notification home page
        And there are some notifications present
        When I click on any unread notification
        Then it the main notification count should be decreased by 1
        """
        self.login()
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        notification_count = self.logged_in_home_page.get_notifications_count()
        self.logged_in_home_page.click_on_notification()
        self.browser.back()
        self.logged_in_home_page.log_out()
        self.login()
        new_notification_count = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(new_notification_count, notification_count - 1)

    def test_15_notification_count_decreases_two(self):
        """
        Scenario: When user clicks on any notification without target link, the notification
        count should decrease by 1
        Given that I am on the notification home page
        And there are some notifications present
        When I click on any unread notification
        Then it the main notification count should be decreased by 1
        """
        self.login()
        self.logged_in_home_page.select_notification_type('testserver.type1')
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        notification_count = self.logged_in_home_page.get_notifications_count()
        self.logged_in_home_page.click_on_notification()
        new_notification_count = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(new_notification_count, notification_count - 1)

    def test_16_namespace_one(self):
        """
        Scenario: When user adds notification in first namespace, it does not change
        notification count in 2nd namespace
        Given that I am on the notification home page
        And all name spaces have been initialized to 0 count
        When I add notifications in any namespace
        Then the notification count in other namespace remains unchanged
        """
        self.login()
        for namespace in self.namespaces:
            self.logged_in_home_page.set_namespace(namespace)
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.mark_as_read()
            display_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(display_notification_count, 0)
        self.logged_in_home_page.set_namespace(self.namespaces[0])
        self.logged_in_home_page.add_notification()
        notification_count_for_namespace_1 = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(notification_count_for_namespace_1, 1)
        self.logged_in_home_page.set_namespace(self.namespaces[1])
        notification_count_for_namespace_2 = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(notification_count_for_namespace_2, 0)

    def test_18_namespace_two(self):
        """
        Scenario: When user adds notification in first namespace, it does not change
        unread notification count in other namespace
        Given that I am on the notification home page
        And all name spaces have been initialized to 0 count
        When I add notifications in any namespace
        Then the unread notification count in other namespace remains unchanged
        """
        self.login()
        for namespace in self.namespaces:
            self.logged_in_home_page.set_namespace(namespace)
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.mark_as_read()
            display_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(display_notification_count, 0)
        self.logged_in_home_page.set_namespace(self.namespaces[1])
        self.logged_in_home_page.add_notification()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count_for_namespace_2 = self.logged_in_home_page.return_unread_notifications_count()
        self.assertEqual(unread_notification_count_for_namespace_2, 1)
        self.logged_in_home_page.set_namespace(self.namespaces[0])
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        unread_notification_count_for_namespace_1 = self.logged_in_home_page.return_unread_notifications_count()
        self.assertEqual(unread_notification_count_for_namespace_1, 0)

    def test_19_namespace_three(self):
        """
        Scenario: When user marks notifications in first namespace as read, it does not change
        notifications status in 2nd namespace
        Given that I am on the notification home page
        And all name spaces have some notifications
        When I mark notifications as read in one name space
        Then the notification status in other namespace remains unchanged
        """
        self.login()
        for namespace in self.namespaces:
            self.logged_in_home_page.set_namespace(namespace)
            self.logged_in_home_page.add_notification()
        self.logged_in_home_page.set_namespace(self.namespaces[0])
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.mark_as_read()
        notification_count_for_namespace_1 = self.logged_in_home_page.get_notifications_count()
        self.assertEqual(notification_count_for_namespace_1, 0)
        self.logged_in_home_page.set_namespace(self.namespaces[1])
        notification_count_for_namespace_2 = self.logged_in_home_page.get_notifications_count()
        self.assertTrue(notification_count_for_namespace_2 > 0)

    def test_20_close_icon(self):
        """
        Scenario: When user clicks on close icon of any notification, it should remain on current
        page and notification count along with unread count should decrease by 1
        Given that I am on the notification home page
        And there are some notifications present
        When I click on any notification's close icon
        Then it should stay on the same page
        And the notification count should decrease by one
        And unread notification count should also decrease by one
        """
        self.login()
        self.logged_in_home_page.show_notifications_container()
        self.logged_in_home_page.verify_notifications_container_is_visible()
        self.logged_in_home_page.mark_as_read()
        self.logged_in_home_page.hide_notification_container()
        self.logged_in_home_page.verify_notifications_container_is_invisible()
        for key in self.notification_dict:
            self.logged_in_home_page.select_notification_type(key)
            self.logged_in_home_page.add_notification()
            initial_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(initial_notification_count, 1)
            self.logged_in_home_page.show_notifications_container()
            self.logged_in_home_page.verify_notifications_container_is_visible()
            initial_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
            self.assertEqual(initial_unread_notification_count, 1)
            self.logged_in_home_page.verify_notifications_container_is_visible()
            self.logged_in_home_page.close_notification()
            self.assertTrue(self.logged_in_home_page.is_browser_on_page())
            final_unread_notification_count = self.logged_in_home_page.return_unread_notifications_count()
            self.assertEqual(final_unread_notification_count, 0)
            final_notification_count = self.logged_in_home_page.get_notifications_count()
            self.assertEqual(final_notification_count, 0)
            self.logged_in_home_page.hide_notification_container()
            self.logged_in_home_page.verify_notifications_container_is_invisible()

    def login(self):
        """
        Go to home page and login using correct credentials
        """
        self.home_page.visit()
        self.home_page.go_to_login_page()
        login_result = self.login_page.login_to_application(user_name, password)
        if login_result == 'User not registered':
            self.home_page.go_to_registration_page()
            self.registration_page.register(user_name, user_email, password)
            self.registration_success.go_to_login_page()
            self.login_page.login_to_application(user_name, password)
            self.assertTrue(self.logged_in_home_page.is_browser_on_page())
        self.assertTrue(self.logged_in_home_page.is_browser_on_page())