Beispiel #1
0
    def test_registered_user_payment_succeeds(self):
        print(" + test_registered_user_payment_succeeds \n".upper())

        data = perform_registration(self.driver)
        perform_login(self.driver, data['username'])
        self.driver.find_element_by_xpath(TRY_FREE_XPATH).click()
        send_card_details(self.driver)
        wait = WebDriverWait(self.driver, 30)
        try:
            wait.until(
                EC.presence_of_element_located(
                    (By.XPATH, "//div[@class='alert alert-success']")))
            with self.subTest(name="test_user_roles_changes_role_on_payment"):
                print(" + test_user_roles_changes_role_on_payment \n".upper())

                self.driver.get(self.url)

                try:
                    cli = self.driver.find_element_by_xpath(
                        "//div[@class='col-md-3 col-sm-4 col-xs-12'][2]/ul/li[1]/a"
                    )
                    self.driver.execute_script("arguments[0].click();", cli)
                    self.assertNotIn(
                        "No Access",
                        self.driver.find_elements_by_xpath(
                            "//div[@class='level-right']"))
                except NoSuchElementException as e:
                    raise AssertionError(
                        "Could not navigate to course: \n {}".format(e))

        except Exception as e:
            print(e)
            raise AssertionError("Payment did not succeed")
Beispiel #2
0
    def test_authenticated_user_senior_level_placement_form_zero_experience_redirects_to_entry_level_application(
            self):
        print(
            " + test_authenticated_user_senior_level_placement_form_zero_experience_redirects_to_entry_level_application \n"
            .upper())

        try:
            d = perform_registration(self.driver)
            perform_login(self.driver, d['username'])
            self.driver.find_element_by_link_text(
                "Job Placement Program").click()
            self.driver.find_element_by_xpath(GET_STARTED_SENOIR_XPATH).click()
            self.driver.find_element_by_xpath(
                '//*[@id="id_education"]').send_keys(
                    parser.get('jp_s', 'id_education'))
            self.driver.find_element_by_xpath(
                '//*[@id="id_resume"]').send_keys(BASE_DIR + docpath)
            self.driver.find_element_by_xpath(
                '//*[@id="id_career"]').send_keys(
                    parser.get('jp_s', 'id_career'))
            # self.driver.find_element_by_xpath('//*[@id="id_certificates"]').send_keys(
            #     BASE_DIR + "\documents\\test_resume.pdf")[2:]
            # )
            self.driver.find_element_by_xpath(
                '//*[@id="id_is_certified"]').send_keys(
                    parser.get('jp_e', 'id_is_certified'))
            self.driver.find_element_by_xpath(
                '//*[@id="app"]/div[11]/input').click()
            self.assertIn(
                "not meet",
                self.driver.find_element_by_xpath(
                    "//*[@class='alert alert-danger']").text.lower())
        except Exception as e:
            print(e)
            raise AssertionError("Test failed")
Beispiel #3
0
 def test_authenticated_user_subscription_success(self):
     d = perform_registration(self.driver)
     perform_login(self.driver, d['username'])
     self.driver.find_element_by_link_text("Projects").click()
     x = self.driver.find_elements_by_xpath(PROJECT_XPATH)
     # self.driver.find_elements_by_xpath(PROJECT_XPATH).click()
     x[-1].click()
     self.driver.find_element_by_link_text("Start Project").click()
     try:
         # self.driver.find_element_by_xpath("//button[@class='stripe-button-el']/span")
         send_card_details(self.driver)
         wait = WebDriverWait(self.driver, 20)
         wait.until(
             EC.presence_of_element_located(
                 (By.XPATH, "//div[@class='alert alert-success']")))
         self.assertEqual(
             "Congratulations, you have successfully subscribed for our Standard Plan package.",
             self.driver.find_element_by_xpath(
                 "//div[@class='alert alert-success']").text)
         # todo on subscription, return to the item paid for
         with self.subTest(
                 name=
                 "test_authenticated_user_redirect_on_subscription_success"
         ):
             pass
     except:
         raise AssertionError("Failed")
Beispiel #4
0
    def test_authenticated_user_can_submit_job_junior_level_placement_form_no_certificate(
            self):
        print(
            " + test_authenticated_user_can_submit_job_junior_level_placement_form_no_certificate \n"
            .upper())

        self.driver.find_element_by_xpath(GET_STARTED_ENTRY_XPATH).click()
        data = perform_registration(self.driver, True)
        perform_login(self.driver, data['username'])
        # todo check the title instead
        try:
            # todo fix redirection to page
            self.driver.find_element_by_link_text(
                "Job Placement Program").click()
            self.driver.find_element_by_xpath(GET_STARTED_ENTRY_XPATH).click()
            self.driver.find_element_by_xpath(
                '//*[@id="id_education"]').send_keys(
                    parser.get('jp_e', 'id_education'))
            self.driver.find_element_by_xpath(
                '//*[@id="id_resume"]').send_keys(BASE_DIR + docpath)
            self.driver.find_element_by_xpath(
                '//*[@id="id_career"]').send_keys(
                    parser.get('jp_e', 'id_career'))
            self.driver.find_element_by_xpath(
                '//*[@id="id_is_certified"]').send_keys(
                    parser.get('jp_e', 'id_is_certified'))
            self.driver.find_element_by_xpath(
                '//*[@id="app"]/div[11]/input').click()
            with self.subTest(
                    name=
                    "test_entry_level_applicant_with_no_certificate_redirected_to_the_certification_page"
            ):
                print(
                    " + test_entry_level_applicant_with_no_certificate_redirected_to_the_certification_page \n"
                    .upper())

                text = ""
                try:
                    text = self.driver.find_element_by_tag_name(
                        "h2").text.lower()
                except NoSuchElementException:
                    pass
                    # raise AssertionError("Not taken to certification page")
                self.assertIn("not met", text)

            # todo fix mail sending.
            # with self.subTest(name="test_notification_email_is_sent_on_success"):
            #     self.assertIn("PLACEMENT",
            #                   get_mail_content(*data['email'].split("@")))

        except Exception as e:
            raise AssertionError("Form not submitted")
Beispiel #5
0
    def test_guest_user_is_directed_to_senoir_placement_page_on_authentication(
            self):
        print(
            " + test_guest_user_is_directed_to_senoir_placement_page_on_authentication \n"
            .upper())

        self.driver.find_element_by_xpath(GET_STARTED_SENOIR_XPATH).click()
        data = perform_registration(self.driver, True)
        perform_login(self.driver, data['username'])
        # todo check the title instead
        try:
            # todo fix redirection to page
            self.driver.find_element_by_xpath(FORM_HEADER_XPATH)
            self.assertIn("Application Form",
                          self.driver.find_element_by_xpath(FORM_HEADER_XPATH))
        except NoSuchElementException:
            raise AssertionError("Not directed to placement form")
Beispiel #6
0
    def test_aurhenticated_user_on_click_entry_level_terms_and_condition_page_is_displayed(
            self):
        print(
            " + test_aurhenticated_user_on_click_entry_level_terms_and_condition_page_is_displayed \n"
            .upper())
        d = perform_registration(self.driver)
        perform_login(self.driver, d['username'])
        self.driver.find_element_by_link_text("Work Experience").click()
        self.driver.find_element_by_xpath(ENTRY_LEVEL_XPATH).click()
        # todo Figure out if uest should see terms and confitions
        try:
            self.assertTrue(self.driver.find_element_by_link_text("I AGREE"))
            with self.subTest(
                    name="test_terms_and_condition_entry_leads_to_payment_page"
            ):
                self.driver.find_element_by_link_text("I AGREE").click()
                self.assertIn("Pay", self.driver.title)

        except NoSuchElementException:
            raise AssertionError("Agreement page not reached")
Beispiel #7
0
    def test_payment_succeeds_for_professional__level(self):
        print(" + test_payment_succeeds_for_professional__level \n".upper())
        d = perform_registration(self.driver)
        perform_login(self.driver, d['username'])
        self.driver.find_element_by_link_text("Work Experience").click()
        self.driver.find_element_by_xpath(PROFESSIONAL_LEVEL_XPATH).click()
        c = self.driver.find_element_by_link_text("I AGREE")
        self.driver.execute_script("arguments[0].click();", c)
        send_card_details(
            self.driver,
            "//form[@id='stripejsfilemain']/button[@class='stripe-button-el']")
        wait = WebDriverWait(self.driver, 10)
        try:
            wait.until(EC.presence_of_element_located((By.XPATH, REQ_XPATH)))
            with self.subTest(
                    name=
                    "test_authenticated_user_can_access_contract_page_on_professional_payment"
            ):
                print(
                    " + test_authenticated_user_can_access_contract_page_on_professional_payment \n"
                    .upper())

                self.driver.find_element_by_xpath(PROCEED_XPATH).click()
                self.assertIn(
                    "Income Share Agreement",
                    self.driver.find_element_by_xpath(
                        "//div[@class='el-card__body']/div[@class='row'][2]/div[@class='col-lg-12']/h4"
                    ).text)

            with self.subTest(
                    name="test_user_is_forced_to_fill_unfilled_form_on_login"):
                print(
                    " + test_user_is_forced_to_fill_unfilled_form_on_login \n".
                    upper())

                self.driver.get(self.url.rstrip('/') + "/logout")
                self.driver.get(self.url)
                perform_login(self.driver, d['username'])
                self.assertIn(
                    "Work Experience",
                    self.driver.find_element_by_xpath(
                        "//h2[@class='title-4']").text)
            with self.subTest(name="test_profile_form_fill_success"):
                print(" + test_profile_form_fill_success \n".upper())

                self.driver.find_element_by_name('types').send_keys(
                    parser.get("we", 'types'))
                self.driver.find_element_by_name('current_position').send_keys(
                    parser.get("we", 'current_position'))
                self.driver.find_element_by_name('state').send_keys(
                    parser.get("we", 'state'))
                self.driver.find_element_by_name('income').send_keys(
                    parser.get("we", 'income'))
                self.driver.find_element_by_name('date').send_keys(
                    parser.get("we", 'date'))
                self.driver.find_element_by_xpath(
                    "//*[@type='submit']").click()
                try:
                    wait.until(
                        EC.visibility_of_element_located((
                            By.XPATH,
                            "//div[@class='jobtype'][1]/p[@class='jobtypeh'][1]"
                        )))
                except:
                    raise AssertionError("Form submit failed")
            # todo fix mail notification not sending
            with self.subTest(
                    name=
                    "test_notification_is_sent__professional_successful_payment"
            ):
                print(
                    " + test_notification_is_sent__professional_successful_payment \n"
                    .upper())

                try:
                    self.assertIn("EXPERIENCE",
                                  get_mail_content(*d['email'].split("@")))
                except NoSuchElementException:
                    raise AssertionError("Mail not sent")

        except Exception as e:
            print(e)
            raise AssertionError("Failed")
Beispiel #8
0
 def test_user_login_opens_the_current_course(self):
     d = perform_registration(self.driver)
     perform_login(self.driver, d['username'])
Beispiel #9
0
    def test_authenticated_user_can_submit_job_senoir_level_placement_form(
            self):
        print(
            " + test_authenticated_user_can_submit_job_senoir_level_placement_form \n"
            .upper())

        self.driver.find_element_by_xpath(GET_STARTED_SENOIR_XPATH).click()
        data = perform_registration(self.driver, True)
        perform_login(self.driver, data['username'])
        # todo check the title instead
        try:
            # todo fix redirection to page
            self.driver.find_element_by_link_text(
                "Job Placement Program").click()
            self.driver.find_element_by_xpath(GET_STARTED_SENOIR_XPATH).click()
            self.driver.find_element_by_xpath(
                '//*[@id="id_education"]').send_keys(
                    parser.get('jp_s', 'id_education'))
            self.driver.find_element_by_xpath(
                '//*[@id="id_resume"]').send_keys(BASE_DIR + docpath)

            self.driver.find_element_by_xpath(
                '//*[@id="id_career"]').send_keys(
                    parser.get('jp_s', 'id_career'))
            self.driver.find_element_by_xpath(
                '//*[@id="id_experience"]').send_keys(
                    parser.get('jp_s', 'id_experience'))
            self.driver.find_element_by_xpath(
                '//*[@id="id_certificates"]').send_keys(BASE_DIR + docpath)
            self.driver.find_element_by_xpath(
                '//*[@id="id_is_certified"]').send_keys(
                    parser.get('jp_s', 'id_is_certified'))
            self.driver.find_element_by_xpath(
                '//*[@id="app"]/div[11]/input').click()

            with self.subTest(
                    name=
                    "test_senoir_level_applicant_with_certificate_not_redirected_to_the_certification_page"
            ):
                print(
                    " + test_senoir_level_applicant_with_certificate_not_redirected_to_the_certification_page \n"
                    .upper())

                text = ""
                try:
                    text = self.driver.find_element_by_tag_name(
                        "h2").text.lower()
                except NoSuchElementException as e:
                    print(e)
                    raise AssertionError("Error")
                self.assertIn("requirements met", text)

            with self.subTest(
                    name="test_proceed_on_senoir_leads_to_agreement"):
                print(
                    " + test_proceed_on_senoir_leads_to_agreement \n".upper())

                self.driver.find_element_by_link_text("Proceed").click()
                self.assertIn("leif", self.driver.title.lower())

            # todo fix mail sending.
            with self.subTest(
                    name="test_notification_email_is_sent_on_success"):
                print(
                    " + test_notification_email_is_sent_on_success \n".upper())

                self.assertIn("AGREEMENT",
                              get_mail_content(*data['email'].split("@")))

        except Exception as e:
            print(e)
            raise AssertionError("Form not submitted")