public void Test_A_1_CreateDraftPackage(string role) { // TESTparameters: Test_B_CreateDraftPackage string mainGroup = "00 - General"; string subGroup = "00 - Vehicle, complete"; string vehicleType = "All Scania Vehicles"; string variantDescription = "VariantDescription"; string reasonForPackage = "ReasonForPackage"; string packageName = "PackageToManage"; string packageDescription = "PackageDescription"; string workorderText = "WorkorderText"; string invoiceText = "InvoiceText"; string parts = "1301111"; string labour = "01015111"; string sundry = "18"; // --------------------------------------------------------- LoginPage.LoginAs(role); verifyPageTitle(HomePage.mainPageTitle, driver); // Navigate Packages -> Create HomePage.menuPackages.Click(); // Wait for page to load WaitForAjax(driver, 10, true); // Click on menu "Create" HomePage.menuCreate.Click(); //Click on button Next WaitForElement(SearchPage.buttonNext); SearchPage.buttonNext.Click(); // Fill out description form WaitForElement(DescriptionPage.listMainGroup); DescriptionPage.ToFillOutDescription(mainGroup, subGroup, vehicleType, variantDescription, reasonForPackage, packageName, packageDescription, workorderText, invoiceText); // Click button Next DescriptionPage.buttonNext.Click(); // Fill out content form WaitForElements(ContentPage.allDropDownLists); ContentPage.ChoosePartLabourAndSundry(parts, labour, sundry); WaitForElement(ContentPage.checkbox_MAIN_PART); ContentPage.checkbox_MAIN_PART.Click(); packageId = ContentPage.GetPackageId(); // Save the package ContentPage.buttonSave.Click(); // Verify that the package was saved successfully WaitForElement(DescriptionPage.alertMessage); StringAssert.Contains("Success! Package has been saved", DescriptionPage.alertMessage.Text, "Error when create a package with the role -" + role + " -"); }
public void Test_C_0_FetchPackagePrices() { // TESTparameters: Test_H_FetchPackagePrices string role = "Test Package Pricer"; string mainGroup = "00 - General"; string subGroup = "00 - Vehicle, complete"; string vehicleType = "All Scania Vehicles"; string variantDescription = "VariantDescription"; string reasonForPackage = "ReasonForPackage"; string packageName = "PackageToManage"; string packageDescription = "PackageDescription"; string workorderText = "WorkorderText"; string invoiceText = "InvoiceText"; string parts = "1110055"; string labour = "01015111"; string sundry = "18"; string approval = "GLOBAL\\testfprpricer (FPRPRICER IWNP)"; string packageStatus = "SENT FOR REVIEW"; // --------------------------------------------------------- LoginPage.LoginAs(role); verifyPageTitle(HomePage.mainPageTitle, driver); // Navigate Packages -> Create HomePage.menuPackages.Click(); // Wait for page to load WaitForAjax(driver, 10, true); // Click on menu "Create" HomePage.menuCreate.Click(); //Click on button Next WaitForElement(SearchPage.buttonNext); SearchPage.buttonNext.Click(); // Fill out description form WaitForElement(DescriptionPage.listMainGroup); DescriptionPage.ToFillOutDescription(mainGroup, subGroup, vehicleType, variantDescription, reasonForPackage, packageName, packageDescription, workorderText, invoiceText); // Click button Next DescriptionPage.buttonNext.Click(); // Fill out content form WaitForElements(ContentPage.allDropDownLists); ContentPage.ChoosePartLabourAndSundry(parts, labour, sundry); WaitForElement(ContentPage.checkbox_MAIN_PART); ContentPage.checkbox_MAIN_PART.Click(); // Click button Next DescriptionPage.buttonNext.Click(); Thread.Sleep(3000); PreviewPage.buttonApprove.Click(); Thread.Sleep(3000); PreviewPage.buttonApproveOnConfirmationDialog.Click(); Thread.Sleep(3000); PreviewPage.buttonNext.Click(); Thread.Sleep(3000); // Find and click on the market PricingPage.ToFindMarket("Sweden"); Thread.Sleep(3000); PricingPage.buttonPriceForGroup(); Thread.Sleep(3000); WaitForElements(PricingPage.listWithDiscountButtons); PricingPage.buttonOpenListWithParts.Click(); Thread.Sleep(3000); // Set discount PricingPage.ToSetDiscountPercentage(5.ToString()); WaitForAjax(driver, 2, true); // Fetch all fields double QTY = Convert.ToDouble(PricingPage.fieldQuantity.Text); double CostPrice = PricingPage.ToDouble(PricingPage.fieldCost); double RetailPrice = PricingPage.ToDouble(PricingPage.fieldRetailPrice); // + discountPercentage double SalesNetPrice = PricingPage.ToDouble(PricingPage.fieldSalesNetPrice); double TotalCost = PricingPage.ToDouble(PricingPage.fieldTotalCost); double TotalGross = PricingPage.ToDouble(PricingPage.fieldTotalGross); double TotalNet = PricingPage.ToDouble(PricingPage.fieldTotalNet); double GrossProfitAmount = PricingPage.ToDouble(PricingPage.fieldGrossProfitAmount); double GrossProfitPercentage = PricingPage.ToDouble(PricingPage.fieldGrossProfitPercentage); // Write to excel file WriteToExcel = new WriteToExcel(); double[] data = new double[10] { QTY, CostPrice, RetailPrice, 5, SalesNetPrice, TotalCost, TotalGross, TotalNet, GrossProfitAmount, GrossProfitPercentage }; WriteToExcel.WriteToRange("CalculationData", data, "A2", "J2"); }
public void Test_A_4_SendForApprovalAndApprove(string role) { // TESTparameters: Test_E_SendForApprovalAndApprove string role_TestPackgeCreator = "Test Package Creator"; string role_TestPackagePricer = "Test Package Pricer"; string mainGroup = "00 - General"; string subGroup = "00 - Vehicle, complete"; string vehicleType = "All Scania Vehicles"; string variantDescription = "VariantDescription"; string reasonForPackage = "ReasonForPackage"; string packageName = "PackageToManage"; string packageDescription = "PackageDescription"; string workorderText = "WorkorderText"; string invoiceText = "InvoiceText"; string parts = "1301111"; string labour = "01015111"; string sundry = "18"; string approval = "GLOBAL\testfprpricer (FPRPRICER IKB)"; string packageStatus = "PENDING REVIEW"; // --------------------------------------------------------- LoginPage.LoginAs(role_TestPackgeCreator); verifyPageTitle(HomePage.mainPageTitle, driver); // Navigate Packages -> Create HomePage.menuPackages.Click(); // Wait for page to load WaitForAjax(driver, 10, true); // Click on menu "Create" HomePage.menuCreate.Click(); //Click on button Next WaitForElement(SearchPage.buttonNext); SearchPage.buttonNext.Click(); // Fill out description form WaitForElement(DescriptionPage.listMainGroup); DescriptionPage.ToFillOutDescription(mainGroup, subGroup, vehicleType, variantDescription, reasonForPackage, packageName, packageDescription, workorderText, invoiceText); // Click button Next DescriptionPage.buttonNext.Click(); // Fill out content form WaitForElements(ContentPage.allDropDownLists); ContentPage.ChoosePartLabourAndSundry(parts, labour, sundry); WaitForElement(ContentPage.checkbox_MAIN_PART); ContentPage.checkbox_MAIN_PART.Click(); // SAVE PACKAGE ID packageId = ContentPage.GetPackageId(); // Save the package DescriptionPage.buttonSave.Click(); // Verify that the package was saved successfully WaitForElement(DescriptionPage.alertMessage); // Click button Next DescriptionPage.buttonNext.Click(); WaitForElement(PreviewPage.dropdownSelectApprover); Thread.Sleep(3000); // Select for approval selectFromDropDownByText(approval, PreviewPage.dropdownSelectApprover); // Wait for button Send for approval will be active WaitForElement(PreviewPage.buttonSendForApproval); // Click button Send for approval PreviewPage.buttonSendForApproval.Click(); // Wait for confirmation dialog with button Send for approval WaitForElement(PreviewPage.buttonSendForApprovalConfirm); Thread.Sleep(1000); // Click button send for approval on confirmation dialog PreviewPage.buttonSendForApprovalConfirm.Click(); Thread.Sleep(3000); HomePage.buttonLoggedUser.Click(); HomePage.buttonSwitchUser.Click(); Thread.Sleep(2000); LoginPage.LoginAs(role_TestPackagePricer); verifyPageTitle(HomePage.mainPageTitle, driver); IWebElement BigIcon_Approve = searchElementByText("Approve", HomePage.allIcons); BigIcon_Approve.Click(); ApprovePage.fieldSearch.SendKeys(packageId); Thread.Sleep(2000); ApprovePage.buttonViewPackage.Click(); // Open the pakage in a new tab string tabManagePackage = RememberMyCurrentWindow(driver); string title = "CreatePackage - Fixed Price Repair"; SwitchToWindow(tabManagePackage, title, driver); Thread.Sleep(3000); // Verify that the package status was changed WaitForElement(ApprovePage.packageStatus); StringAssert.Contains(packageStatus, ApprovePage.packageStatus.Text, "Error!"); }
public void Test_A_2_ManagePackageAddContent(string role) { // TESTparameters: Test_C_ManagePackageAddContent string mainGroup = "00 - General"; string subGroup = "00 - Vehicle, complete"; string vehicleType = "All Scania Vehicles"; string variantDescription = "VariantDescription"; string reasonForPackage = "ReasonForPackage"; string packageName = "PackageToManage"; string packageDescription = "PackageDescription"; string workorderText = "WorkorderText"; string invoiceText = "InvoiceText"; string parts = "1301111"; string labour = "01015111"; string sundry = "18"; string approval = "GLOBAL\\testfprpricer (FPRPRICER IWNP)"; // --------------------------------------------------------- LoginPage.LoginAs(role); verifyPageTitle(HomePage.mainPageTitle, driver); // Navigate Packages -> Create HomePage.menuPackages.Click(); // Wait for page to load WaitForAjax(driver, 10, true); // Click on menu "Create" HomePage.menuCreate.Click(); //Click on button Next WaitForElement(SearchPage.buttonNext); SearchPage.buttonNext.Click(); // Generate package name with the current timestamp packageName = packageName + " " + DateTime.Now.ToString("yyyy-MM-dd-hhmm-ss"); // Fill out description form WaitForElement(DescriptionPage.listMainGroup); DescriptionPage.ToFillOutDescription(mainGroup, subGroup, vehicleType, variantDescription, reasonForPackage, packageName, packageDescription, workorderText, invoiceText); // Save the package DescriptionPage.buttonSave.Click(); // Close toast message ContentPage.alertMessage.Click(); // Navigate Packages -> Manage PackagesMenu.buttonManage.Click(); Thread.Sleep(2000); // Search for the package ManagePackages.fieldSearch.SendKeys(packageName); Thread.Sleep(2000); ManagePackages.buttonViewPackage.Click(); // Open the pakage in a new tab string tabManagePackage = RememberMyCurrentWindow(driver); SwitchToWindow(tabManagePackage, DescriptionPage.createPackageTitle, driver); // Wait for button Edit on Preview page and do click on it WaitForElement(PreviewPage.buttonEdit); PreviewPage.buttonEdit.Click(); // Navigate to the Content page DescriptionPage.buttonContent.Click(); WaitForElements(ContentPage.allDropDownLists); // Fill out content form ContentPage.ChoosePartLabourAndSundry(parts, labour, sundry); WaitForElement(ContentPage.checkbox_MAIN_PART); ContentPage.checkbox_MAIN_PART.Click(); packageId = ContentPage.GetPackageId(); // Save the package ContentPage.buttonSave.Click(); // Verify that the package was saved successfully WaitForElement(ContentPage.alertMessage); StringAssert.Contains("Success! Package has been saved", DescriptionPage.alertMessage.Text, "Error when create a package with the role -" + role + " -"); }