コード例 #1
0
        public void CheckTotalAndSubtotalValuesWhenThereAreDiscountsForBothLicensesAndYearlyDropDowns()
        {
            productsPage  = new ProductsPage(CmdDriver.Driver);
            yourOrderPage = new YourOrderPage(CmdDriver.Driver);

            extentReportUtils.createATestCase("Check total and subtotal values when there are discounts for both licenses and yearly dropdowns");
            extentReportUtils.addTestLog(Status.Info, "CheckTotalAndSubtotalValuesWhenThereAreDiscountsForBothLicensesAndYearlyDropDowns");
            //CmdDriver.NavigateTo("https://store.progress.com/configure-purchase?skuId=6127");

            productsPage.ClickAcceptAllCookies();

            // Choose product and click on 'Buy Now' button for it
            productsPage.ClickBuyNowButtonByProductName(ProductsEnum.DEVCRAFT_ULTIMATE);

            yourOrderPage.ClickAcceptAllCookies();

            Product product = new Product(ProductType.LICENSE_AND_YEARLY_DISCOUNT);

            // Set min values to have discounts for both licenses and yearly
            product.MinLicenseQty = 2;
            product.MinYearlyQty  = 2;

            // Set Unit Price and M & S subscription price
            product.InitialUnitPrice     = yourOrderPage.GetUnitPrice();
            product.MNsSubscriptionPrice = yourOrderPage.GetMnSSubscriptionPrice();

            // Set license quantity
            int randomLicenseQuantity = yourOrderPage.GetRandomLicenseQuantityWithMinValue(product.MinLicenseQty);

            product.LicenseQuantity = randomLicenseQuantity;

            // Set license discount
            product.LicenseDiscount = yourOrderPage.GetQuantityDiscounts(product.LicenseQuantity);

            // Calculate discount
            yourOrderPage.SetLicenseQuantity(product.LicenseQuantity);

            // Set Yearly quantity
            int randomYearQuantity = yourOrderPage.GetRandomYearQuantityWithMinValue(product.MinYearlyQty);

            product.YearlyQuantity = randomYearQuantity;
            product.YearlyDiscount = yourOrderPage.GetYearQuantityDiscounts(randomYearQuantity);
            yourOrderPage.SetMaintenanceAndSupportQuantity(product.YearlyQuantity);

            // Calculations
            product.CalculateValues();

            // Assert actual and expected unit price
            double actualUnitPrice = yourOrderPage.GetUnitPrice();

            Assert.AreEqual(product.UnitPrice, actualUnitPrice);

            // Check discount for licenses
            double actualDiscountForLicenses = yourOrderPage.GetSavingsLabelForUnitPrice();

            Assert.AreEqual(product.ExpectedDiscountForLicense, actualDiscountForLicenses);

            // Assert actual and expected yearly price
            double actualYearlyPrice = yourOrderPage.GetYearlyQuantityValue();

            Assert.AreEqual(product.ExpectedYearlyPrice, actualYearlyPrice);

            // Check discount
            double actualDiscountForYear = yourOrderPage.GetSavingsLabelForYearlyPrice();

            Assert.AreEqual(product.DiscountForYear, actualDiscountForYear);

            // Assert subtotal value
            double actualSubtotal = yourOrderPage.GetSubtotalValue();

            Assert.AreEqual(product.SubtotalValue, actualSubtotal);

            // Assert renewal price
            double actualRenewalPrice = yourOrderPage.GetMnSSubscriptionPrice();

            Assert.AreEqual(product.ExpectedRenewalPrice, actualRenewalPrice);

            // Assert total license price
            double actualTotalLicensesPrice = yourOrderPage.GetTotalLicensesPrice();

            Assert.AreEqual(product.ExpectedTotalLicensesPrice, actualTotalLicensesPrice);

            // Assert total Maintenance price
            double actualMaintenancePrice = yourOrderPage.GetTotalMaintenancePrice();

            Assert.AreEqual(product.ExpectedMaintenancePrice, actualMaintenancePrice);

            // Assert total discounts
            double actualTotalDiscounts = yourOrderPage.GetTotalDiscounts();

            Assert.AreEqual(product.ExpectedTotalDiscounts, actualTotalDiscounts);

            // Assert Total value
            double actualTotalValue = yourOrderPage.GetTotalValue();

            Assert.AreEqual(product.ExpectedTotalValue, actualTotalValue);

            // Assert Subtotal and Total value
            Assert.AreEqual(product.SubtotalValue, product.ExpectedTotalValue);
        }
コード例 #2
0
        public void CheckTotalAndSubtotalValuesWhenThereIsADiscountOnlyForLicenses()
        {
            productsPage  = new ProductsPage(CmdDriver.Driver);
            yourOrderPage = new YourOrderPage(CmdDriver.Driver);

            extentReportUtils.createATestCase("Check total and subtotal values when there is a discount only for licenses");
            extentReportUtils.addTestLog(Status.Info, "CheckTotalAndSubtotalValuesWhenThereIsADiscountOnlyForLicenses");

            productsPage.ClickAcceptAllCookies();

            // Choose product and click on 'Buy now' button for it
            productsPage.ClickBuyNowButtonByProductName(ProductsEnum.DEVCRAFT_ULTIMATE);

            yourOrderPage.ClickAcceptAllCookies();

            Product product = new Product(ProductType.ONLY_LICENCE_DISCOUNT);

            // Set min values to have discounts for both licenses and yearly
            product.MinLicenseQty = 2;
            product.MinYearlyQty  = 2;

            // Set Unit Price and M & S subscription price
            product.InitialUnitPrice     = yourOrderPage.GetUnitPrice();
            product.MNsSubscriptionPrice = yourOrderPage.GetMnSSubscriptionPrice();

            // Set license quantity
            int randomLicenseQuantity = yourOrderPage.GetRandomLicenseQuantityWithMinValue(product.MinLicenseQty);

            product.LicenseQuantity = randomLicenseQuantity;

            // Set license discount
            product.LicenseDiscount = yourOrderPage.GetQuantityDiscounts(product.LicenseQuantity);

            // Set License quantity
            yourOrderPage.SetLicenseQuantity(product.LicenseQuantity);

            // Set yearly quantity to be 1 (we don't want to have a discount)
            product.YearlyQuantity = 1;
            product.YearlyDiscount = yourOrderPage.GetYearQuantityDiscounts(product.YearlyQuantity);

            // Calculations
            product.CalculateValues();

            // Assert actual and expected unit price
            double actualUnitPrice = yourOrderPage.GetUnitPrice();

            Assert.AreEqual(product.UnitPrice, actualUnitPrice);

            // Check discount for licenses
            double actualDiscountForLicenses = yourOrderPage.GetSavingsLabelForUnitPrice();

            Assert.AreEqual(product.ExpectedDiscountForLicense, actualDiscountForLicenses);

            // Check discount
            Assert.IsFalse(yourOrderPage.IsSavingsLabelForYearlyPriceDisplayed());

            // Assert subtotal value
            double actualSubtotal = yourOrderPage.GetSubtotalValue();

            Assert.AreEqual(product.SubtotalValue, actualSubtotal);

            // Assert renewal price
            double actualRenewalPrice = yourOrderPage.GetMnSSubscriptionPrice();

            Assert.AreEqual(product.ExpectedRenewalPrice, actualRenewalPrice);

            // Assert total license price
            double actualTotalLicensesPrice = yourOrderPage.GetTotalLicensesPrice();

            Assert.AreEqual(product.ExpectedTotalLicensesPrice, actualTotalLicensesPrice);

            // Assert total discounts
            double actualTotalDiscounts = yourOrderPage.GetTotalDiscounts();

            Assert.AreEqual(product.ExpectedTotalDiscounts, actualTotalDiscounts);

            // Assert Total value
            double actualTotalValue = yourOrderPage.GetTotalValue();

            Assert.AreEqual(product.ExpectedTotalValue, actualTotalValue);

            // Assert Subtotal and Total value
            Assert.AreEqual(product.SubtotalValue, product.ExpectedTotalValue);
        }