//This tests uses the app.config value to pick a manager and change SP to use that salesperson to login. It then checks user has landed on a manager version of the dashboard page. public void ChangeUserToAManagerTest() { //Setup reporting for this test ExtentTest test = MyDriverManager.report.CreateTest("ChangeUserToAManagerTest"); //Setup Page(s) NewDashboardPage theDashboardPage = new NewDashboardPage(MyDriverManager.driver); NewManagerDashboardPage theManagerDashboardPage = new NewManagerDashboardPage(MyDriverManager.driver); //Go to the the initial page MyDriverManager.goToDashboardPage(); theDashboardPage.waitForDashboardPageToLoad(); //Set User theDashboardPage.clickOnUserCircle(); theDashboardPage.populateUserFreeTextBox(ConfigurationWrapper.ManagerUserName()); theDashboardPage.clickOnChangeTheUserBtn(); //Check we are on manager version of Dashboard theManagerDashboardPage.waitForPageToLoad(); //Set reporting info test.Pass("User successfully changed to manager"); test.Log(Status.Pass, "ChangeUserToAManagerTest passed"); }
//This tests uses the app.config value to pick a manager and change SP to use that salesperson to login. It then checks user has landed on a manager version of the dashboard page. public void ChageUserToAManagerTest() { using (IWebDriver driver = WebDriverManager.WebDriverManager.GetWebDriverForConfig()) { string page = EnvironmentConfig.ConfigurationWrapper.GetURLFromEnvironmentKey(); string actualValue = DashboardPage.getTextForHeader(driver); while (actualValue == null) { driver.Url = page; } Assert.IsTrue(actualValue.Contains("SKILLS LICENCES"), actualValue + " doesn't contain 'SKILLS LICENCES'"); DashboardPage.userCircle(driver).Click(); DashboardPage.changeUserFreeTextBox(driver).SendKeys(ConfigurationWrapper.ManagerUserName()); DashboardPage.changeTheUserButton(driver).Click(); string ManagerDashboardHeader = DashboardPage.getTextForHeader(driver); Assert.IsTrue(ManagerDashboardHeader.Contains("APPROVALS PENDING"), ManagerDashboardHeader + " doesn't contain 'APPROVALS PENDING'"); } }
//This test creates a self-approved licence and returns user to dashboard public void CreateManagerDeclinedSkillsLicenceTest() { //Constants string customerCompanyName = "TEST QC CUSTOMER"; string customerNumber = "3402211"; string contactSurname = "Marshall"; string customerEmailAddress = "*****@*****.**"; string quoteValue = "1000.00"; string discountValue = "99"; //Setup Page(s) NewDashboardPage theDashboardPage = new NewDashboardPage(MyDriverManager.driver); NewGetMyCustomersPage theGetMyCustomersPage = new NewGetMyCustomersPage(MyDriverManager.driver); NewGetMyCustomerContactsPage theCustomerContactsPage = new NewGetMyCustomerContactsPage(MyDriverManager.driver); NewGetMyLicencesPage theGetMyLicencesPage = new NewGetMyLicencesPage(MyDriverManager.driver); NewAlterSkillsLicencePage theAlterSkillsLicencePage = new NewAlterSkillsLicencePage(MyDriverManager.driver); NewManagerApprovalPage theManagerApprovalPage = new NewManagerApprovalPage(MyDriverManager.driver); NewManagerDashboardPage theManagerDashboardPage = new NewManagerDashboardPage(MyDriverManager.driver); NewShowManagerSkillsLicencePage theShowManagerSkillsLicencePage = new NewShowManagerSkillsLicencePage(MyDriverManager.driver); //Go to the initial page MyDriverManager.goToDashboardPage(); theDashboardPage.waitForDashboardPageToLoad(); //Set User theDashboardPage.clickOnUserCircle(); theDashboardPage.populateUserFreeTextBox(ConfigurationWrapper.SalespersonUserName()); theDashboardPage.clickOnChangeTheUserBtn(); theDashboardPage.waitForDashboardPageToLoad(); //Get Initial Declined Skills Licence Count string declinedCountSL = theDashboardPage.getDeclinedCount_SL(); int declinedCountSL_int = int.Parse(declinedCountSL); //Create Skill Licence theDashboardPage.clickOnCreateSkillsLicenceButton(); //Select customer theGetMyCustomersPage.waitForPageToLoad(); theGetMyCustomersPage.populateCustomerSearchBox(customerCompanyName); theGetMyCustomersPage.selectCustomerByNumber(customerNumber); //Select contact theCustomerContactsPage.waitForPageToLoad(); theCustomerContactsPage.clickOnBothButton(); theCustomerContactsPage.populateContactsSearchBox(contactSurname); theCustomerContactsPage.selectCustomerEmail(customerEmailAddress); //Select licence template theGetMyLicencesPage.waitForPageToLoad(); theGetMyLicencesPage.clickOnBankTemplate(); //Enter quote details theAlterSkillsLicencePage.waitForPageToLoad(); theAlterSkillsLicencePage.populateQuoteATextBox(quoteValue); theAlterSkillsLicencePage.enterAmazonAsVendor(); Assert.IsTrue(theAlterSkillsLicencePage.isTechTypeAmazonSpecialistDisplayed(), "Tech Type Specialist not displayed for vendor Amazon"); //Enter a discount and check for hierarchy warning text theAlterSkillsLicencePage.enterDiscountForAmazonQuoteA(discountValue); string warningText = theAlterSkillsLicencePage.getHierarchyWarningText(); Assert.IsTrue(warningText.Equals("Over Sales Director"), warningText + " does NOT equal 'Over Sales Director'"); theAlterSkillsLicencePage.clickOnSaveAndSendButton(); //Select manager and send for approval theManagerApprovalPage.waitForPageToLoad(); theManagerApprovalPage.selectAnotherManager(ConfigurationWrapper.ManagerFullName()); theManagerApprovalPage.clickOnSubmitForManagerApprovalButton(); theDashboardPage.waitForDashboardPageToLoad(); //Set User to manager theDashboardPage.clickOnUserCircle(); theDashboardPage.populateUserFreeTextBox(ConfigurationWrapper.ManagerUserName()); theDashboardPage.clickOnChangeTheUserBtn(); //Check contact in manager dashboard page theManagerDashboardPage.waitForPageToLoad(); string contactName = theManagerDashboardPage.getContactText(); Assert.IsTrue(contactName.Contains(ConfigurationWrapper.ContactUserName()), contactName + " does NOT contain contact's username"); theManagerDashboardPage.clickOnSkillsLicenceContact(); //Decline the SKills Licence via Manager Dashboard Page theShowManagerSkillsLicencePage.waitForPageToLoad(); theShowManagerSkillsLicencePage.clickOnDeclineSkillsLicenceButton(); // Set User back to salesperson theManagerDashboardPage.waitForPageToLoad(); theManagerDashboardPage.clickOnUserCircle(); theManagerDashboardPage.populateUserFreeTextBox(ConfigurationWrapper.SalespersonUserName()); theManagerDashboardPage.clickOnChangeTheUserButton(); theDashboardPage.waitForDashboardPageToLoad(); // Check Declined Skills Licence Count increased by 1 int expectedValue_int = declinedCountSL_int + 1; int updatedDeclinedCountSL_int = int.Parse(theDashboardPage.getDeclinedCount_SL()); Assert.IsTrue(updatedDeclinedCountSL_int == expectedValue_int, "Expected declinedCountSL= " + expectedValue_int + " actually got " + updatedDeclinedCountSL_int); }
//This test creates a self-approved licence and returns user to dashboard public void CreateManagerApprovedSkillsLicenceTest() { using (IWebDriver driver = WebDriverManager.WebDriverManager.GetWebDriverForConfig()) { string page = EnvironmentConfig.ConfigurationWrapper.GetURLFromEnvironmentKey(); string actualValue = DashboardPage.getTextForHeader(driver); while (actualValue == null) { driver.Url = page; } Assert.IsTrue(actualValue.Contains("SKILLS LICENCES"), actualValue + " doesn't contain 'SKILLS LICENCES'"); DashboardPage.userCircle(driver).Click(); DashboardPage.changeUserFreeTextBox(driver).SendKeys(ConfigurationWrapper.SalspersonUserName()); DashboardPage.changeTheUserButton(driver).Click(); string actualValue1 = DashboardPage.getTextForHeader(driver); Assert.IsTrue(actualValue1.Contains("SKILLS LICENCES"), actualValue1 + " doesn't contain 'SKILLS LICENCES'"); string actualValue2 = DashboardPage.getTextForHeader(driver); Assert.IsTrue(actualValue2.Contains("SKILLS LICENCES"), actualValue2 + " doesn't contain 'SKILLS LICENCES'"); DashboardPage.createSkillsLicenceButton(driver).Click(); string actualValue3 = GetMyCustomersPage.getTextForHeader(driver); Assert.IsTrue(actualValue3.Contains("SELECT COMPANY"), actualValue3 + " doesn't contain 'SELECT COMPANY'"); GetMyCustomersPage.customerSearchBox(driver).SendKeys("TEST QC CUSTOMER"); GetMyCustomersPage.customerSelect(driver).Click(); string actualValue4 = GetMyCustomerContactsPage.getTextForHeader(driver); Assert.IsTrue(actualValue4.Contains("SELECT CONTACT"), actualValue4 + " doesn't contain 'SELECT CONTACT'"); GetMyCustomerContactsPage.delegateButton(driver).Click(); GetMyCustomerContactsPage.contactSelect(driver).Click(); string actualValue5 = GetMylicencesPage.getTextForHeader(driver); Assert.IsTrue(actualValue5.Contains("SELECT TEMPLATE"), actualValue5 + " doesn't contain 'SELECT TEMPLATE'"); GetMylicencesPage.blankTemplate(driver).Click(); string actualValue6 = AlterSkillsLicencePage.getTextForHeader(driver); Assert.IsTrue(actualValue6.Contains("IN DRAFT"), actualValue6 + " doesn't contain 'IN DRAFT'"); AlterSkillsLicencePage.quoteATextBox(driver).SendKeys("5555.55"); AlterSkillsLicencePage.itPracticeSelect(driver).Click(); AlterSkillsLicencePage.itAllVendors(driver).Click(); AlterSkillsLicencePage.agileAndScrumPremium(driver).Click(); AlterSkillsLicencePage.QuoteADiscountBox(driver).Click(); AlterSkillsLicencePage.QuoteADiscountBox(driver).SendKeys("99"); AlterSkillsLicencePage.QuoteADiscountBox(driver).SendKeys(Keys.Tab); // String actualValue10 = AlterSkillsLicencePage.checkColourOfQuoteADiscountBox(driver); // Assert.IsTrue(actualValue10.Equals("0.0.0"), actualValue10 + "colour wrong"); AlterSkillsLicencePage.checkColourOfQuoteADiscountBox(driver); string actualValue7 = AlterSkillsLicencePage.getHierarchyWarning(driver); Assert.IsTrue(actualValue7.Contains("Over Sales Director"), actualValue7 + " doesn't contain 'Over Sales Director'"); AlterSkillsLicencePage.clickOnSaveAndSendButton(driver); string actualvalue8 = ManagerApprovalPage.getTextForHeader(driver); Assert.IsTrue(actualvalue8.Contains("MANAGER APPROVAL"), actualvalue8 + " doesn't contain 'MANAGER APPROVAL'"); ManagerApprovalPage.clickOnManagerNameTickbox(driver); ManagerApprovalPage.clickOnSendToManagerButton(driver); string actualvalue9 = DashboardPage.getTextForHeader(driver); Assert.IsTrue(actualvalue9.Contains("SKILLS LICENCES"), actualvalue9 + " doesn't contain 'SKILLS LICENCES'"); DashboardPage.userCircle(driver).Click(); DashboardPage.changeUserFreeTextBox(driver).SendKeys(ConfigurationWrapper.ManagerUserName()); DashboardPage.changeTheUserButton(driver).Click(); string ManagerDashboardHeader = DashboardPage.getTextForHeader(driver); Assert.IsTrue(ManagerDashboardHeader.Contains("APPROVALS PENDING"), ManagerDashboardHeader + " doesn't contain 'APPROVALS PENDING'"); string ManagerPendingApprovalsLicence = ManagerDashboardPage.getSkillsLicencePendingApproval(driver); Assert.IsTrue(ManagerPendingApprovalsLicence.Contains(ConfigurationWrapper.ContactUserName()), ManagerPendingApprovalsLicence + " doesn't contain 'Contact's Username'"); ManagerDashboardPage.selectSkillsLicenceForReview(driver).Click(); string ShowManagerSkillsLicence = ShowManagerSkillsLicencePage.getTextForHeader(driver); Assert.IsTrue(ShowManagerSkillsLicence.Contains("AWAITING APPROVAL"), ShowManagerSkillsLicence + " doesn't contain 'AWAITING APPROVAL'"); ShowManagerSkillsLicencePage.selectApproveSkillsLicenceButton(driver).Click(); string ManagerDashboardHeader1 = DashboardPage.getTextForHeader(driver); Assert.IsTrue(ManagerDashboardHeader1.Contains("APPROVALS PENDING"), ManagerDashboardHeader1 + " doesn't contain 'APPROVALS PENDING'"); } }