Exemplo n.º 1
0
 def config(self, database):
     config_database = {}
     config_database['host'] = Util.getConfig(self.config_file, database, 'host')
     config_database['port'] = Util.getConfig(self.config_file, database, 'port')
     config_database['user'] = Util.getConfig(self.config_file, database, 'user')
     config_database['password'] = Util.getConfig(self.config_file, database, 'password')
     config_database['db'] = Util.getConfig(self.config_file, database, 'db')
     return config_database
Exemplo n.º 2
0
    def __init__(self, driver):
        """
        Inits BasePage class

        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()
Exemplo n.º 3
0
    def __init__(self, driver):
        """
        Inits BasePage class

        Returns:
            None
        """
        super(BasePage,
              self).__init__(driver)  # sends driver instance to BasePage class
        self.driver = driver
        self.util = Util()
 def __init__(self, driver):
     self.driver = driver
     self.timeout = 5
     self.wait = WebDriverWait(self.driver, self.timeout)
     self.locDict = {
         'id': By.ID,
         'link text': By.LINK_TEXT,
         'partial link text': By.PARTIAL_LINK_TEXT,
         'css': By.CSS_SELECTOR
     }
     self.util = Util()
Exemplo n.º 5
0
 def __init__(self, driver):
     """
     Inits BasePage class
     Returns:
         None
     """
     super(BasePage, self).__init__(driver)
     self.driver = driver
     self.util = Util()
     self.stat = Status(driver)
     self.nav = Navigation(driver)
Exemplo n.º 6
0
class LoginPage(BasePage):

    log = cl.customLogger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.nav = NavigationPage(driver)
        self.util = Util()

    #locators
    _adm_login_locators1 = "//li/a[@href='#']"
    _adm_login_locators2 = "//img[@class='brand-img']"
    _adm_login_locators3 = "//img[@ng-if='current.user.avatar']"
    _adm_login_locators4 = "//a[@kp-icon-svg='attention']"
    _adm_login_locators5 = "//a[@kp-icon-svg='globe']"
    _adm_login_locators6 = "//div[@class='btn btn-default navbar-btn dropdown-toggle']"
    _username_field = "//input[contains(@class, 'login-name')]"
    _password_field = "//input[contains(@class, 'login-password')]"
    _login_btn = "//input[@type='submit']"
    _logout_btn = "//a[@ng-click='logout()']"

    def enterEmail(self, email):
        self.elementClear(self._username_field)
        self.sendKeys(email, self._username_field)

    def enterPassword(self, password):
        self.elementClear(self._password_field)
        self.sendKeys(password, self._password_field)

    def clickLoginBtn(self):
        self.elementClick(self._login_btn)

    def login(self, email="", password=""):
        self.enterEmail(email)
        self.enterPassword(password)
        self.clickLoginBtn()
        self.util.sleep(2)

    def logout(self):
        self.nav.openUserSettings()
        self.elementClick(self._logout_btn)

    def verifyAdmLogin(self):
        res1 = self.elementPresenceCheck(self._adm_login_locators1)
        res2 = self.elementPresenceCheck(self._adm_login_locators2)
        res3 = self.elementPresenceCheck(self._adm_login_locators3)
        res4 = self.elementPresenceCheck(self._adm_login_locators4)
        res5 = self.elementPresenceCheck(self._adm_login_locators5)
        res6 = self.elementPresenceCheck(self._adm_login_locators6)
        if res1 and res2 and res3 and res4 and res5 and res6 == True:
            return True
Exemplo n.º 7
0
    def get_cursor_angle(self, gameengine, character):
        playerLocation = gameengine.camera.apply(character).center
        mousePosition = pygame.mouse.get_pos()

        angle, flip = Util.get_rotate_angle(playerLocation, mousePosition)

        return (angle, flip)
Exemplo n.º 8
0
class Basepage(SeleniumDriver):
    log = customLogger(logLevel=logging.DEBUG)

    def __init__(self, driver):
        """
        Base page inherites from the selenium driver which takes care of all the operations related to selenium driver
        So further we can just inherit this Base page into all our prages so we can have both the functionality
        :param driver:
        """
        super().__init__(driver)
        self.driver = driver
        self.util = Util()  # Creation of util object inorder to use utility functions anywhere in classes which is extending this class ex:any pages class

    def verifyPageTitle(self, textToVerify):
        """
        Verify the title of the webpage

        :param textToVerify:Title on the page that needs to be verified
        :return:boolean
        """
        try:
            actualTitle = self.getTitle()
            return self.util.verifyTextContains(actualTitle, textToVerify)
        except:
            self.log.error("Failed to get the page title")
            traceback.print_exc()
            return False
Exemplo n.º 9
0
 def get_cursor_angle(self, gameengine, character):
     playerLocation = gameengine.camera.apply(character).center
     mousePosition = pygame.mouse.get_pos();
     
     angle,flip = Util.get_rotate_angle(playerLocation, mousePosition)
     
     return (angle, flip)
Exemplo n.º 10
0
class BasePage(SeleniumDriver):
    def __init__(self, driver):
        """
        Inits BasePage class

        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verifyPageTitle(self, titleToVerify):
        """
        Verify the page Title

        Parameters:
            titleToVerify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.getTitle()
            return self.util.verifyTextContains(actualTitle, titleToVerify)
        except:
            self.log.error("Failed to get page title")
            print_stack()
            return False
Exemplo n.º 11
0
def test_image():
    """
    '/api/uploadtest' POST endpoint to send image and Multipart data form request content
    for the TensorFlow graph to analize.
    """
    if 'image' not in request.files:
        return jsonify({'error': 'Image file not sent'}), 400

    file = request.files['image']

    if file and Util.allowed_file(file.filename):

        classifier = ImageClassifier(Util.decode_to_opencv(file))
        return jsonify(classifier.getImageScore())

    return jsonify({'error': 'Unsupported file extension'}), 400
 def classSetup(self, getWebdriver):
     log = cl.customLogger(logging.DEBUG)
     self.loginPage = LoginPage(self.driver)
     self.mainPage = MainMenuPage(self.driver)
     self.registerPage = RegistrationPage(self.driver)
     self.util = Util()
     self.testStatus = TestStatus(self.driver)
Exemplo n.º 13
0
class BasePage(SeleniumDriver):
    def __init__(self, driver):
        """
        Inits BasePage class
        Returns:
            None
        :param driver:
        """

        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verify_page_title(self, title_to_verify):
        """
        Verify page title

        :param title_to_verify: Title on the page that needs to be verified
        :return: True or False
        """
        try:
            actual_title = self.get_title()
            return self.util.verify_text_contains(actual_title,
                                                  title_to_verify)
        except:
            self.log.error('Failed to get page title')
            print_stack()
            return False
Exemplo n.º 14
0
class BasePage(SeleniumDriver):

    # this is a constructor
    def __init__(self, driver):
        """
        Inits BasePage class

        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        # instance of util class
        self.util = Util()

    def verifyPageTitle(self, titleToVerify):
        """
        Verify the page Title
        .getTtitle() method is coming from Sel_driver class
        this method is getting the title for you and assertiing
        if the title matches the titletoverify
        Parameters:
            titleToVerify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.getTitle()
            return self.util.verifyTextContains(actualTitle, titleToVerify)
        except:
            self.log.error("Failed to get page title")
            self.screenShot()
            print_stack()
            return False
Exemplo n.º 15
0
class BasePage(PageElements):
    def __init__(self, driver):
        """
        Inits BasePage class

        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verifyPageTitle(self, titleToVerify):
        """
        Verify the page Title

        Parameters:
            titleToVerify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.getPageTitle()
            return self.util.verifyTextContains(actualTitle, titleToVerify)
        except:
            self.log.error("EXCEPTION: Actual and Expected Page Title Differ")
            #print_stack()
            return False
 def classSetup(self, getWebdriver):
     log = cl.customLogger(logging.DEBUG)
     self.loginPage = LoginPage(self.driver)
     self.basePage = BasePage(self.driver)
     self.mainMenu = MainMenuPage(self.driver)
     self.util = Util()
     self.testStatus = TestStatus(self.driver)
    def __init__(self):
        """
        Inits CheckPoint class

        Required Parameters:
            None

        Optional Parameters:
            None

        Returns:
            None
        """
        super(CheckPoint, self).__init__()
        self.statusMap = {}
        self.util = Util()
        self.log = cl.customLogger()
class VATRegistrationDetailsWindows(BasePage):
    log = cl.custom_logger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.util = Util()

    # LOCATORS
    _help_link = "Help"  # LINK_TEXT
    _personalize_link = "Personalize"  # LINK_TEXT
    _find_link = "Find"  # LINK_TEXT
    _country = "VNDR_VAT_RGSTRN_COUNTRY$0"
    _vat_registration_id = "VNDR_VAT_RGSTRN_VAT_RGSTRN_ID$0"
    _ok_button = "#ICSave"
    _cancel_button = "#ICCancel"

    def enter_country(self):
        self.sendkeys(("LUX", Keys.TAB), self._country)
        self.util.sleep(2, "the Country to be recognized by the app.")

    def enter_vat_registration_id(self):
        random_number = randint(100000000000000, 999999999999999)
        self.sendkeys(random_number, self._vat_registration_id)
        self.util.sleep(
            2,
            "the VAT Registration ID, {}, to be recognized by the application."
            .format(random_number))

    def click_save_button(self):
        self.element_click(self._ok_button)

        wait = WebDriverWait(self.driver, 10, poll_frequency=1)
        wait.until(ec.visibility_of_element_located((By.ID, "ptifrmtgtframe")))

        try:
            self.driver.switch_to.frame("ptifrmtgtframe")
        except Exception as e:
            print(e)

    """ METHOD CALLED FROM IDENTIFYING INFO PAGE """

    def enter_vat_registration_details(self):
        self.enter_country()
        self.enter_vat_registration_id()
        self.click_save_button()
Exemplo n.º 19
0
    def __init__(self, driver):
        """
        Inits BasePage class

        Required Parameters:
            driver: WebDriver Object

        Optional Parameters:
            None

        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self._validate_page(driver)
        self.driver = driver
        self.util = Util()
        self.bkend = BEConnection()
Exemplo n.º 20
0
class BasePage(SeleniumDriver):
    def __init__(self, driver):
        """
        Inits BasePage class

        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verify_page_title(self, title_to_verify):
        """
        Verify the page Title

        Parameters:
            title_to_verify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.get_title()
            return self.util.verifyTextContains(actualTitle, title_to_verify)
        except:
            self.log.error("Failed to get page title")
            print_stack()
            return False

    def verify_text(self, locator, locator_type, text_to_verify):
        """
        Verify the text

        Parameters:
        titleToVerify: Text on the page that needs to be verified
        """
        try:
            actual_text = self.get_text(locator, locator_type)
            return self.util.verifyTextMatch(actual_text, text_to_verify)
        except:
            self.log.info("Failed to get the text")
            print_stack()
            return False

    def modify_result(self, expected_result, actual_result):
        return self.util.verifyTestResult(expected_result, actual_result)
 def __init__(self, driver):
     super().__init__(driver)
     self.deal = DealList(self.driver)
     self.dealdetail = DealDetailScreenPages(self.driver)
     self.unrelease = UnReleasePages(self.driver)
     self.release = ReleasePage(self.driver)
     self.broker = BrokerPages(self.driver)
     self.landlord = LandlordPages(self.driver)
     self.ut = Util()
     self.driver = driver
class ApiClient(requests.Session):
    log = cl.customLogger()

    def __init__(self, api_name):
        super(ApiClient, self).__init__()
        self.hooks['response'].append(self.log_details)
        self.url = ''
        self.util = Util()

    def log_details(self, response, *args, **kwargs):
        self.log.info("Request {}: {}".format(response.request.method,
                                              response.request.url))
        self.log.info("Request Headers: {}".format(response.request.headers))
        if response.request.body is not None:
            self.log.info("Request Body: {}".format(response.request.body))

        self.log.info("Response Status: {}, elapsed: {}s".format(
            response.status_code, response.elapsed.total_seconds()))
        self.log.info("Response Headers: {}".format(response.headers))
        if response.text != "":
            self.log.info("Response Body: {}".format(response.text))

        self.url = 'https://jsonplaceholder.typicode.com/users'

    def read_all(self):
        self.log.info("READ ALL request")
        return self.get(self.url)

    def read(self, _id):
        self.log.info("READ request")
        return self.get(self.url + '/' + str(_id))

    def create(self, _new_data):
        self.log.info("CREATE request")
        return self.post(self.url, json=_new_data)

    def update(self, _id, _updated_data):
        self.log.info("UPDATE request")
        return self.put(self.url + '/' + str(_id), _updated_data)

    def remove(self, _id):
        self.log.info("DELETE request")
        return self.delete(self.url + '/' + str(_id))

    def verifyStatusCode(self, actualStatusCode, expectedStatusCode):
        try:
            return self.util.verifyNumbersMatch(actualStatusCode,
                                                expectedStatusCode)
        except:
            self.log.error("Failed to get status code")
            print_stack()
            return False

    def validateJsonResponseVsSchema(self, jsonResponce, schema={}):
        return jsonschema.Draft3Validator(schema).is_valid(jsonResponce)
Exemplo n.º 23
0
class BasePage(SeleniumDriver):

    def __init__(self, driver):
        """
        Inits BasePage class
        Returns:
            None
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verifyPageTitle(self, titleToVerify):
        """
        Verify the page Title
        Parameters:
            titleToVerify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.getTitle()
            return self.util.verifyTextContains(actualTitle, titleToVerify)
        except:
            self.log.error("Failed to get page title")
            print_stack()
            return False

    def verifyPageURL(self, expectedURL):
        currentURL = self.driver.current_url
        self.log.info("expectedURL ( " + expectedURL + " ) VS currentURL ( " + currentURL + " )")
        return currentURL == expectedURL

    def verifyPageURLlow(self, expectedURL):
        currentURL1 = self.driver.current_url
        a1 = currentURL1.split('//')[0]
        a2 = currentURL1.split('//')[1]
        b1 = a2.split('/')[0]
        currentURL = a1+'//'+b1
        self.log.info("expectedURL ( " + expectedURL + " ) VS currentURL ( " + currentURL + " )")
        return currentURL == expectedURL

    def verifyLocatorText(self, locator, locatorType, expectedText):
        result = self.getText(locator, locatorType)
        self.log.info("expectedText ( " + expectedText + " ) VS LocatorText ( " + result + " )")
        return result == expectedText

    def verifyLocatorTextNotNone(self, locator, locatorType):
        result = self.getText(locator, locatorType)
        self.log.info("LocatorText = " + str(result) + " locator (" + str(locator) + ") + locatorType (" + locatorType + ")")
        return result is not None

    def plusNet(self):
        plusNetURL = 'http://192.168.1.254/'
        print("\nPlusNet URL : " + plusNetURL)
        self.log.info("PlusNet URL : " + plusNetURL)
        self.driver.get(plusNetURL)
Exemplo n.º 24
0
class BaseHome(AppiumDriver):

    def __init__(self, driver):
        """
        Inits BasePage class
        Returns:
            None
        """
        super(BaseHome, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verifyPageTitle(self, titleToVerify):
        """
        Verify the page Title
        Parameters:
            titleToVerify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.getTitle()
            return self.util.verifyTextContains(actualTitle, titleToVerify)
        except:
            self.log.error("Failed to get page title")
            print_stack()
            return False

    def verifyLocatorText(self, locator, locatorType, expectedText):
        result = self.getText(locator, locatorType)
        self.log.info("expectedText ( " + expectedText + " ) VS LocatorText ( " + result + " )")
        return result == expectedText

    def verifyLocatorTextNotNone(self, locator, locatorType):
        result = self.getText(locator, locatorType)
        self.log.info("LocatorText = " + str(result) + " locator (" + str(locator) + ") + locatorType (" + locatorType + ")")
        return result is not None

    def verifyLocatorValueText(self, locator, locatorType, expectedText):
        element = self.getElement(locator, locatorType)
        result = element.get_attribute('value')
        self.log.info("expectedText ( " + expectedText + " ) VS LocatorText ( " + result + " )")
        return result.lower() == expectedText.lower()

    def verifyPageURL(self, expectedURL):
        currentURL = self.driver.current_url
        self.log.info("expectedURL ( " + expectedURL + " ) VS currentURL ( " + currentURL + " )")
        return currentURL == expectedURL

    def verifyPageURLlow(self, expectedURL):
        currentURL1 = self.driver.current_url
        a1 = currentURL1.split('//')[0]; a2 = currentURL1.split('//')[1]; b1 = a2.split('/')[0]
        currentURL = a1+'//'+b1
        a1 = expectedURL.split('//')[0]; a2 = expectedURL.split('//')[1]; b1 = a2.split('/')[0]
        expectedURLlow = a1+'//'+b1
        self.log.info("expectedURL ( " + expectedURLlow + " ) VS currentURL ( " + currentURL + " )")
        return currentURL == expectedURLlow
Exemplo n.º 25
0
class BasePage(Selenium_driver):
    def __init__(self, driver):
        super(BasePage, self).__init__(driver)
        self.util = Util()

    def verifypageTile(self, titleToverify):
        try:
            actual_tile = self.getTitle()
            return self.util.veriftextContains(actual_tile, titleToverify)
        except:
            self.log.error("failed to get page ")
            return False
class MainPage(BasePage):

    log = cl.customLogger(logging.DEBUG)
    util = Util()

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver

    #locators
    _compose_main = "//div[@class='aic']/div/div"  #xpath
    _send_to = ":89"  #ID
    _subject_email = "subjectbox"  #name
    _body_email = ':8w'
    _send_email_button = ":7j"

    def clickComposeMainButton(self):
        self.elementClick(self._compose_main, locatorType="xpath")  #Link text

    def clickSendToEmail(self):
        self.elementClick(self._send_to)

    def enterSendToEmail(self, sendtoemail):
        self.sendKeys(sendtoemail, self._send_to)

    def enterSubjectToEmail(self, subject):
        self.sendKeys(subject, self._subject_email, locatorType="name")

    def enterEmailBody(self, emaildata):
        self.sendKeys(emaildata, self._body_email)

    def clickSendEmailButton(self):
        self.elementClick(self._send_email_button)

    def SendAnEmail(
        self,
        sendtoemail,
        subject,
        emaildata,
    ):
        self.clickComposeMainButton()
        time.sleep(2)
        self.clickSendToEmail()
        time.sleep(1)
        self.enterSendToEmail(sendtoemail)
        time.sleep(1)
        self.enterSubjectToEmail(subject)
        time.sleep(1)
        self.enterEmailBody(emaildata)
        time.sleep(1)
        self.clickSendEmailButton()
        self.util.sleep(2, "wait")
Exemplo n.º 27
0
class BasePage(SeleniumDriver):
    def __init__(self, driver):
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verifyPageTitle(self, titleToVerify):
        try:
            actualTitle = self.getTitle()
            return self.util.verifyTextContains(actualTitle, titleToVerify)
        except:
            self.log.info("Failed to get page title")
            return False
Exemplo n.º 28
0
class SupplierInformationANV(BasePage):
    log = cl.custom_logger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.util = Util()

    """ Unless otherwise noted, locator type is ID"""
    # LOCATORS
    _new_window_link = "New Window"  # LINK_TEXT
    _help_link = "Help"  # LINK_TEXT
    _find_existing_value_tab = "ICTAB_0"
    _keyword_search_tab = "ICTAB_1"
    _set_id_field = "VENDOR_ADD_VW_SETID"
    _supplier_id_field = "VENDOR_ADD_VW_VENDOR_ID"
    _persistence_select = "VENDOR_ADD_VW_VENDOR_PERSISTENCE"
    _add_button = "#ICSearch"

    def click_add_button(self):
        self.util.sleep(1, "Add New Value page to open.")
        self.element_click(self._add_button)
Exemplo n.º 29
0
class FindExistingValuePage(BasePage):
    log = cl.custom_logger(logging.DEBUG)

    def __init__(self, driver):
        super().__init__(driver)
        self.driver = driver
        self.util = Util()

    """ Unless otherwise noted, locator_type is 'ID' """
    # LOCATORS
    _new_window_link = "New Window"  # LINK_TEXT
    _help_link = "Help"  # LINK_TEXT
    _keyword_search_tab = "ICTAB_1"
    _add_new_value_tab = "ICTAB_2"
    _supplier_id_txt = "VENDOR_AP_VW_VENDOR_ID"
    _persistence_select = "VENDOR_AP_VW_VENDOR_PERSISTENCE"
    _short_supplier_name_txt = "VENDOR_AP_VW_VENDOR_NAME_SHORT"
    _our_customer_number_txt = "VENDOR_AP_VW_AR_NUM"
    _supplier_name = "VENDOR_AP_VW_NAME1"
    _search_btn = "#ICSearch"
    _clear_btn = "#ICClear"
    _basic_search_link = "Basic Search"  # LINK_TEXT
    _save_search_criteria_link = "Save Search Criteria"  # LINK_TEXT
    _find_existing_value_link = "Find an Existing Value"  # LINK_TEXT
    _keyword_search_link = "Keyword Search"  # LINK_TEXT
    _add_new_value_link = "Add a New Value"  # LINK_TEXT

    def click_add_new_value_tab(self):
        self.element_click(self._add_new_value_tab)

    def add_a_new_value(self):
        self.driver.switch_to.frame("ptifrmtgtframe")
        self.util.sleep(1, "the active window to be recognized by the app.")
        self.click_add_new_value_tab()

    def search_for_supplier(self):
        self.driver.switch_to_frame("ptifrmtgtframe")
        self.util.sleep(1, "the active window to be recognized by the app.")

    def enter_supplier_id(self, supplier):
        self.driver.switch_to_frame("ptifrmtgtframe")
        self.util.sleep(1, "the active window to be recognized by the app.")

        self.sendkeys(supplier, self._supplier_id_txt)

    def click_search_btn(self):
        self.element_click(self._search_btn)
        self.util.sleep(2, "the Summary page to open.")
Exemplo n.º 30
0
class BasePage(SeleniumWrapper):
    def __init__(self, driver):
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def is_page_title_correct(self, title_to_verify):
        try:
            actual_title = self.get_title()
            return self.util.is_text_contains(actual_title, title_to_verify)
        except NoSuchElementException:
            self.log.error("Failed to get page title")
            print_stack()
            return False
Exemplo n.º 31
0
class RegisterCoursesCSVDataTests(unittest.TestCase):
    @pytest.fixture(autouse=True)
    def objectSetup(self, oneTimeSetUp):
        self.courses = RegisterCoursesPage(self.driver)
        self.ts = T_estStatus(self.driver)
        self.lg = LoginPage(self.driver)
        self.util = Util()
        self.nav = NavigationPage(self.driver)

    def setUp(self):
        self.nav.navigateToAllCourses()

    @pytest.mark.run(order=1)
    @data(
        *getCSVData(r"C:\Users\Owner\workspace_python\letskodeit\testdata.csv")
    )
    @unpack
    def test_invalidEnrollment(self, course_name, country_name, postal_code):
        #       self.lg.login("*****@*****.**", "abcabc")
        #    self.courses.clickAllCoursesButton()
        self.courses.enterCourseName(courseName=course_name)
        self.courses.clickJavaScriptCourse()
        self.courses.scrollToBottom()
        self.courses.clickEnrollButton()
        self.courses.scrollToBottom()
        self.courses.selectCountryDropDown(countryName=country_name)
        self.courses.enterPostalCode(code=postal_code)
        self.courses.clickSubmitButton()
        self.courses.scrollToTop()
        self.util.sleep(3)
        result1 = self.courses.verifyTextOnPage(
            "Sorry, there was an error completing your purchase -- please try again."
        )
        #    self.ts.mark(result1, "Text verified")
        self.ts.markFinal("test_invalidEnrollment", result1, "Text verified")

        self.driver.back()
Exemplo n.º 32
0
class BasePage(SeleniumDriver):
    def __init__(self, driver):
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verify_page_title(self, title_to_verify):
        try:
            actual_title = self.get_title()
            return self.util.verify_text_contains(actual_title,
                                                  title_to_verify)
        except:
            self.log.error("Failed to get page title")
            print_stack()
            return False