Esempio n. 1
0
    def test_downloadCoupon_Generic(self, description):
        try:
            couponCode = LuciHelper.generateCouponCode()
            couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
                self, {
                    'client_handling_type': 'GENERIC',
                    'genericCode': couponCode
                })

            couponCode1 = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]
            self.userId = constant.config['usersInfo'][1]['userId']
            couponCode2 = LuciHelper.issueCouponAndAssertions(
                self, couponSeriesId)[0]
            DracarysHelper.downloadCouponsRequestAndAssertion(
                self, couponSeriesId,
                self.DracarysObj.DownloadReportType['ISSUED'],
                [couponCode1, couponCode2])
            LuciHelper.redeemCouponAndAssertions(self, couponSeriesId,
                                                 couponCode)
            DracarysHelper.downloadCouponsRequestAndAssertion(
                self, couponSeriesId,
                self.DracarysObj.DownloadReportType['REDEEMED'], [couponCode])
        finally:
            self.userId = constant.config['usersInfo'][0]['userId']
Esempio n. 2
0
    def test_LUCI_IMC_GC_02(self, description, couponConfig, expectedErrorMsg, sentHistoryCount):
        couponCode = LuciHelper.generateCouponCode()
        couponConfig.update({'client_handling_type' : 'GENERIC', 'genericCode' : couponCode})
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq=couponConfig)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)


        exceptionList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds, expectResponseException=[True, expectedErrorMsg])
        Assertion.constructAssertion(len(exceptionList) == len(self.userIds), 'Requested issual {}'.format(expectedErrorMsg))
Esempio n. 3
0
    def test_LUCI_IMC_GC_01(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self,couponConfigReq={'client_handling_type' : 'GENERIC', 'genericCode' : couponCode})

        LuciHelper.issueMultipleCoupon(self,couponSeriesId,self.userIds)

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(couponIssuedList != [], 'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(len(couponIssuedList) == len(self.userIds), 'Issued Coupons are recorded in coupons_issued')
Esempio n. 4
0
    def test_LUCI_IMC_GC_09(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type' : 'GENERIC', 'genericCode' : couponCode, 'do_not_resend_existing_voucher' : False, 'allow_multiple_vouchers_per_user' : False , 'valid_days_from_create' : 1})

        couponDetailsList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(couponIssuedList != [], 'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(len(couponIssuedList) == len(self.userIds), 'Issued Coupons are recorded in coupons_issued')
Esempio n. 5
0
    def test_LUCI_IMC_GC_08(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type' : 'GENERIC', 'genericCode' : couponCode, 'do_not_resend_existing_voucher' : False, 'allow_multiple_vouchers_per_user' : False , 'valid_days_from_create' : 1})

        couponDetailsList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        for couponDetails in couponDetailsList:
            couponDetails = couponDetails.__dict__
            self.connObj.changeCouponIssuedDate(couponDetails['id'], Utils.getTime(days=-2, minutes=5,milliSeconds=True))

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(couponIssuedList != [], 'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(len(couponIssuedList) == len(self.userIds), 'Issued Coupons are recorded in coupons_issued')
Esempio n. 6
0
    def test_LUCI_IMC_GC_05(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type' : 'GENERIC', 'genericCode' : couponCode, 'do_not_resend_existing_voucher' : True, 'allow_multiple_vouchers_per_user' : True , 'valid_days_from_create' : 1})

        couponDetailsList = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        for couponDetails in couponDetailsList:
            couponDetails = couponDetails.__dict__
            self.connObj.changeCouponIssuedDate(couponDetails['id'], Utils.getTime(days=-2, minutes=5,milliSeconds=True))

        LuciHelper.uploadCouponAndAssertions(self, couponSeriesId, self.constructObj.importType['USER_ID'], self.userIds, noOfCouponsToBeUpload=10, dracraysUpload={'userOnly': True})
        couponAlreadyIssued = LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds, expectResponseException=[True,'user already has a valid generic coupon'])
        Assertion.constructAssertion(len(couponAlreadyIssued) == len(self.userIds), 'Coupon Already issued to List of users Sent')

        couponIssuedList = LuciDBHelper.getCouponsIssuedList(couponSeriesId)
        Assertion.constructAssertion(couponIssuedList != [], 'Issued Coupon Code recorded in Coupons_issued table')
        Assertion.constructAssertion(len(couponIssuedList) == len(self.userIds)*2, 'Issued Coupons are recorded in coupons_issued')
Esempio n. 7
0
 def createCoupons(self, couponName, couponType='DISC_CODE'):
     try:
         self.navigateToURL(constant.config['intouchUrl'] + '/coupons/ui/')
         self.implicitWaitOnReactPage()
         self.elementClick(self.btn_createNewCoupon_xpath,
                           locatorType='xpath')
         self.implicitWaitOnReactPage()
         self.sendKeys(couponName,
                       self.txt_couponSeriesTag_xpath,
                       locatorType='xpath')
         self.elementClick(self.label_discount_details_xpath,
                           locatorType='xpath')
         self.sendKeys(10, self.inp_fixed_amount_xpath, 'xpath')
         self.elementClick(self.label_coupons_details_xpath,
                           locatorType='xpath')
         if couponType == 'DISC_CODE':
             self.elementClick(self.btn_radio_discCode_xpath,
                               locatorType='xpath')
             self.elementClick(self.btn_edit_auto_gen_coupon_length_xpath,
                               locatorType='xpath')
             self.waitForElement(self.inp_coupon_length_xpath,
                                 locatorType='xpath')
             self.sendKeys(9,
                           self.inp_coupon_length_xpath,
                           locatorType='xpath')
             self.elementClick(self.btn_coupon_length_save_xpath,
                               locatorType='xpath')
         elif couponType == 'DISC_CODE_PIN':
             self.elementClick(self.btn_radio_disc_code_pin_xpath,
                               locatorType='xpath')
         elif couponType == 'GENERIC':
             self.elementClick(self.btn_radio_generic_xpath,
                               locatorType='xpath')
             self.sendKeys(LuciHelper.generateCouponCode(),
                           self.inp_generic_code_xpath,
                           locatorType='xpath')
         elif couponType == 'EXTERNAL':
             self.waitForElement(self.btn_radio_external_xpath,
                                 locatorType='xpath')
             self.elementClick(self.btn_radio_external_xpath,
                               locatorType='xpath')
         self.elementClick(self.view_advance_setting_xpath,
                           locatorType='xpath')
     except Exception, exp:
         raise Exception('Create New Coupon Exception :{}'.format(exp))
Esempio n. 8
0
 def test_LUCI_EI_014(self, description, config, expectedErrors):
     try:
         if config['client_handling_type'] == 'GENERIC':
             couponCode = LuciHelper.generateCouponCode()
             config.update({'genericCode': couponCode})
         LuciHelper.saveCouponConfigAndAssertions(self,
                                                  couponConfigReq=config)
         Assertion.constructAssertion(
             False,
             'Actual: Coupon series Created Expected: Exceptions',
             verify=True)
     except Exception, luciExp:
         luciExp = luciExp.__dict__
         Assertion.constructAssertion(
             luciExp['errorCode'] == expectedErrors[0],
             'Luci Exception error code Actual: {} and Expected: {}'.format(
                 luciExp['errorCode'], expectedErrors[0]))
         Assertion.constructAssertion(
             luciExp['errorMsg'] == expectedErrors[1],
             'Luci Exception Error Msg Actual : {}'.format(
                 luciExp['errorMsg']))
Esempio n. 9
0
    def test_LUCI_EI_012(self, description):
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(
            self,
            couponConfigReq={
                'client_handling_type': 'DISC_CODE_PIN',
                'any_user': True,
                'isExternalIssual': True,
                'min_bill_amount': 1500,
                'max_bill_amount': 999999999,
                'redemption_valid_after_days': -1
            })
        Assertion.constructAssertion(
            LuciDBHelper.isExternalCouponSeries(couponSeriesId),
            'Client handling type isExternal Enabled for coupon series id: {}'.
            format(couponSeriesId))

        couponCode = LuciHelper.generateCouponCode().lower()
        couponCode = LuciHelper.uploadCouponAndAssertions(
            self,
            couponSeriesId,
            self.constructObj.importType['NONE'],
            couponCode=couponCode,
            dracraysUpload={'couponCodeCAPS': False})['coupons'][0]

        LuciHelper.redeemCouponAndAssertions(
            self,
            couponSeriesId,
            couponCode,
            couponIssuedTo=[-1],
            error=[900, 'bill amount less than the minimum limit set'])
        couponConfigObj.update({'min_bill_amount': 900})
        LuciHelper.saveCouponConfigAndAssertions(
            self, couponConfigReq=couponConfigObj)
        LuciHelper.redeemCouponAndAssertions(self,
                                             couponSeriesId,
                                             couponCode,
                                             couponIssuedTo=[-1])
Esempio n. 10
0
    def test_LUCI_IMC_GC_04(self, description):
        couponCode = LuciHelper.generateCouponCode()
        couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, {'client_handling_type': 'GENERIC', 'genericCode': couponCode, 'do_not_resend_existing_voucher': False, 'allow_multiple_vouchers_per_user': False})

        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
        LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds)
Esempio n. 11
0
 def test_LUCI_IMC_GC_10(self, description, couponConfig):
     couponCode = LuciHelper.generateCouponCode()
     couponConfig.update({'client_handling_type': 'GENERIC', 'genericCode': couponCode})
     couponConfigObj, couponSeriesId = LuciHelper.saveCouponConfigAndAssertions(self, couponConfigReq=couponConfig)
     LuciHelper.issueMultipleCoupon(self, couponSeriesId, self.userIds, expectResponseException=[True,'coupon series expired'])