예제 #1
0
        public void Select_Catalog_Product()
        {
            _product.Click();
            Browser.WaitForPageToLoad();
            var catalogTitle = Browser.GetDriver().FindElement(_byCatalogTitle);

            Assert.AreEqual(catalogTitle.Text, RunConfigurator.GetValue("product"));
        }
예제 #2
0
 public void AddRegisteredClient()
 {
     try
     {
         User.AtMainForm().GoToClientRegistration();
         //Fill in First name
         User.AtRegistrationForm().SetFirstName(StringRandomazer.MakeRandomFirstName());
         //Fill in Last name
         User.AtRegistrationForm().SetLastName(StringRandomazer.MakeRandomLastName());
         //Fill in Phone
         User.AtRegistrationForm().SetPhone(StringRandomazer.MakeRandomPhone());
         //Fill in Email
         User.AtRegistrationForm().SetEmail(RunConfigurator.GetValue("client.usermail"));
         User.AtRegistrationForm().GoNext();
         //Fill in Random Company Name
         User.AtRegistrationForm().SetClientName(StringRandomazer.MakeRandomClientName());
         //Fill in Address
         User.AtRegistrationForm().SetAddress(StringRandomazer.MakeRandomAddress());
         //Fill in City
         User.AtRegistrationForm().SetCity(RunConfigurator.GetValue("client.city"));
         //Fill in State
         User.AtRegistrationForm().SetState(RunConfigurator.GetValue("client.state"));
         //Fill in Country
         User.AtRegistrationForm().SetCountryDropDown(RunConfigurator.GetValue("client.country"));
         //Fill in zip
         User.AtRegistrationForm().SetZip(StringRandomazer.MakeRandomZip());
         //Procced to Register
         User.AtRegistrationForm().Submit();
         User.AtOffice365LoginForm().SetLogin(RunConfigurator.GetValue("client.usermail"));
         User.AtOffice365LoginForm().SetPassword(RunConfigurator.GetValue("client.password"));
         User.AtOffice365LoginForm().NextClick();
         //Validate Tenant Project List View is displayed with no data.
         User.AtTenantRestructuringForm().AssertNoDataForNewClient();
     }
     catch (Exception)
     {
         LogHtml(Browser.GetDriver().PageSource);
         throw;
     }
 }
예제 #3
0
 public void GoToClientRegistration()
 {
     Log.Info("Navigating to client registration");
     Browser.GetDriver().Navigate().GoToUrl(RunConfigurator.GetValue("baseurl") + "Account/Register");
 }
예제 #4
0
 /// <summary>
 ///     Gets the count.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <returns>System.String.</returns>
 public void GoToMainPage()
 {
     Browser.GetDriver().Navigate().GoToUrl(RunConfigurator.GetValue("baseurl"));
 }
예제 #5
0
        public override void Run()
        {
            try
            {
                var sourceLocalLogin           = RunConfigurator.GetTenantValue(tenants, "source", "aduser");
                var sourceLocalPassword        = RunConfigurator.GetTenantValue(tenants, "source", "adpassword");
                var localExchangePowerShellUri = RunConfigurator.GetTenantValue(tenants, "source", "uri");

                var sourceAzureAdSyncLogin    = sourceLocalLogin;
                var sourceAzureAdSyncPassword = sourceLocalPassword;
                var sourceAzureAdSyncServer   = RunConfigurator.GetTenantValue(tenants, "source", "azureAdSyncServer");

                var sourceCloudLogin    = RunConfigurator.GetTenantValue(tenants, "source", "user");
                var sourceCloudPassword = RunConfigurator.GetTenantValue(tenants, "source", "password");

                var testMailboxPassword      = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//dirsync//password");
                var testMailboxUpnSuffix     = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//dirsync//forest");
                var testMailboxDestinationOU = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//dirsync//ou");
                var testMailboxNamePrefix    = RunConfigurator.GetValueByXpath("//metaname[text()='client1']/..//metaname[text()='project3']/..//metaname[text()='entry1']/..//probeprefix");

                var p365DiscoveryGroup = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='{adGroupName}']/..//name");

                var msolUri           = RunConfigurator.GetValue("o365url");
                var msolConnectParams = RunConfigurator.GetValue("msolconnectargs");

                using (var process = new PsLauncher().LaunchPowerShellInstance("Integration_Probe.ps1",
                                                                               $" -localLogin {sourceLocalLogin}" +
                                                                               $" -localPassword {sourceLocalPassword}" +
                                                                               $" -localExchangePowerShellUri {localExchangePowerShellUri}" +

                                                                               $" -azureAdSyncLogin {sourceAzureAdSyncLogin}" +
                                                                               $" -azureAdSyncPassword {sourceAzureAdSyncPassword}" +
                                                                               $" -azureAdSyncServer {sourceAzureAdSyncServer}" +

                                                                               $" -cloudLogin {sourceCloudLogin}" +
                                                                               $" -cloudPassword {sourceCloudPassword}" +

                                                                               $" -testMailboxPassword {testMailboxPassword}" +
                                                                               $" -testMailboxUPNSuffix {testMailboxUpnSuffix}" +
                                                                               $" -testMailboxOU {testMailboxDestinationOU}" +
                                                                               $" -testMailboxNamePrefix {testMailboxNamePrefix}" +

                                                                               $" -p365DiscoveryGroup {p365DiscoveryGroup}" +

                                                                               $" -msolUri {msolUri}" +
                                                                               $" -msolConnectParams \"{msolConnectParams}\"",
                                                                               "x64"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        var line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("UserPrincipalName"))
                        {
                            Store.ProbeSourceMailbox = line.Substring(line.LastIndexOf(':') + 1, line.LastIndexOf('@') - line.LastIndexOf(':') - 1).Trim();
                            break;
                        }
                    }
                    process.WaitForExit(60000);

                    if (process.ExitCode != 0)
                    {
                        throw new Exception(string.Format("PowerShell script returned exit code: {0}", process.ExitCode));
                    }
                }
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "PowerShell error");
                throw e;
            }
            try
            {
                LogIn(RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//user"),
                      RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//password"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Login error");
                throw e;
            }
            try
            {
                SelectProject(RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//name"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Selecting project error");
                throw e;
            }
            try
            {
                User.AtProjectOverviewForm().EditTenants();
                User.AtTenantsConfigurationForm().OpenDiscoveryTab();
                User.AtTenantsConfigurationForm().RunDiscovery(RunConfigurator.GetTenantValue(tenants, "source", "name"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Run discovery error");
                throw e;
            }
            try
            {
                User.AtTenantsConfigurationForm().GoToDashboard();
                User.AtProjectOverviewForm().WaitTillDiscoveryIsComplete(30, RunConfigurator.GetTenantValue(tenants, "source", "name"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Wait for discovery is completed error");
                throw e;
            }
            try
            {
                User.AtProjectOverviewForm().OpenUsersList();
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Navigating to user migration view error");
                throw e;
            }
            try
            {
                User.AtUsersForm().PerformSearch(Store.ProbeSourceMailbox);
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Search error");
                throw e;
            }
            string sourceMailbox = Store.ProbeSourceMailbox.Trim() +
                                   RunConfigurator.GetValueByXpath(
                $"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//source");

            try
            {
                int counter = 0;
                while (!User.AtUsersForm().IsLineExist(sourceMailbox) && counter < 35)
                {
                    Log.Info("Source mailbox is not displayed");
                    Browser.GetDriver().Navigate().Refresh();
                    counter++;
                }
                User.AtUsersForm().VerifyLineisExist(sourceMailbox);
                User.AtUsersForm().WaitForState(sourceMailbox, State.NoMatch, 30000);
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Verifying mailbox is displayed error");
                throw e;
            }
            try
            {
                try
                {
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                }
                catch (Exception)
                {
                    Log.Info("Error selecting mailbox, retrying");
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                }
                User.AtUsersForm().SelectAction(ActionType.Prepare);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                try
                {
                    User.AtUsersForm().ConfirmPrepare();
                }
                catch (Exception)
                {
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                    User.AtUsersForm().ConfirmPrepare();
                }
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Preparing error");
                throw e;
            }

            try
            {
                User.AtUsersForm().OpenDetailsByLocator(sourceMailbox);
                int count    = 0;
                int maxCount = 60;

                while (!User.AtUsersForm().IsElementPresent("Job Finishing Label", "//*[contains(text(), 'Finishing')]") && count < maxCount)
                {
                    Thread.Sleep(60000);
                    User.AtUsersForm().DetailsRefresh();
                    count++;
                }

                User.AtUsersForm().DetailsClose();

                if (count < maxCount)
                {
                    try
                    {
                        var targetAzureAdSyncLogin    = RunConfigurator.GetTenantValue(tenants, "target", "aduser");
                        var targetAzureAdSyncPassword = RunConfigurator.GetTenantValue(tenants, "target", "adpassword");
                        var targetAzureAdSyncServer   = RunConfigurator.GetTenantValue(tenants, "target", "azureAdSyncServer");

                        using (var process = new PsLauncher().LaunchPowerShellInstance("ADSync.ps1",
                                                                                       $" -login {targetAzureAdSyncLogin}" +
                                                                                       $" -password {targetAzureAdSyncPassword}" +
                                                                                       $" -server {targetAzureAdSyncServer}",
                                                                                       "x64"))
                        {
                            while (!process.StandardOutput.EndOfStream)
                            {
                                var line = process.StandardOutput.ReadLine();
                                Log.Info(line);
                            }

                            process.WaitForExit(60000);

                            if (process.ExitCode != 0)
                            {
                                throw new Exception(string.Format("PowerShell script returned exit code: {0}", process.ExitCode));
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        InsertDataToSql(DateTime.UtcNow, "Target Azure AD Sync Failed.");
                        throw e;
                    }
                }

                User.AtUsersForm().WaitForState(sourceMailbox, State.Prepared, 90000);
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Wait for Prepared state error");
                throw e;
            }
            InsertDataToSql(DateTime.UtcNow);
        }
예제 #6
0
        public override void Run()
        {
            try
            {
                var sourceLocalLogin    = RunConfigurator.GetTenantValue(tenants, "source", "aduser");
                var sourceLocalPassword = RunConfigurator.GetTenantValue(tenants, "source", "adpassword");
                var sourceLocalExchangePowerShellUri = RunConfigurator.GetTenantValue(tenants, "source", "uri");

                var sourceAzureAdSyncLogin    = sourceLocalLogin;
                var sourceAzureAdSyncPassword = sourceLocalPassword;
                var sourceAzureAdSyncServer   = RunConfigurator.GetTenantValue(tenants, "source", "azureAdSyncServer");

                var sourceCloudLogin    = RunConfigurator.GetTenantValue(tenants, "source", "user");
                var sourceCloudPassword = RunConfigurator.GetTenantValue(tenants, "source", "password");

                var targetLocalLogin    = RunConfigurator.GetTenantValue(tenants, "target", "aduser");
                var targetLocalPassword = RunConfigurator.GetTenantValue(tenants, "target", "adpassword");
                var targetLocalExchangePowerShellUri = RunConfigurator.GetTenantValue(tenants, "target", "uri");

                var targetAzureAdSyncLogin    = targetLocalLogin;
                var targetAzureAdSyncPassword = targetLocalPassword;
                var targetAzureAdSyncServer   = RunConfigurator.GetTenantValue(tenants, "target", "azureAdSyncServer");

                var targetCloudLogin    = RunConfigurator.GetTenantValue(tenants, "target", "user");
                var targetCloudPassword = RunConfigurator.GetTenantValue(tenants, "target", "password");

                var testMailboxNamePrefix    = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//probeprefix");
                var testMailboxDestinationOU = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//dirsync//ou");

                var testMailboxSourceUpnSuffix = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//source");
                var testMailboxTargetUpnSuffix = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//target");
                var testMailboxPassword        = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//dirsync//password");

                var p365DiscoveryGroup = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='{adGroupName}']/..//name");

                var msolUri           = RunConfigurator.GetValue("o365url");
                var msolConnectParams = RunConfigurator.GetValue("msolconnectargs");

                using (var process = new PsLauncher().LaunchPowerShellInstance("NewProbeUser.ps1",
                                                                               $" -sourceLocalLogin {sourceLocalLogin}" +
                                                                               $" -sourceLocalPassword {sourceLocalPassword}" +
                                                                               $" -sourceLocalExchangePowerShellUri {sourceLocalExchangePowerShellUri}" +
                                                                               $" -sourceAzureAdSyncLogin {sourceAzureAdSyncLogin}" +
                                                                               $" -sourceAzureAdSyncPassword {sourceAzureAdSyncPassword}" +
                                                                               $" -sourceAzureAdSyncServer {sourceAzureAdSyncServer}" +
                                                                               $" -sourceCloudLogin {sourceCloudLogin}" +
                                                                               $" -sourceCloudPassword {sourceCloudPassword}" +
                                                                               $" -targetLocalLogin {targetLocalLogin}" +
                                                                               $" -targetLocalPassword {targetLocalPassword}" +
                                                                               $" -targetLocalExchangePowerShellUri {targetLocalExchangePowerShellUri}" +
                                                                               $" -targetAzureAdSyncLogin {targetAzureAdSyncLogin}" +
                                                                               $" -targetAzureAdSyncPassword {targetAzureAdSyncPassword}" +
                                                                               $" -targetAzureAdSyncServer {targetAzureAdSyncServer}" +
                                                                               $" -targetCloudLogin {targetCloudLogin}" +
                                                                               $" -targetCloudPassword {targetCloudPassword}" +
                                                                               $" -testMailboxNamePrefix {testMailboxNamePrefix}" +
                                                                               $" -testMailboxOU {testMailboxDestinationOU}" +
                                                                               $" -testMailboxSourceUPNSuffix {testMailboxSourceUpnSuffix}" +
                                                                               $" -testMailboxTargetUPNSuffix {testMailboxTargetUpnSuffix}" +
                                                                               $" -testMailboxPassword {testMailboxPassword}" +
                                                                               $" -p365DiscoveryGroup {p365DiscoveryGroup}" +
                                                                               $" -msolUri {msolUri}" +
                                                                               $" -msolConnectParams \"{msolConnectParams}\"",
                                                                               "x64"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        var line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("UserPrincipalName") && String.IsNullOrWhiteSpace(Store.ProbeSourceMailbox))
                        {
                            Store.ProbeSourceMailbox = line.Substring(line.LastIndexOf(':') + 1, line.LastIndexOf('@') - line.LastIndexOf(':') - 1).Trim();
                        }
                        else if (line.Contains("UserPrincipalName") && String.IsNullOrWhiteSpace(Store.ProbeTargetMailbox))
                        {
                            Store.ProbeTargetMailbox = line.Substring(line.LastIndexOf(':') + 1, line.LastIndexOf('@') - line.LastIndexOf(':') - 1).Trim();
                        }
                    }

                    process.WaitForExit(60000);

                    if (process.ExitCode != 0)
                    {
                        throw new Exception(string.Format("PowerShell script returned exit code: {0}", process.ExitCode));
                    }

                    if (string.IsNullOrEmpty(Store.ProbeSourceMailbox) || string.IsNullOrEmpty(Store.ProbeTargetMailbox))
                    {
                        throw new Exception("Could not create source or target user");
                    }
                }
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "PowerShell/Wait till user will be created step error");
                throw;
            }
            try
            {
                LogIn(RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//user"),
                      RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//password"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Error during login and selecting role");
                throw;
            }
            try
            {
                SelectProject(RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//name"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Error selecting project");
                throw;
            }
            try
            {
                User.AtProjectOverviewForm().EditTenants();
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Error edditing tenants");
                throw;
            }

            try
            {
                User.AtTenantsConfigurationForm().OpenDiscoveryTab();
                User.AtTenantsConfigurationForm().RunDiscovery(RunConfigurator.GetTenantValue(tenants, "source", "name"));
                User.AtTenantsConfigurationForm().RunDiscovery(RunConfigurator.GetTenantValue(tenants, "target", "name"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Error retriggering discovery");
                throw;
            }
            try
            {
                User.AtTenantsConfigurationForm().GoToDashboard();
                User.AtProjectOverviewForm().WaitTillDiscoveryIsComplete(30, RunConfigurator.GetTenantValue(tenants, "source", "name"));
                User.AtProjectOverviewForm().WaitTillDiscoveryIsComplete(30, RunConfigurator.GetTenantValue(tenants, "target", "name"));
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Discovery error");
                throw;
            }
            try
            {
                User.AtProjectOverviewForm().OpenUsersList();
                User.AtUsersForm().PerformSearch(Store.ProbeSourceMailbox);
                int counter   = 0;
                var sourceUpn = string.Format("{0}@{1}", Store.ProbeSourceMailbox, RunConfigurator.GetValueByXpath("//metaname[text()='client1']/..//metaname[text()='project2']/..//metaname[text()='entry1']/..//source"));
                while (!User.AtUsersForm().IsLineExist(sourceUpn) && counter < 35)
                {
                    Log.Info("Source mailbox is not displayed");
                    Browser.GetDriver().Navigate().Refresh();
                    counter++;
                }
                User.AtUsersForm().VerifyLineisExist(sourceUpn);
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Error validating source mailbox");
                throw;
            }

            try
            {
                int counter   = 0;
                var targetUpn = string.Format("{0}@{1}", Store.ProbeTargetMailbox, RunConfigurator.GetValueByXpath("//metaname[text()='client1']/..//metaname[text()='project2']/..//metaname[text()='entry1']/..//target"));
                while (!User.AtUsersForm().IsLineExist(targetUpn) && counter < 35)
                {
                    Log.Info("Target mailbox is not displayed");
                    Browser.GetDriver().Navigate().Refresh();
                    counter++;
                }
                User.AtUsersForm().VerifyLineisExist(targetUpn);
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "Error validating target mailbox");
                throw;
            }
            InsertDataToSql(DateTime.UtcNow);
        }