예제 #1
0
def singlecustomerDetails(df):
    newName = df['Customer Id'] + Util.get_unique_number(10)
    df['Customer Id'] = newName
    df['Name'] = df['Name'] + newName
    df['Preferred name'] = df['Preferred name'] + newName
    df['Reference number'] = df['Reference number'] + Util.get_unique_number(6)
    return df
예제 #2
0
def customerDetails(df):
    for i in range(len(df['Customer Id'])):
        newName = df['Customer Id'][i] + Util.get_unique_number(10)
        df_customer['Customer Id'][i] = newName
        df_customer['Reference number'] = df['Reference number'][
            i] + Util.get_unique_number(6)
    return df
예제 #3
0
 def __init__(self, driver):
     """
     Initializes the BasePage class.
     :param driver: Instance of the driver.
     """
     super(BasePage, self).__init__(driver)
     self.driver = driver
     self.util = Util()
예제 #4
0
    def setUp(self, driver, request):
        driver.launch_app()
        yield

        allure.attach('Test completed screenshot',
                      open(Util.saveExeScreenShot(Util(), driver, request.node.name), 'rb').read(),
                      type=AttachmentType.PNG)

        driver.close_app()
예제 #5
0
 def __init__(self, driver):
     """
     Inits BasePage class
     Returns:
         None
     """
     super(BasePage, self).__init__(driver)
     self.driver = driver
     self.util = Util()
예제 #6
0
 def locateangularElement(self, loc, driver, request):
     try:
         element = WebDriverWait(self.driver, 10).until(
             EC.presence_of_element_located((By.XPATH, loc)))
         return element
     except:
         print("cannot find {0} element".format(loc))
         logging.error("cannot find {0} element".format(loc))
         allure.attach("cannot find {0} element".format(loc),
                       open(
                           Util.saveExeScreenShot(Util(), driver,
                                                  request.node.name),
                           'rb').read(),
                       type=AttachmentType.PNG)
     return None
    def generateCAMT053(self, realAccount, transactionAccount, camtinput):
        iBANFlag = ""
        CAMT053FileProcessing.outputFileName = "AutoCAMT053" + Util.get_unique_number(
            5)

        CAMT053InputData.Random = CAMT053FileProcessing.random + "-" + Util.get_unique_number(
            5)
        CAMT053InputData.date = datetime.today().isoformat()
        CAMT053InputData.Dt = date.today().isoformat()
        # CAMT053FileProcessing.path = str(Path.home())

        # CAMT053FileProcessing.path = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
        CAMT053FileProcessing.path = os.environ.get(
            'myHome')  # str(Path.home())

        CAMT053FileProcessing.paramFilePath = CAMT053FileProcessing.path + "inputCAMT&PAIN\\"

        if not os.path.exists('inputCAMT&PAIN'):
            os.makedirs(CAMT053FileProcessing.paramFilePath)

        self.createParam(CAMT053FileProcessing.outputFileName)
        self.takeInputsForCAMT053FileProcessing(realAccount,
                                                transactionAccount, camtinput)

        # Root = self.initiateXML()
        rootElement = Element("Document")
        tree = etree.ElementTree(rootElement)
        rootElement.set("xmlns",
                        "urn:iso:std:iso:20022:tech:xsd:camt.053.001.02")
        rootElement.set("xmlns:xsd", "http://www.w3.org/2001/XMLSchema")
        rootElement.set("xmlns:xsi",
                        "http://www.w3.org/2001/XMLSchema-instance")

        BkToCstmrStmt = Element(CAMT053Tags.BkToCstmrStmtTag)
        rootElement.append(BkToCstmrStmt)

        self.createGrpHdr(BkToCstmrStmt)
        self.createStmt(BkToCstmrStmt)

        CAMT053FileProcessing.camtFilepath = CAMT053FileProcessing.path + "\\inputCAMT&PAIN\\" + \
                                             CAMT053FileProcessing.outputFileName + ".att"

        tempFileName = CAMT053FileProcessing.path + "\\inputCAMT&PAIN\\TempCAMTFile" + ".att"

        tree.write(open(tempFileName, 'wb'),
                   xml_declaration=True,
                   encoding='utf-8')
        vkb.xml(tempFileName, CAMT053FileProcessing.camtFilepath)
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
예제 #9
0
def accountsDetails(df):
    for name in range(len(df['Name of the account'])):
        newName = df['Name of the account'][name] + Util.get_unique_number(10)
        for parent in range(len(df['Parent'])):
            if df['Parent'][parent] == df['Name of the account'][name]:
                df['Parent'][parent] = newName
        df['Name of the account'][name] = newName
    return df
예제 #10
0
 def enterAccountNumber(self, AccountNumber):
     try:
         AccountNumber = AccountNumber + Util.get_unique_number(14)
         self.sendKeys(AccountNumber,
                       self.txtAccountNumber,
                       locatorType="xpath")
     except Exception as e:
         self.log.error("Error occurred while filling address details. :: ")
     return AccountNumber
예제 #11
0
    def locateElement(self, loc, driver, request):
        try:
            # print(loc)
            element = WebDriverWait(self.driver, 10).until(
                EC.visibility_of_element_located(loc))
            # logging.info("Find {0} element".format(loc))
            return element
        except:
            # print("cannot find {0} element".format(loc))
            logging.error("Cannot find {0} element".format(loc))
            allure.attach("Cannot find {0} element".format(loc),
                          open(
                              Util.saveExeScreenShot(Util(), driver,
                                                     request.node.name),
                              'rb').read(),
                          type=AttachmentType.PNG)

            assert 0, "Cannot find {0} element".format(loc)
        return None
예제 #12
0
    def locateMutipleElements(self, loc, driver, request):
        # with pytest.raises(NoSuchElementException):
        try:
            # print(loc)
            elements = WebDriverWait(self.driver, 10).until(
                EC.presence_of_all_elements_located(loc))
            # logging.info("Find elements of {0}".format(loc))
            return elements
        except Exception as e:
            errList = traceback.format_exception(None, e, e.__traceback__)

            logging.error("Cannot find {0} element".format(loc))
            allure.attach("Cannot find {0} element".format(loc),
                          open(
                              Util.saveExeScreenShot(Util(), driver,
                                                     request.node.name),
                              'rb').read(),
                          type=AttachmentType.PNG)
            assert 0, "Cannot find {0} element".format(loc)
예제 #13
0
def set_details_for_customer_edit(df_duplicate):
    df_Singlecustomer['Name'] = df_duplicate['Name']
    df_Singlecustomer['Preferred name'] = df_duplicate['Preferred name']
    df_Singlecustomer['Line 1'] = df_duplicate['Line 1']
    df_Singlecustomer['Line 2'] = df_duplicate['Line 2']
    df_Singlecustomer['Line 3'] = df_duplicate['Line 3']
    df_Singlecustomer['Line 4'] = df_duplicate['Line 4']
    df_Singlecustomer['Value'] = df_duplicate['Value']
    df_Singlecustomer['Reference number'] = df_duplicate[
        'Reference number'] + Util.get_unique_number(6)
    df_Singlecustomer['Description'] = df_duplicate['Description']
    return df_Singlecustomer
예제 #14
0
    def test_03PopupMenu(self, driver, setUp, request):

        mainMenu = API_Main(driver)
        viewMenu = API_Views(driver)
        popupMenu = API_PopupMenus(driver)

        with pytest.allure.step('Click Views'):
            # Scroll to 'Views' text
            driver.find_element_by_android_uiautomator(
                'new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Views"))')

            self.logReport('Click Views')
            menuViews = mainMenu.locateElement(mainMenu.menuViews, driver, request)
            menuViews.click()

        with pytest.allure.step('Click Popup Menu'):
            # Scroll to 'Views' text
            driver.find_element_by_android_uiautomator(
                'new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Popup Menu"))')

            self.logReport('Click Popup Menu')
            menuPopup = viewMenu.locateElement(viewMenu.menuPopup, driver, request)
            menuPopup.click()

        with pytest.allure.step('Click Make a popup button'):
            self.logReport('Click Make a popup button')
            widgetButtons = popupMenu.locateMutipleElements(popupMenu.widgetButtons, driver, request)
            makePopup = widgetButtons[0]
            makePopup.click()

        with pytest.allure.step('Click Popup menus exists'):
            self.logReport('Click Popup menus exists')
            popupItems = popupMenu.locateMutipleElements(popupMenu.popupMenuItems, driver, request)

            self.logReport('Verify search text')
            searchPopup = popupItems[0]
            Util.verifyCheckPoint(Util(), driver, searchPopup.text, "Search", request, log)

            self.logReport('Verify Add text')
            addPopup = popupItems[1]
            Util.verifyCheckPoint(Util(), driver, addPopup.text, "Add", request, log)

            self.logReport('Verify Edit text')
            editPopup = popupItems[2]
            Util.verifyCheckPoint(Util(), driver, editPopup.text, "Edit", request, log)
예제 #15
0
    def test_01ActionBarTab(self, driver, setUp, request):

        mainMenu = API_Main(driver)
        appMenu = API_App(driver)
        actionBarMenu = API_ActionBar(driver)
        actionBarTab = API_ActionBarTab(driver)

        with pytest.allure.step('Click App'):
            self.logReport('Click App')
            menuApp = mainMenu.locateElement(mainMenu.menuApp, driver, request)
            menuApp.click()

        with pytest.allure.step('Click Action'):
            self.logReport('Click Action')
            menuActionBar = appMenu.locateElement(appMenu.menuActionBar, driver, request)
            menuActionBar.click()

        with pytest.allure.step('Click Action Bar Tab'):
            self.logReport('Click Action Bar Tab')
            menuActionBarTab = actionBarMenu.locateElement(actionBarMenu.menuActionBarTabs, driver, request)
            menuActionBarTab.click()

        with pytest.allure.step('Click Add New Tab 3 times'):
            self.logReport('Click Add New Tab 3 times')
            addNewTabButton = actionBarTab.locateElement(actionBarTab.AddNewTab, driver, request)
            for i in range(3):
                sleep(1)
                addNewTabButton.click()

        with pytest.allure.step('Click Toggle Tab Mode'):
            self.logReport('Click Toggle Tab Mode')
            toggleTabMode = actionBarTab.locateElement(actionBarTab.ToggleTabMode, driver, request)
            toggleTabMode.click()

        with pytest.allure.step('Verify 3 tabs toggle'):
            self.logReport('Verify 3 tabs toggle')
            tabViews = actionBarTab.locateMutipleElements(actionBarTab.TabViews, driver, request)
            Util.verifyCheckPoint(Util(), driver, len(tabViews), 3, request, log)
예제 #16
0
    def fill_template_details(self, templateinfo, i):
        try:
            ReportType = templateinfo.loc[i].get(
                self.labelsOnUI.get('lbl_templateReportType'))

            flag = self.iselementSelected(self.templateType.format(ReportType),
                                          locatorType="xpath")
            if flag == False:
                self.elementClick(self.templateType.format(ReportType),
                                  locatorType="xpath")

            templateinfo[self.labelsOnUI['lbl_templateName']][i] = templateinfo[self.labelsOnUI['lbl_templateName']][i] \
                                                                   + Util.get_unique_number(14)
            self.sendKeys(
                templateinfo[self.labelsOnUI.get('lbl_templateName')][i],
                self.templateName,
                locatorType="xpath")

            access = templateinfo.loc[i].get(
                self.labelsOnUI.get('lbl_templateAccess'))
            self.elementClick(self.templateAccess.format(access),
                              locatorType="xpath")

            self.selectCurrency(templateinfo, i)

            if ReportType == 'Balance':
                self.selectvaluefromDropdown(
                    templateinfo[self.labelsOnUI['lbl_templateView']][i],
                    self.ddlView,
                    locatorType="xpath")
                self.elementClick(self.chkBoxIncludeCurrencyAccounts,
                                  locatorType="xpath")
            else:
                self.setFromAndToAmount(templateinfo, i)
                self.selectvaluefromDropdown(templateinfo[
                    self.labelsOnUI['lbl_templateAccountType']][i],
                                             self.templateAccountType,
                                             locatorType="xpath")
                self.selectvaluefromDropdown(templateinfo[
                    self.labelsOnUI['lbl_templateTransactionType']][i],
                                             self.templateTranscationType,
                                             locatorType="xpath")

            self.elementClick(self.templatePeriod.format(
                templateinfo[self.labelsOnUI['lbl_templatePeriod']][i]),
                              locatorType="xpath")
            self.log.info("Successfully filled template details::")
        except:
            self.log.info("Error occured while filling template details::")
예제 #17
0
class BasePage(CustomSeleniumDriver):
    def __init__(self, driver):
        """
        Initializes the BasePage class.
        :param driver: Instance of the driver.
        """
        super(BasePage, self).__init__(driver)
        self.driver = driver
        self.util = Util()

    def verify_page_title(self, title_of_page):
        """
        Verify the title of current page.
        :param title_of_page: Title of current page that needs to be verified.
        :return: True / False
        """

        try:
            actual_title = self.get_title()
            return self.util.verify_text_contains(actual_title, title_of_page)
        except Exception as err:
            self.automation_logger.error("Failed to get page title: " +
                                         str(err))
예제 #18
0
class BasePage(SeleniumDriver):
    resourcePropertyPath = os.environ.get(
        'myHome') + "resources/captionBundle.properties"
    labelsOnUI = TestParams.load_properties(resourcePropertyPath)

    progressBarlocator = "//div[@class='simple-notification success ng-trigger ng-trigger-enterLeave']//div[contains(text(),'{0}')]"

    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 verifyMessageOnProgressBar(self, expectedMessageToVerify):
        """
        Verify the message on progress bar

        Parameters:
            titleToVerify: Title on the page that needs to be verified
        """
        try:
            actualTitle = self.getText(
                self.progressBarlocator.format(expectedMessageToVerify),
                locatorType="xpath")
            # self.wait_for_page_load(5)
            self.waitForElementInVisible(
                self.progressBarlocator.format(expectedMessageToVerify),
                locatorType="xpath")
            # self.elementClick(self.progressBarlocator.format(expectedMessageToVerify),
            #                            locatorType="xpath")
            return self.util.verifyTextMatch(actualTitle,
                                             expectedMessageToVerify)
        except:
            self.log.error("Failed to verify message on progress bar")
            print_stack()
            return False

    def is_text_present(self, text):
        return str(text) in self.driver.page_source

    def verify(self, lbltargetDetails, expectedText):
        result = False
        try:
            actualText = self.getText(lbltargetDetails, locatorType="xpath")
            actualResult = str(actualText)
            expectedResult = str(expectedText)
            result = self.util.verifyTextMatch(actualResult, expectedResult)
            self.log.info("Successfully verify detail of::" + expectedResult)
        except:
            self.log.info("Error in verifying detail of::" + expectedText)
        return result
예제 #19
0
    def test_02TextView(self, driver, setUp, request):

        mainMenu = API_Main(driver)
        viewMenu = API_Views(driver)
        textMenu = API_Texts(driver)
        textViewMenu = API_TextView(driver)

        with pytest.allure.step('Click Views'):

            # Scroll to 'Views' text
            driver.find_element_by_android_uiautomator(
                'new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Views"))')

            self.logReport('Click Views')
            menuViews = mainMenu.locateElement(mainMenu.menuViews, driver, request)
            menuViews.click()

        with pytest.allure.step('Click Views'):

            # Scroll to 'Text' text
            driver.find_element_by_android_uiautomator(
                'new UiScrollable(new UiSelector().scrollable(true)).scrollIntoView(new UiSelector().text("Text"))')

            self.logReport('Click Views')
            menuText = viewMenu.locateElement(viewMenu.menuText, driver, request)
            menuText.click()

        with pytest.allure.step('Click TextView'):
            self.logReport('Click TextView')
            menuTextView = textMenu.locateElement(textMenu.textView, driver, request)
            menuTextView.click()

        with pytest.allure.step('Verify 4 text types exists'):
            self.logReport('Verify small text')
            smallText = textViewMenu.locateElement(textViewMenu.smallText, driver, request)
            Util.verifyCheckPoint(Util(), driver, smallText.text, "Small", request, log)

            self.logReport('Verify medium text')
            mediumText = textViewMenu.locateElement(textViewMenu.mediumText, driver, request)
            Util.verifyCheckPoint(Util(), driver, mediumText.text, "Medium", request, log)

            self.logReport('Verify large text')
            largeText = textViewMenu.locateElement(textViewMenu.largeText, driver, request)
            Util.verifyCheckPoint(Util(), driver, largeText.text, "Large", request, log)

            self.logReport('Verify selectable text')
            selectableText = textViewMenu.locateElement(textViewMenu.selectableText, driver, request)
            Util.verifyCheckPoint(Util(), driver, selectableText.text, "NotSelectable", request, log)
예제 #20
0
def createDuplicate(row):
    df = df_accounts[df_accounts['Parent'] == row]
    df = df.reset_index()
    del df['index']
    df.loc[0]['Name of the account'] = 'VTA' + Util.get_unique_number(10)
    return df
예제 #21
0
def generateUniqueUserId(df):
    newName = df['User ID'] + Util.get_unique_number(7)
    df['User ID'] = newName
    return df