コード例 #1
0
        public void ATC4433_CommonTriggerPointCopyAddressFromParent()
        {
            //Login to CRM as General staff user.
            User user = this.environment.GetUser(SecurityRole.GeneralStaff);
            new LoginDialog().Login(user.Id, user.Password);

            //Navigate to: Client Services group > Clients tile
            HomePage homePage = new HomePage(driver);
            homePage.HoverCRMRibbonTab();
            homePage.ClickClientServicesRibbonButton();
            homePage.HoverClientServicesRibbonTab();
            homePage.ClickClientsRibbonButton();

            //Create Parent Organization with Postal address
            ClientsSearchPage clientsSearchPage = new ClientsSearchPage(driver);
            clientsSearchPage.ClickNewClientButton();

            ClientPage clientPage = new ClientPage(driver);
            clientPage.ClickPageTitle();
            string parentOrganisation = "TCParentOrganization"+ UICommon.GetRandomString(5);

            clientPage.SetClientType("Organisation");
            clientPage.SetOrganizationName(parentOrganisation);
            clientPage.ClickSaveButton();

            string BaseWindow = driver.CurrentWindowHandle;
            clientPage.ClickCreateNewClientAddressButton("rta_postaladdressid");
            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "Client Address");
            ClientNewAddressPage clientNewAddressPage = new ClientNewAddressPage(driver);
            clientNewAddressPage.SetAddressDetails("Australian Physical", 10, "GRACELAND");

            driver = driver.SwitchTo().Window(BaseWindow);
            clientPage = new ClientPage(driver);
            Assert.AreEqual("10 GRACELAND", clientPage.GetAddressValue("rta_postaladdressid"));

            clientPage.ClickSaveCloseButton();

            //Create child with parent organization has postal address
            clientsSearchPage = new ClientsSearchPage(driver);
            clientsSearchPage.ClickNewClientButton();

            clientPage = new ClientPage(driver);
            clientPage.ClickPageTitle();

            string childOrganisation = "TCChildOrganization"+ UICommon.GetRandomString(5);
            clientPage.SetClientType("Organisation");
            clientPage.SetOrganizationName(childOrganisation);
            clientPage.SetParentOrganization(parentOrganisation.ToUpper());
            clientPage.ClickSaveButton();
            string clientID = clientPage.GetClientID();

            //Select "Start Dialog" item from top entity menu.
            clientPage.ClickStartDialogButton();

            /*Run dialog "Copy an address from parent organisation":
             *For client where parent organisation has postal address but no physical address
             *Select YES for Postal address and YES for Physical addres
             */
            Table table = new Table(clientPage.GetProcessSearchResultTable());
            table.ClickCell("Process Name", "Copy an address from parent organisation", "Created On");

            BaseWindow = driver.CurrentWindowHandle;
            clientPage.ClickDialogAddButton();

            Thread.Sleep(2000);
            driver = UICommon.SwitchToNewBrowserWithTitle(driver, BaseWindow, "Copy an address");
            CopyAddressPage copyAddressPage = new CopyAddressPage(driver);

            copyAddressPage.SetCopyPhysicalAddressYes();
            copyAddressPage.SetCopyPostalAddressYes();

            //User is notified that no Physical address is copied.
            copyAddressPage.ClickNextButton();
            Assert.AreEqual(copyAddressPage.GetErrorMessage(), "The parent organisation does not have a physical address");

            /*For client where parent organisation has postal address but no physical address
             *Select NO for Postal address and YES for Physical address
             */
            copyAddressPage.ClickPreviousButton();
            copyAddressPage.SetCopyPostalAddressNo();
            copyAddressPage.SetCopyPhysicalAddressYes();
            copyAddressPage.ClickNextButton();
            ////User is notified that no Physical address is copied.
            Assert.AreEqual(copyAddressPage.GetErrorMessage(), "The parent organisation does not have a physical address");

            /* For client where parent organisation has postal address but no physical address
             * Select YES for Postal address and NO for Physical address
             */
            copyAddressPage.ClickPreviousButton();
            copyAddressPage.SetCopyPostalAddressYes();
            copyAddressPage.SetCopyPhysicalAddressNo();
            copyAddressPage.ClickNextButton();

            //Copy is successful.
            StringAssert.Contains(copyAddressPage.GetFinishMessage(), "This is the end of the dialog. Click Finish to close it");
            copyAddressPage.ClickFinishButton();

            driver = driver.SwitchTo().Window(BaseWindow);
            clientPage.ClickSaveCloseButton();
            Thread.Sleep(5000);
            clientsSearchPage = new ClientsSearchPage(driver);
            clientsSearchPage.SetClientSearchText(clientID);

            Table searchTable = new Table(clientsSearchPage.GetSearchResultTable());
            searchTable.ClickCellValue("RTA Client Id", clientID, "Full Name");

            clientPage = new ClientPage(driver);
            Assert.AreEqual(clientPage.GetPostalAddress(), "10 GRACELAND");
        }