def save_and_create_project_successfully(self, click_ok=True): self.driver.find(SAVE_AND_CREATE_BTN).click() self.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, "Questionnaires - Overview") if click_ok: self.got_redistribute_questionnaire_message() return ProjectOverviewPage(self.driver)
def _create_project(cls, project_data, questionnaire_data): global_navigation = GlobalNavigationPage(cls.driver) dashboard_page = global_navigation.navigate_to_dashboard_page() create_questionnaire_options_page = dashboard_page.navigate_to_create_project_page( ) cls.create_questionnaire_page = create_questionnaire_options_page.select_blank_questionnaire_creation_option( ) cls.create_questionnaire_page.create_questionnaire_with( project_data, questionnaire_data) questionnaire_code = cls.create_questionnaire_page.get_questionnaire_code( ) overview_page = cls.create_questionnaire_page.save_and_create_project_successfully( ) reminder_setting_page = ProjectOverviewPage( cls.driver).navigate_to_reminder_page() reminder_setting_page.set_frequency("Week") reminder_setting_page.set_week_day("Friday") reminder_setting_page.enable_before_deadline_reminder() reminder_setting_page.save_reminders() cls.driver.wait_for_element(UI_TEST_TIMEOUT, by_css('.success-message-box'), want_visible=True) automatic_reply_sms_page = reminder_setting_page.navigate_to_automatic_reply_sms_page( ) automatic_reply_sms_page.turn_off_reply_messages() cls.questionnaire_tab_page = overview_page.navigate_to_questionnaire_tab( ) cls.driver.wait_for_page_with_title(UI_TEST_TIMEOUT, 'Questionnaire') return overview_page.get_project_title(), questionnaire_code
def submit_data(cls): overview_page = ProjectOverviewPage(cls.driver) data_page = overview_page.navigate_to_data_page() web_submission_tab = data_page.navigate_to_web_submission_tab() [ web_submission_tab.fill_and_submit_answer(answer) for answer in VALID_ANSWERS ]
def create_new_project(cls): dashboard = cls.global_navigation_page.navigate_to_dashboard_page() questionnaire_creation_options_page = dashboard.navigate_to_create_project_page() create_questionnaire_page = questionnaire_creation_options_page.select_blank_questionnaire_creation_option() create_questionnaire_page.create_questionnaire_with(NEW_PROJECT_DATA, QUESTIONNAIRE_DATA) create_questionnaire_page.save_and_create_project_successfully() cls.driver.wait_for_page_with_title(5, 'Questionnaires - Overview') return ProjectOverviewPage(cls.driver).get_project_title()
def expect_redistribute_dialog_to_be_shown(self, create_questionnaire_page): create_questionnaire_page.save_and_create_project(click_ok=False) warning_dialog = WarningDialog(self.driver) message = warning_dialog.get_message() self.assertEqual(message, REDISTRIBUTE_QUESTIONNAIRE_MSG) warning_dialog.confirm() self.driver.wait_for_page_with_title(20, 'Projects - Overview') return ProjectOverviewPage(self.driver)
def navigate_to_project_page(self, project_name): """ Function to navigate to specific project overview page Return project overview page """ project_link = by_xpath(PROJECT_LINK_XPATH % project_name.lower()) self.driver.find(project_link).click() return ProjectOverviewPage(self.driver)
def register_data_sender(self): project_overview_page = ProjectOverviewPage(self.driver) project_datasenders_page = project_overview_page.navigate_to_datasenders_page( ) add_data_sender_page = project_datasenders_page.navigate_to_add_a_data_sender_page( ) add_data_sender_page.enter_data_sender_details_from( VALID_DATA_FOR_ADDING_DATASENDER) self.driver.wait_until_modal_dismissed()
def activate_project(self): """ Function to activate the project Return ProjectOverviewPage """ self.driver.find(ACTIVATE_BTN).click() from pages.projectoverviewpage.project_overview_page import ProjectOverviewPage return ProjectOverviewPage(self.driver)
def navigate_to_project_overview_page(self): """ Function to navigate to project overview page of the website Return project_overview_page """ self.driver.find(GO_TO_PROJECT_OVERVIEW_BTN).click() from pages.projectoverviewpage.project_overview_page import ProjectOverviewPage return ProjectOverviewPage(self.driver)
def navigate_to_project_overview_page(self, project_name): """ Function to navigate to specific project overview page Return project overview page """ project_link = by_xpath(PROJECT_LINK_XPATH % project_name) self.driver.wait_for_element(UI_TEST_TIMEOUT, project_link, True) self.driver.find(project_link).click() return ProjectOverviewPage(self.driver)
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
def create_new_project(self, new_project_data, questionnaire_data): dashboard = self.global_navigation_page.navigate_to_dashboard_page() questionnaire_creation_options_page = dashboard.navigate_to_create_project_page( ) create_questionnaire_page = questionnaire_creation_options_page.select_blank_questionnaire_creation_option( ) create_questionnaire_page.create_questionnaire_with( new_project_data, questionnaire_data) create_questionnaire_page.save_and_create_project_successfully() self.driver.wait_for_page_with_title(5, 'Questionnaires - Overview') return ProjectOverviewPage(self.driver)
def create_a_project_and_navigate_to_activity_log_page(self): dashboard = self.login() create_project_page = dashboard.navigate_to_create_project_page() create_project_page.create_project_with(VALID_DATA) create_project_page.continue_create_project() create_project_page.save_and_create_project_successfully() self.driver.wait_for_page_with_title( 15, VALID_DATA.get(PROJECT_OVERVIEW_PAGE_TITLE)) overview_page = ProjectOverviewPage(self.driver) self.project_title = overview_page.get_project_title() return self.navigate_to_activity_log_page()
def _create_project(cls, project_data, questionnaire_data): global_navigation = GlobalNavigationPage(cls.driver) dashboard_page = global_navigation.navigate_to_dashboard_page() create_questionnaire_options_page = dashboard_page.navigate_to_create_project_page() cls.create_questionnaire_page = create_questionnaire_options_page.select_blank_questionnaire_creation_option() cls.create_questionnaire_page.create_questionnaire_with(project_data, questionnaire_data) questionnaire_code = cls.create_questionnaire_page.get_questionnaire_code() cls.create_questionnaire_page.set_questionnaire_language("French") overview_page = cls.create_questionnaire_page.save_and_create_project_successfully() reminder_setting_page = ProjectOverviewPage(cls.driver).navigate_to_reminder_page()\ .click_reminder_settings_tab() reminder_setting_page.set_frequency("Week") reminder_setting_page.set_deadline_type_for_week("Same week") reminder_setting_page.set_week_day("Friday") reminder_setting_page.enable_before_deadline_reminder() reminder_setting_page.save_reminders() cls.questionnaire_tab_page = overview_page.navigate_to_questionnaire_tab() return overview_page.get_project_title(), questionnaire_code
def save_and_create_project_successfully(self, click_ok=True): self.driver.find(SAVE_AND_CREATE_BTN).click() time.sleep(3) if click_ok: self.got_redistribute_questionnaire_message() return ProjectOverviewPage(self.driver)
def navigate_to_my_data_senders_page(self, project_name): self.driver.find( by_xpath("//a[@class='project-id-class' and text()='%s']" % project_name)).click() return ProjectOverviewPage(self.driver).navigate_to_datasenders_page()
def _get_project_details(self): overview_page = ProjectOverviewPage(self.driver) return overview_page.get_project_title( ), overview_page.get_questionnaire_code()
def activate_project(cls): overview_page = ProjectOverviewPage(cls.driver) overview_page.activate_project()