Beispiel #1
0
    def test_should_check_if_deleted_questionnaires_and_poll_not_be_in_questionnaires_list(
            self):
        self.driver.go_to(LOGOUT)
        self.driver.go_to(DATA_WINNER_LOGIN_PAGE)
        login_page = LoginPage(self.driver)
        login_page.do_successful_login_with(USER_RASITEFA_CREDENTIALS)
        self.driver.go_to(DATA_WINNER_DASHBOARD_PAGE)
        dashboard_page = DashboardPage(self.driver)
        self.assertEqual(len(dashboard_page.get_projects_list()), 3)
        create_questionnaire_options_page = dashboard_page.navigate_to_create_project_page(
        )

        create_questionnaire_page = create_questionnaire_options_page.select_blank_questionnaire_creation_option(
        )
        create_questionnaire_page.create_questionnaire_with(
            NEW_PROJECT, QUESTIONNAIRE_DATA)
        global_navigation = GlobalNavigationPage(self.driver)
        project_overview_page = create_questionnaire_page.save_and_create_project_successfully(
        )
        project_name = project_overview_page.get_project_title()
        all_projects_page = global_navigation.navigate_to_view_all_project_page(
        )
        all_projects_page.delete_project(project_name)
        self.driver.go_to(DATA_WINNER_DASHBOARD_PAGE)
        dashboard_page = DashboardPage(self.driver)
        all_projects_page = ProjectsPage(self.driver)
        self.assertEqual(len(dashboard_page.get_projects_list()), 3)
        self.assertFalse(all_projects_page.is_project_present(project_name))
        self.global_navigation.sign_out()
Beispiel #2
0
    def test_successful_subject_registration(self):
        """
        Function to test the successful addition of a subject from "My Subjects" page
        with given details e.g. First Name, Last Name, Location, GPS, Mobile Number
        """

        self.driver.go_to(DATA_WINNER_LOGIN_PAGE)
        login_page = LoginPage(self.driver)
        login_page.do_successful_login_with(VALID_CREDENTIALS)
        dashboard_page = DashboardPage(self.driver)

        # going on setup project page
        create_project_page = dashboard_page.navigate_to_create_project_page()
        create_project_page.create_project_with(VALID_PROJECT_DATA)
        create_project_page.continue_create_project()
        project_overview_page = create_project_page.save_and_create_project_successfully(
        )
        self.driver.wait_for_page_with_title(
            15, fetch_(PAGE_TITLE, from_(VALID_PROJECT_DATA)))
        self.assertEqual(self.driver.get_title(),
                         fetch_(PAGE_TITLE, from_(VALID_PROJECT_DATA)))
        project_subject_page = project_overview_page.navigate_to_subjects_page(
        )
        project_subject_registration_page = project_subject_page.click_register_subject(
        )
        project_subject_registration_page.add_subject_with(
            VALID_SUBJECT_REGISTRATION_DATA)
        project_subject_registration_page.submit_subject()
        success_message = project_subject_registration_page.get_flash_message()
        self.assertRegexpMatches(
            success_message,
            fetch_(SUCCESS_MSG, from_(VALID_SUBJECT_REGISTRATION_DATA)))
Beispiel #3
0
    def navigate_to_dashboard_page(self):
        """
        Function to navigate to dashboard page of the website

        Return dashboard page
         """
        self.driver.find(DASHBOARD_PAGE_LINK).click()
        return DashboardPage(self.driver)
Beispiel #4
0
 def create_project(self):
     dashboard_page = DashboardPage(self.driver)
     create_project_page = dashboard_page.navigate_to_create_project_page()
     create_project_page = create_project_page.select_blank_questionnaire_creation_option()
     create_project_page.create_questionnaire_with(VALID_SUMMARY_REPORT_DATA, QUESTIONNAIRE_DATA)
     overview_page = create_project_page.save_and_create_project_successfully()
     questionnaire_code = overview_page.get_questionnaire_code()
     project_name = overview_page.get_project_title()
     return project_name, questionnaire_code
Beispiel #5
0
    def prerequisites_of_create_project(self):
        # doing successful login with valid credentials
        self.driver.go_to(DATA_WINNER_LOGIN_PAGE)
        login_page = LoginPage(self.driver)
        login_page.do_successful_login_with(VALID_CREDENTIALS)
        dashboard_page = DashboardPage(self.driver)

        # going on setup project page
        return dashboard_page.navigate_to_create_project_page()
Beispiel #6
0
    def navigate_to_dashboard_page(self):
        """
        Function to navigate to dashboard page of the website

        Return dashboard page
         """
        self.driver.find(DASHBOARD_PAGE_LINK).click()
        self.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, "Dashboard")
        return DashboardPage(self.driver)
Beispiel #7
0
 def _create_project(cls):
     cls.dashboard_page = DashboardPage(cls.driver)
     create_project_page = cls.dashboard_page.navigate_to_create_project_page(
     )
     create_project_page.create_project_with(WATERPOINT_PROJECT_DATA)
     create_project_page.continue_create_project()
     CreateQuestionnairePage(cls.driver).create_questionnaire_with(
         WATERPOINT_QUESTIONNAIRE_DATA)
     return create_project_page.save_and_create_project_successfully()
 def create_project(self):
     dashboard_page = DashboardPage(self.driver)
     create_project_page = dashboard_page.navigate_to_create_project_page()
     create_project_page.create_project_with(VALID_SUMMARY_REPORT_DATA)
     create_project_page.continue_create_project()
     create_project_page.save_and_create_project()
     overview_page = ProjectOverviewPage(self.driver)
     questionnaire_code = overview_page.get_questionnaire_code()
     project_name = overview_page.get_project_title()
     return project_name, questionnaire_code
Beispiel #9
0
 def _create_project(cls):
     cls.dashboard_page = DashboardPage(cls.driver)
     cls.driver.create_screenshot("debug-ft-before-click-create-qre")
     create_questionnaire_options_page = cls.dashboard_page.navigate_to_create_project_page(
     )
     create_questionnaire_page = create_questionnaire_options_page.select_blank_questionnaire_creation_option(
     )
     create_questionnaire_page.create_questionnaire_with(
         WATERPOINT_PROJECT_DATA, WATERPOINT_QUESTIONNAIRE_DATA)
     return create_questionnaire_page.save_and_create_project_successfully()
    def navigate_to_dashboard_page(self):
        """
        Function to navigate to dashboard page of the website

        Return dashboard page
         """
        self.driver.wait_for_element(UI_TEST_TIMEOUT, DASHBOARD_PAGE_LINK,
                                     True)
        self.driver.find(DASHBOARD_PAGE_LINK).click()
        return DashboardPage(self.driver)
Beispiel #11
0
    def create_project(self):
        self.driver.go_to(DATA_WINNER_DASHBOARD_PAGE)
        dashboard_page = DashboardPage(self.driver)

        create_project_page = dashboard_page.navigate_to_create_project_page()
        create_project_page.create_project_with(VALID_PROJECT_DATA)
        create_project_page.continue_create_project()
        create_questionnaire_page = CreateQuestionnairePage(self.driver)
        self.form_code = create_questionnaire_page.get_questionnaire_code()
        create_questionnaire_page.add_question(QUESTION)
        create_questionnaire_page.save_and_create_project_successfully()
Beispiel #12
0
    def create_project(cls):
        cls.driver.go_to(DATA_WINNER_DASHBOARD_PAGE)
        dashboard_page = DashboardPage(cls.driver)

        questionnaire_creation_options_page = dashboard_page.navigate_to_create_project_page()
        # VALID_PROJECT_DATA[SUBJECT] = cls.subject_type
        create_questionnaire_page = questionnaire_creation_options_page.select_blank_questionnaire_creation_option()
        create_questionnaire_page.create_questionnaire_with(VALID_PROJECT_DATA, QUESTIONNAIRE_DATA)
        cls.form_code = create_questionnaire_page.get_questionnaire_code()
        create_questionnaire_page.save_and_create_project_successfully()
        cls.driver.wait_for_page_with_title(15, fetch_(PAGE_TITLE, from_(VALID_PROJECT_DATA)))
Beispiel #13
0
 def prerequisites_of_create_questionnaire(self, project_data=VALID_DATA2):
     # doing successful login with valid credentials
     self.driver.go_to(DATA_WINNER_LOGIN_PAGE)
     login_page = LoginPage(self.driver)
     login_page.do_successful_login_with(VALID_CREDENTIALS)
     dashboard_page = DashboardPage(self.driver)
     # going on setup project page
     create_project_page = dashboard_page.navigate_to_create_project_page()
     #Navigating to Create Questionnaire Page by successfully creating a Project
     create_project_page.create_project_with(project_data)
     create_project_page.continue_create_project()
     return CreateQuestionnairePage(self.driver)
Beispiel #14
0
 def test_trial_account_should_see_reminder_not_work_message_at_reminder_tab_in_active_project(self):
     email = add_trial_organization_and_login(self.driver)
     createquestionnairepage = DashboardPage(self.driver).navigate_to_create_project_page()\
     .select_blank_questionnaire_creation_option()
     project_page = createquestionnairepage.create_questionnaire_with(COPY_PROJECT_DATA, QUESTIONNAIRE_DATA)\
     .save_and_create_project_successfully()
     project_title = project_page.get_project_title()
     self.driver.go_to(LOGOUT)
     reminder_settings = self.go_to_reminder_page(project_title, {USERNAME: email, PASSWORD: REGISTRATION_PASSWORD})
     self.assertEqual(DISABLED_REMINDER[WARNING_MESSAGE], reminder_settings.get_warning_message())
     reminder_settings.click_sent_reminder_tab()
     self.assertEqual(fetch_(WARNING_MESSAGE, from_(DISABLED_REMINDER)), reminder_settings.get_warning_message())
Beispiel #15
0
 def _create_project(self, project_data, monthly):
     self.driver.go_to(DATA_WINNER_DASHBOARD_PAGE)
     self.dashboard_page = DashboardPage(self.driver)
     create_project_page = self.dashboard_page.navigate_to_create_project_page(
     )
     create_project_page.create_project_with(project_data)
     create_project_page.continue_create_project()
     if monthly:
         create_questionnaire_page = CreateQuestionnairePage(self.driver)
         create_questionnaire_page.select_question_link(2)
         create_questionnaire_page.change_date_type_question(
             date_format=MM_YYYY)
     create_project_page.save_and_create_project_successfully()
Beispiel #16
0
    def create_project(cls):
        cls.driver.go_to(DATA_WINNER_DASHBOARD_PAGE)
        dashboard_page = DashboardPage(cls.driver)

        create_project_page = dashboard_page.navigate_to_create_project_page()
        VALID_PROJECT_DATA[SUBJECT] = cls.subject_type
        create_project_page.create_project_with(VALID_PROJECT_DATA)
        create_project_page.continue_create_project()
        create_questionnaire_page = CreateQuestionnairePage(cls.driver)
        cls.form_code = create_questionnaire_page.get_questionnaire_code()
        create_questionnaire_page.add_question(QUESTION)
        create_questionnaire_page.save_and_create_project_successfully()
        cls.driver.wait_for_page_with_title(
            15, fetch_(PAGE_TITLE, from_(VALID_PROJECT_DATA)))
Beispiel #17
0
    def do_successful_login_with(self, login_credential):
        """
        Function to login into the website with valid credentials

        Args:
        'login_credential' is valid login credentials of the user

        Return DashboardPage on successful login
        """
        self.driver.find_text_box(EMAIL_TB).enter_text(
            fetch_(USERNAME, from_(login_credential)))
        self.driver.find_text_box(PASSWORD_TB).enter_text(
            fetch_(PASSWORD, from_(login_credential)))
        self.driver.find(LOGIN_BTN).click()
        return DashboardPage(self.driver)
Beispiel #18
0
    def navigate_to_dashboard_page(self):
        """
        Function to navigate to dashboard page of the website

        Return dashboard page
         """
        self.driver.wait_for_element(UI_TEST_TIMEOUT, DASHBOARD_PAGE_LINK,
                                     True)
        self.driver.find(DASHBOARD_PAGE_LINK).click()
        try:
            self.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, "Dashboard")
        except Exception as e:
            self.driver.create_screenshot(
                "debug-ft-navigate-to-dashboard-fails")
            raise e
        return DashboardPage(self.driver)
 def login(self, credential=VALID_CREDENTIALS):
     # doing successful login with valid credentials
     self.driver.go_to(DATA_WINNER_LOGIN_PAGE)
     login_page = LoginPage(self.driver)
     login_page.do_successful_login_with(credential)
     return DashboardPage(self.driver)
 def goto_dashboard(self):
     self.driver.go_to(url("/dashboard/"))
     return DashboardPage(self.driver)
Beispiel #21
0
 def login_with(self, credential):
     self.driver.go_to(DATA_WINNER_LOGIN_PAGE)
     login_page = LoginPage(self.driver)
     login_page.do_successful_login_with(credential)
     return DashboardPage(self.driver)