public void Automation_PS_MO_PermissionsPrepareTest()
        {
            string sourceMailbox     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps4']/..//target");
            string sourceLogin       = RunConfigurator.GetTenantValue("T1->T2", "target", "user");
            string sourcePassword    = RunConfigurator.GetTenantValue("T1->T2", "target", "password");
            string permSourceMailbox = RunConfigurator.GetTenantValue("T1->T2", "target", "psuser2");;

            List <string> trustees = new List <string>();

            trustees.Add(permSourceMailbox);
            var trusteeString = string.Join(",", trustees);

            using (var process = new PsLauncher().LaunchPowerShellInstance("AddPermission.ps1",
                                                                           $" -login {sourceLogin}" +
                                                                           $" -password {sourcePassword}" +
                                                                           $" -mailbox {sourceMailbox}" +
                                                                           $" -trustees {trusteeString}" +
                                                                           $" -accessRights FullAccess"
                                                                           , "x64"))
            {
                while (!process.StandardOutput.EndOfStream)
                {
                    var line = process.StandardOutput.ReadLine();
                    Log.Info(line);

                    if (line.Contains("wasn't found"))
                    {
                        Log.Fatal(line);
                        Assert.Fail(line);
                    }
                }
                process.WaitForExit();
            }
        }
예제 #2
0
        public void PS_MD_StartDeltaDiscoveryTest()
        {
            string login               = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password            = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client              = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string projectName         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//name");
            string sourceTenant        = RunConfigurator.GetTenantValue("T1->T2", "source", "name");
            string sourceAdminLogin    = RunConfigurator.GetTenantValue("T1->T2", "source", "user");
            string sourceAdminPassword = RunConfigurator.GetTenantValue("T1->T2", "source", "password");
            string sourceMailbox1      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entry1']/..//source");

            try
            {
                using (var process = new PsLauncher().LaunchPowerShellInstance("DeltaDiscoveryModify.ps1",
                                                                               $" -slogin {sourceAdminLogin}" +
                                                                               $" -spassword {sourceAdminPassword}" +
                                                                               $" -mailbox {sourceMailbox1}",
                                                                               "x64"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        var line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                    }
                    process.WaitForExit();
                    LoginAndSelectRole(login, password, client);
                    SelectProject(projectName);
                    try
                    {
                        User.AtProjectOverviewForm().EditTenants();
                    }
                    catch (Exception)
                    {
                        User.AtProjectOverviewForm().EditTenants();
                    }
                    User.AtTenantsConfigurationForm().OpenDiscoveryTab();
                    User.AtTenantsConfigurationForm().RunDiscovery(sourceTenant);
                }
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #3
0
        public void PSwaits()
        {
            LoginAndSelectRole(RunConfigurator.GetValueByXpath("//metaname[text()='client1']/..//user"), RunConfigurator.GetValueByXpath("//metaname[text()='client1']/..//password"), RunConfigurator.GetValueByXpath("//metaname[text()='client1']/../name"));
            var launcher = new PsLauncher();
            var testProc = launcher.TestLaunchPowerShellInstance("TestScript.ps1", String.Empty, "x64");

            while (!testProc.StandardOutput.EndOfStream)
            {
                var line = testProc.StandardOutput.ReadLine();
                Log.Info(line);
                if (line.Contains("Press"))
                {
                    launcher.SuspendProcess();
                    Log.Info("SUCCESS");
                    Log.Info("SUCCESS");
                    Log.Info("SUCCESS");
                    Thread.Sleep(5000);
                    //KeySender.SendKeyToProcess(testProc);
                    launcher.ResumeProcess();
                }
            }
            testProc.WaitForExit(5000);
            SelectProject(RunConfigurator.GetValueByXpath("//metaname[text()='client1']/..//metaname[text()='project1']/..//name"));
        }
예제 #4
0
        public void Automation_IN_PS_CutoverTest()
        {
            string userName             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client               = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string project              = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//name");
            string sourceMailbox13      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry13']/..//source");
            string sourceMailbox14      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry14']/..//source");
            string sourceMailbox15      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry15']/..//source");
            string targetLogin          = RunConfigurator.GetTenantValue("T5->T6", "target", "user");
            string targetPassword       = RunConfigurator.GetTenantValue("T5->T6", "target", "password");
            string sourceLogin          = RunConfigurator.GetTenantValue("T5->T6", "source", "user");
            string sourcePassword       = RunConfigurator.GetTenantValue("T5->T6", "source", "password");
            string targetMailbox13      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry13']/..//target");
            string targetMailbox13Smtp  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry13']/..//targetsmtp");
            string targetMailbox13X500  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry13']/..//targetx500");
            string targetOnPremLogin    = RunConfigurator.GetTenantValue("T5->T6", "target", "aduser");
            string targetOnPremPassword = RunConfigurator.GetTenantValue("T5->T6", "target", "adpassword");
            string targetOnPremUri      = RunConfigurator.GetTenantValue("T5->T6", "target", "uri");

            try
            {
                LoginAndSelectRole(userName, password, client);
                SelectProject(project);
                User.AtProjectOverviewForm().OpenUsersList();
                //NOTE: Sync entry13
                User.AtUsersForm().PerformSearch(sourceMailbox13);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox13);
                User.AtUsersForm().SelectAction(ActionType.Sync);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox13);
                    User.AtUsersForm().SelectAction(ActionType.Sync);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmSync();
                User.AtUsersForm().WaitForState(sourceMailbox13, State.Syncing, 30000);
                //NOTE: Sync entry14
                User.AtUsersForm().PerformSearch(sourceMailbox14);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox14);
                User.AtUsersForm().SelectAction(ActionType.Sync);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox14);
                    User.AtUsersForm().SelectAction(ActionType.Sync);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmSync();
                User.AtUsersForm().WaitForState(sourceMailbox14, State.Syncing, 30000);
                //NOTE: Sync entry15
                User.AtUsersForm().PerformSearch(sourceMailbox15);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox15);
                User.AtUsersForm().SelectAction(ActionType.Sync);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox15);
                    User.AtUsersForm().SelectAction(ActionType.Sync);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmSync();
                User.AtUsersForm().WaitForState(sourceMailbox15, State.Syncing, 30000);

                //NOTE: Wait for entry13 is synced
                User.AtUsersForm().PerformSearch(sourceMailbox13);
                User.AtUsersForm().WaitForState(sourceMailbox13, State.Synced, 60000);
                //NOTE: Wait for entry14 is synced
                User.AtUsersForm().PerformSearch(sourceMailbox14);
                User.AtUsersForm().WaitForState(sourceMailbox14, State.Synced, 60000);
                //NOTE: Wait for entry15 is synced
                User.AtUsersForm().PerformSearch(sourceMailbox15);
                User.AtUsersForm().WaitForState(sourceMailbox15, State.Synced, 60000);
                //NOTE: Cutover entry15
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox15);
                User.AtUsersForm().SelectAction(ActionType.Cutover);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox15);
                    User.AtUsersForm().SelectAction(ActionType.Cutover);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmCutover();
                User.AtUsersForm().WaitForState(sourceMailbox15, State.Finalizing, 30000);
                //NOTE: Cutover entry14
                User.AtUsersForm().PerformSearch(sourceMailbox14);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox14);
                User.AtUsersForm().SelectAction(ActionType.Cutover);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox14);
                    User.AtUsersForm().SelectAction(ActionType.Cutover);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmCutover();
                User.AtUsersForm().WaitForState(sourceMailbox14, State.Finalizing, 30000);
                //NOTE: Cutover entry13
                User.AtUsersForm().PerformSearch(sourceMailbox13);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox13);
                User.AtUsersForm().SelectAction(ActionType.Cutover);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is not enabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox13);
                    User.AtUsersForm().SelectAction(ActionType.Cutover);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmCutover();
                User.AtUsersForm().OpenDetailsByLocator(sourceMailbox13);
                User.AtUsersForm().WaitForSyncJobAppear(2);
                User.AtUsersForm().CloseUserDetails();

                //NOTE: Wait till entry13 cutover completes
                User.AtUsersForm().WaitForState(sourceMailbox13, State.Complete, 60000);
                //NOTE: Wait till entry14 cutover completes
                User.AtUsersForm().PerformSearch(sourceMailbox14);
                User.AtUsersForm().WaitForState(sourceMailbox14, State.Complete, 60000);
                //NOTE: Wait till entry15 cutover completes
                User.AtUsersForm().PerformSearch(sourceMailbox15);
                User.AtUsersForm().WaitForState(sourceMailbox15, State.Complete, 60000);
                Thread.Sleep(2700000);
                //NOTE: Run PS script
                bool tc32208 = false;
                bool tc28545 = false;
                bool tc27857 = false;
                bool tc27856 = false;
                bool tc27859 = false;
                bool tc32394 = false;
                bool tc32203 = false;
                using (
                    var validationProcess = new PsLauncher().LaunchPowerShellInstance("Integration-Cutover.ps1",
                                                                                      $" -tlogin {targetLogin}" +
                                                                                      $" -tpassword {targetPassword}" +
                                                                                      $" -slogin {sourceLogin}" +
                                                                                      $" -spassword {sourcePassword}" +
                                                                                      $" -mailboxremote5 {sourceMailbox13.Substring(0, sourceMailbox13.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                                      $" -mailboxremote5SMTP {targetMailbox13Smtp}" +
                                                                                      $" -Equipremote2 {sourceMailbox14.Substring(0, sourceMailbox14.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                                      $" -Roomremote2 {sourceMailbox15.Substring(0, sourceMailbox15.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                                      $" -mailboxremote5X500 \"{targetMailbox13X500}\"" +
                                                                                      $" -adlogin {targetOnPremLogin}" +
                                                                                      $" -adpassword {targetOnPremPassword}" +
                                                                                      $" -uri {targetOnPremUri}" +
                                                                                      $" -ForwardingSmtpAddressSource {targetMailbox13Smtp}",
                                                                                      "x64"))
                {
                    while (!validationProcess.StandardOutput.EndOfStream)
                    {
                        var line = validationProcess.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("TC32208 Passed"))
                        {
                            tc32208 = true;
                        }
                        if (line.Contains("TC28545 Passed"))
                        {
                            tc28545 = true;
                        }
                        if (line.Contains("TC27857 Passed"))
                        {
                            tc27857 = true;
                        }
                        if (line.Contains("RoomMailbox Cutover Successful"))
                        {
                            tc27856 = true;
                        }
                        if (line.Contains("TC27859 and 32404 Passed"))
                        {
                            tc27859 = true;
                        }
                        if (line.Contains("TC32394 and 32404 Passed"))
                        {
                            tc32394 = true;
                        }
                        if (line.Contains("TC32203 Passed"))
                        {
                            tc32203 = true;
                        }
                    }
                    validationProcess.WaitForExit(600000);
                }

                Assert.IsTrue(tc32208, "Test failed");
                Assert.IsTrue(tc28545, "Test failed");
                Assert.IsTrue(tc27857, "Test failed");
                Assert.IsTrue(tc27856, "Test failed");
                Assert.IsTrue(tc27859, "Test failed");
                Assert.IsTrue(tc32394, "Test failed");
                Assert.IsTrue(tc32203, "Test failed");
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #5
0
        public void Automation_IN_PS_PrepareTest()
        {
            string targetEntry          = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry1']/..//target");
            string userName             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client               = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string project              = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//name");
            string sourceMailbox1       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry1']/..//source");
            string sourceMailbox2       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry2']/..//source");
            string sourceMailbox3       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry3']/..//source");
            string sourceMailbox6       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry6']/..//source");
            string sourceMailbox8       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry8']/..//source");
            string sourceMailbox9       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry9']/..//source");
            string sourceMailbox11      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry11']/..//source");
            string sourceMailbox11Upn   = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry11']/..//upn");
            string sourceMailbox12      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry12']/..//source");
            string sourceMailbox13      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry13']/..//source");
            string sourceMailbox14      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry14']/..//source");
            string sourceMailbox15      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry15']/..//source");
            string targetLogin          = RunConfigurator.GetTenantValue("T5->T6", "target", "user");
            string targetPassword       = RunConfigurator.GetTenantValue("T5->T6", "target", "password");
            string sourceMailbox1Smtp   = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry1']/..//smtp");
            string targetOnPremLogin    = RunConfigurator.GetTenantValue("T5->T6", "target", "aduser");
            string targetOnPremPassword = RunConfigurator.GetTenantValue("T5->T6", "target", "adpassword");

            try
            {
                LoginAndSelectRole(userName, password, client);
                SelectProject(project);
                User.AtProjectOverviewForm().OpenUsersList();
                //NOTE: entry1 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox1);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox1);
                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(sourceMailbox1);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox1, State.Preparing, 30000);

                //NOTE: entry2 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox2);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox2);
                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(sourceMailbox2);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox2, State.Preparing, 30000);
                //NOTE: entry3 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox3);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox3);
                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(sourceMailbox3);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                try
                {
                    User.AtUsersForm().ConfirmPrepare();
                }
                catch (Exception)
                {
                    Log.Info("Apply did not work");
                    User.AtUsersForm().Apply();
                    User.AtUsersForm().ConfirmPrepare();
                }
                User.AtUsersForm().WaitForState(sourceMailbox3, State.Preparing, 30000);
                //NOTE: entry6 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox6);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox6);
                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(sourceMailbox6);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox6, State.Preparing, 30000);
                //NOTE: entry8 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox8);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox8);
                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(sourceMailbox8);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox8, State.Preparing, 30000);
                //NOTE: entry9 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox9);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox9);
                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(sourceMailbox9);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);

                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox9, State.Preparing, 30000);
                //NOTE: enrty11 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox11Upn);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox11Upn);
                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(sourceMailbox11Upn);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox11Upn, State.Preparing, 30000);
                //NOTE: entry12 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox12);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox12);
                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(sourceMailbox12);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox12, State.Preparing, 30000);
                //NOTE: entry13 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox13);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox13);
                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(sourceMailbox13);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox13, State.Preparing, 30000);
                //NOTE: entry14 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox14);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox14);
                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(sourceMailbox14);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox14, State.Preparing, 30000);
                //NOTE: entry15 prepare
                User.AtUsersForm().PerformSearch(sourceMailbox15);
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox15);
                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(sourceMailbox15);
                    User.AtUsersForm().SelectAction(ActionType.Prepare);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmPrepare();
                User.AtUsersForm().WaitForState(sourceMailbox15, State.Preparing, 30000);

                //NOTE: entry1 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox1);
                User.AtUsersForm().WaitForState(sourceMailbox1, State.Prepared, 90000);
                //NOTE: entry2 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox2);
                User.AtUsersForm().WaitForState(sourceMailbox2, State.Prepared, 90000);
                //NOTE: entry3 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox3);
                User.AtUsersForm().WaitForState(sourceMailbox3, State.Prepared, 90000);
                //NOTE: entry6 wait for prepare
                User.AtUsersForm().PerformSearch(sourceMailbox6);
                User.AtUsersForm().WaitForState(sourceMailbox6, State.Prepared, 90000);
                //NOTE: entry8 wait for prepare
                User.AtUsersForm().PerformSearch(sourceMailbox8);
                User.AtUsersForm().WaitForState(sourceMailbox8, State.Prepared, 90000);
                //NOTE: entry9 wait for prepare
                User.AtUsersForm().PerformSearch(sourceMailbox9);
                User.AtUsersForm().WaitForState(sourceMailbox9, State.Prepared, 90000);
                //NOTE: entry11 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox11Upn);
                User.AtUsersForm().WaitForState(sourceMailbox11Upn, State.Prepared, 90000);
                //NOTE: entry12 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox12);
                User.AtUsersForm().WaitForState(sourceMailbox12, State.Prepared, 90000);
                //NOTE: entry13 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox13);
                User.AtUsersForm().WaitForState(sourceMailbox13, State.Prepared, 90000);
                //NOTE: entry14 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox14);
                User.AtUsersForm().WaitForState(sourceMailbox14, State.Prepared, 90000);
                //NOTE: entry15 wait for prepared
                User.AtUsersForm().PerformSearch(sourceMailbox15);
                User.AtUsersForm().WaitForState(sourceMailbox15, State.Prepared, 90000);

                bool tc32195Group = false;
                bool tc32188      = false;
                bool tc32180Group = false;
                bool tc32181Group = false;
                bool tc32196      = false;
                bool tc28066Group = false;
                bool tc32390      = false;
                bool tc39398      = false;
                bool tc32179      = false;
                bool tc28078      = false;
                bool tc32623      = false;
                bool tc32624      = false;
                using (
                    var process = new PsLauncher().LaunchPowerShellInstance("IntegrationUsers-Prepare.ps1",
                                                                            $" -slogin {targetLogin}" +
                                                                            $" -spassword {targetPassword}" +
                                                                            $" -mailbox {targetEntry.Substring(0, targetEntry.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -smtp {sourceMailbox1Smtp}" +
                                                                            $" -remoteshare {sourceMailbox3.Substring(0, sourceMailbox3.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -remoteroom {sourceMailbox2.Substring(0, sourceMailbox2.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -mailboxremote2 {sourceMailbox6.Substring(0, sourceMailbox6.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -mailboxremote2contact {sourceMailbox6}" +
                                                                            $" -mailboxremote4 {sourceMailbox8.Substring(0, sourceMailbox8.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -remoteequip1 {sourceMailbox9.Substring(0, sourceMailbox9.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -sam1 {sourceMailbox11.Substring(0, sourceMailbox11.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -sam1upn {sourceMailbox11Upn}" +
                                                                            $" -sam2 {sourceMailbox12.Substring(0, sourceMailbox12.LastIndexOf("@", StringComparison.Ordinal))}" +
                                                                            $" -adlogin {targetOnPremLogin}" +
                                                                            $" -adpassword {targetOnPremPassword}",
                                                                            "x64"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        var line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("TC32195, 32189, 32395 Passed"))
                        {
                            tc32195Group = true;
                        }
                        if (line.Contains("TC32188 Passed"))
                        {
                            tc32188 = true;
                        }
                        if (line.Contains("TC32180, 32396 Passed"))
                        {
                            tc32180Group = true;
                        }
                        if (line.Contains("TC32181, 32396 Passed"))
                        {
                            tc32181Group = true;
                        }
                        if (line.Contains("TC32196 Passed"))
                        {
                            tc32196 = true;
                        }
                        if (line.Contains("TC28066, 39398 Passed"))
                        {
                            tc28066Group = true;
                        }
                        if (line.Contains("TC32390 Passed"))
                        {
                            tc32390 = true;
                        }
                        if (line.Contains("TC39398 Passed"))
                        {
                            tc39398 = true;
                        }
                        if (line.Contains("TC32179 Passed"))
                        {
                            tc32179 = true;
                        }
                        if (line.Contains("TC28078 Passed"))
                        {
                            tc28078 = true;
                        }
                        if (line.Contains("TC32623 Passed"))
                        {
                            tc32623 = true;
                        }
                        if (line.Contains("TC32624 Passed"))
                        {
                            tc32624 = true;
                        }
                    }
                    process.WaitForExit(600000);
                }
                Assert.IsTrue(tc32195Group, "TC32195 group validation failed");
                Assert.IsTrue(tc32188, "TC32188 validation failed");
                Assert.IsTrue(tc32180Group, "TC32180 group validation failed");
                Assert.IsTrue(tc32181Group, "TC32181 group validation failed");
                Assert.IsTrue(tc32196, "TC32196 validation failed");
                Assert.IsTrue(tc28066Group, "TC28066 group validation failed");
                Assert.IsTrue(tc32390, "TC32390 validation failed");
                Assert.IsTrue(tc39398, "TC39398 validation failed");
                Assert.IsTrue(tc32179, "TC32179 validation failed");
                Assert.IsTrue(tc28078, "TC28078 validation failed");
                Assert.IsTrue(tc32623, "TC32623 validation failed");
                Assert.IsTrue(tc32624, "TC32624 validation failed");
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #6
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);
        }
예제 #7
0
        public void Automation_IN_PublicFoldersTest()
        {
            try
            {
                bool result  = false;
                int  counter = 0;
                while (!result && counter < 3)
                {
                    using (
                        var sourcePreparation = new PsLauncher().LaunchPowerShellInstance("PF/SourcePrepScript.ps1",
                                                                                          $" -slogin {RunConfigurator.GetTenantValue("T5->T6", "source", "user")} -spassword {RunConfigurator.GetTenantValue("T5->T6", "source", "password")}", "x64")
                        )
                    {
                        while (!sourcePreparation.StandardOutput.EndOfStream)
                        {
                            string line = sourcePreparation.StandardOutput.ReadLine();
                            Log.Info(line);
                            if (line.Contains("Public Folder successfully created"))
                            {
                                result = true;
                            }
                        }
                        sourcePreparation.WaitForExit(30000);
                        counter++;
                    }
                }
                result  = false;
                counter = 0;
                while (!result && counter < 3)
                {
                    using (var targetPreparation = new PsLauncher().LaunchPowerShellInstance("PF/TargetPrepScript.ps1", $" -slogin {RunConfigurator.GetTenantValue("T5->T6", "target", "user")} -spassword {RunConfigurator.GetTenantValue("T5->T6", "target", "password")}", "x64"))
                    {
                        while (!targetPreparation.StandardOutput.EndOfStream)
                        {
                            string line = targetPreparation.StandardOutput.ReadLine();
                            Log.Info(line);
                            if (line.Contains("Public Folder successfully created"))
                            {
                                result = true;
                            }
                        }
                        targetPreparation.WaitForExit(30000);
                        counter++;
                    }
                }
                RunConfigurator.CreateFlagFolder(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//stopfolder"));
                LoginAndSelectRole(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user"), RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password"), RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name"));
                SelectProject(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//name"));
                try
                {
                    User.AtProjectOverviewForm().OpenPublicFolders();
                }
                catch (Exception)
                {
                    Log.Info("Total folders link is not clickable");
                    User.AtProjectOverviewForm().OpenPublicFolders();
                }
                try
                {
                    User.AtPublicFolderMigrationViewForm().SyncUserByLocator(RunConfigurator.GetValueByXpath(
                                                                                 "//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry4']/..//source"));
                }
                catch (Exception)
                {
                    Log.Info("PF migration view form was not opened");
                    User.AtProjectOverviewForm().OpenPublicFolders();
                    User.AtPublicFolderMigrationViewForm().SyncUserByLocator(RunConfigurator.GetValueByXpath(
                                                                                 "//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry4']/..//source"));
                }

                User.AtPublicFolderMigrationViewForm().ConfirmSync();
                User.AtPublicFolderMigrationViewForm().AssertUserHaveSyncingState(RunConfigurator.GetValueByXpath(
                                                                                      "//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry4']/..//source"));
                User.AtPublicFolderMigrationViewForm().OpenDetailsByLocator(RunConfigurator.GetValueByXpath(
                                                                                "//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry4']/..//source"));
                User.AtPublicFolderMigrationViewForm().WaitForProvisioningJobAppear(1);
                User.AtPublicFolderMigrationViewForm().WaitForProvisioningJobDone();
                User.AtPublicFolderMigrationViewForm().WaitForContentCopyJobAppear(1);
                User.AtPublicFolderMigrationViewForm().WaitForContentCopyJobDone();
                User.AtPublicFolderMigrationViewForm().VerifyProccessedFolders(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='processed1']/..//amount"));
                User.AtPublicFolderMigrationViewForm().VerifyProvisioningTimeStampsAreNotEmpty();
                User.AtPublicFolderMigrationViewForm().VerifyContentCopyTimeStampsAreNotEmpty();
                User.AtPublicFolderMigrationViewForm().DownloadProvisioningLogs();
                RunConfigurator.CheckProvisioningLogsFileIsDownloadedAndNotEmpty();
                //Note: add logs for second job
                User.AtPublicFolderMigrationViewForm().CloseUserDetails();
                using (var mainScript = new PsLauncher().LaunchPowerShellInstance("PF/PfAutomationScript.ps1", $" -sourceUserName {RunConfigurator.GetTenantValue("T5->T6", "source", "user")}" +
                                                                                  $" -sourcepasswd {RunConfigurator.GetTenantValue("T5->T6", "source", "password")}" +
                                                                                  $" -TargetUserName {RunConfigurator.GetTenantValue("T5->T6", "target", "user")}" +
                                                                                  $" -Targetpasswd {RunConfigurator.GetTenantValue("T5->T6", "target", "password")}" +
                                                                                  $" -StopFilePath1 {RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='stopfile1']/..//path")}" +
                                                                                  $" -StopFilePath2 {RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='stopfile2']/..//path")}" +
                                                                                  $" -AttachmentPath {Path.GetFullPath(RunConfigurator.ResourcesPath + "test.txt")}" +
                                                                                  $" -SendAsSourceUserName {RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry5']/..//source")}" +
                                                                                  $" -TargetAsSourceUserName {RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry5']/..//target")}" +
                                                                                  $" -Sourcex400Address \"{RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry5']/..//sourcex400")}\"" +
                                                                                  $" -Targetx400Address \"{RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry5']/..//targetx400")}\"" +
                                                                                  $" -SourceProxyAddress {RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry5']/..//sourceproxy")}" +
                                                                                  $" -TargetProxyAddress {RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry5']/..//targetproxy")}"))
                {
                    while (!mainScript.StandardOutput.EndOfStream)
                    {
                        var line = mainScript.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("Powershell will pause until Migration is complete - 1"))
                        {
                            Thread.Sleep(180000);
                            User.AtPublicFolderMigrationViewForm().OpenDetailsByLocator(RunConfigurator.GetValueByXpath(
                                                                                            "//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='entry4']/..//source"));
                            User.AtPublicFolderMigrationViewForm().SyncFromDetails();
                            User.AtPublicFolderMigrationViewForm().ConfirmSync();
                            User.AtPublicFolderMigrationViewForm().AssertDetailsSyncButtonIsDisabled();
                            User.AtPublicFolderMigrationViewForm().AssertDetailsStopButtonIsEnabled();
                            User.AtPublicFolderMigrationViewForm().WaitForProvisioningJobAppear(2);
                            User.AtPublicFolderMigrationViewForm().WaitForProvisioningJobDone();
                            User.AtPublicFolderMigrationViewForm().WaitForContentCopyJobAppear(2);
                            User.AtPublicFolderMigrationViewForm().WaitForContentCopyJobDone();
                            User.AtPublicFolderMigrationViewForm().VerifyProccessedFolders(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='processed2']/..//amount"));
                            RunConfigurator.CreateEmptyFile(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='stopfile1']/..//path"));
                        }
                        if (line.Contains("Powershell will pause until Migration is complete - 2"))
                        {
                            Thread.Sleep(180000);
                            try
                            {
                                User.AtPublicFolderMigrationViewForm().SyncFromDetails();
                            }
                            catch (Exception)
                            {
                                User.AtPublicFolderMigrationViewForm().RefreshData();
                                User.AtPublicFolderMigrationViewForm().SyncFromDetails();
                            }
                            User.AtPublicFolderMigrationViewForm().ConfirmSync();
                            User.AtPublicFolderMigrationViewForm().WaitForProvisioningJobAppear(3);
                            User.AtPublicFolderMigrationViewForm().WaitForProvisioningJobDone();
                            User.AtPublicFolderMigrationViewForm().WaitForContentCopyJobAppear(3);
                            User.AtPublicFolderMigrationViewForm().WaitForContentCopyJobDone();
                            RunConfigurator.CreateEmptyFile(RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='stopfile2']/..//path"));
                        }
                        if (line.Contains("Folder existance Check succeeded"))
                        {
                            Store.PfValidationDictionary["folderExistance"] = true;
                        }
                        if (line.Contains("Source Target Item existance Check succeeded"))
                        {
                            Store.PfValidationDictionary["itemExistance"] = true;
                        }
                        if (line.Contains("Add New MailFolder Check succeeded-1"))
                        {
                            Store.PfValidationDictionary["addMailFolder1"] = true;
                        }
                        if (line.Contains("Add New FolderTree Check succeeded-1"))
                        {
                            Store.PfValidationDictionary["addFolderTree1"] = true;
                        }
                        if (line.Contains("Add New MailFolder Check succeeded-2"))
                        {
                            Store.PfValidationDictionary["addMailFolder2"] = true;
                        }
                        if (line.Contains("Add New Contacts Check succeeded"))
                        {
                            Store.PfValidationDictionary["addContancs"] = true;
                        }
                        if (line.Contains("Add New Calendar Check succeeded"))
                        {
                            Store.PfValidationDictionary["addCalendar"] = true;
                        }
                        if (line.Contains("Add Folder to Test Folder Delete succeeded"))
                        {
                            Store.PfValidationDictionary["addFolderDelete"] = true;
                        }
                        if (line.Contains("Add Folder to Test Folder Move succeeded"))
                        {
                            Store.PfValidationDictionary["addFolderMove"] = true;
                        }
                        if (line.Contains("Add Folder to Test Folder Rename succeeded"))
                        {
                            Store.PfValidationDictionary["addFolderRename"] = true;
                        }
                        if (line.Contains("Add Item Test succeeded-1"))
                        {
                            Store.PfValidationDictionary["addNewItem1"] = true;
                        }
                        if (line.Contains("Add Item Test succeeded-2"))
                        {
                            Store.PfValidationDictionary["addNewItem2"] = true;
                        }
                        if (line.Contains("Add Item Test succeeded-3"))
                        {
                            Store.PfValidationDictionary["addNewItem3"] = true;
                        }
                        if (line.Contains("Add Contact Test succeeded"))
                        {
                            Store.PfValidationDictionary["addContact"] = true;
                        }
                        if (line.Contains("Add Meeting Test succeeded"))
                        {
                            Store.PfValidationDictionary["addMeeting"] = true;
                        }
                        if (line.Contains("Add Custom Item Test succeeded"))
                        {
                            Store.PfValidationDictionary["addCustomItem"] = true;
                        }
                        if (line.Contains("SMTP Address Rewriting Test succeeded"))
                        {
                            Store.PfValidationDictionary["smtpRewritting"] = true;
                        }
                        if (line.Contains("X400 Address Rewriting Test succeeded"))
                        {
                            Store.PfValidationDictionary["x400Rewritting"] = true;
                        }
                        if (line.Contains("Add Item Test succeeded-4"))
                        {
                            Store.PfValidationDictionary["addNewItem4"] = true;
                        }
                        if (line.Contains("Add PDL Test succeeded"))
                        {
                            Store.PfValidationDictionary["addPDL"] = true;
                        }
                        if (line.Contains("Validate Add Mail Folder succeeded-1"))
                        {
                            Store.PfValidationDictionary["validateAddMailFolder1"] = true;
                        }
                        if (line.Contains("Validate Add Mail FolderTree succeeded"))
                        {
                            Store.PfValidationDictionary["validateAddFolderTree"] = true;
                        }
                        if (line.Contains("Mail Enable Folder Test succeeded"))
                        {
                            Store.PfValidationDictionary["mailEnable"] = true;
                        }
                        if (line.Contains("Add SendAS Permission Test succeeded"))
                        {
                            Store.PfValidationDictionary["addSendAsPerms"] = true;
                        }
                        if (line.Contains("Add Proxy Address Test succeeded"))
                        {
                            Store.PfValidationDictionary["addProxy"] = true;
                        }
                        if (line.Contains("Validate Add Mail Folder succeeded-2"))
                        {
                            Store.PfValidationDictionary["validateAddMailFolder2"] = true;
                        }
                        if (line.Contains("Validate Add Contacts Folder succeeded"))
                        {
                            Store.PfValidationDictionary["validateAddContacts"] = true;
                        }
                        if (line.Contains("Validate Add Calendar Folder succeeded"))
                        {
                            Store.PfValidationDictionary["validateCalendar"] = true;
                        }
                        if (line.Contains("Validate Add Mail Folder succeeded-3"))
                        {
                            Store.PfValidationDictionary["validateAddMailFolder3"] = true;
                        }
                        if (line.Contains("Validate Add Item succeeded-1"))
                        {
                            Store.PfValidationDictionary["validateAddItem1"] = true;
                        }
                        if (line.Contains("Validate Add Contact succeeded"))
                        {
                            Store.PfValidationDictionary["validateAddContact"] = true;
                        }
                        if (line.Contains("Validate Add Meeting succeeded"))
                        {
                            Store.PfValidationDictionary["validateAddMeeting"] = true;
                        }
                        if (line.Contains("Validate Custom Item succeeded"))
                        {
                            Store.PfValidationDictionary["validateCustomItem"] = true;
                        }
                        if (line.Contains("Validate SMTP Transform succeeded"))
                        {
                            Store.PfValidationDictionary["validateSmtp"] = true;
                        }
                        if (line.Contains("Validate x400 Transform succeeded"))
                        {
                            Store.PfValidationDictionary["validatex400"] = true;
                        }
                        if (line.Contains("Validate Add Item succeeded-2"))
                        {
                            Store.PfValidationDictionary["validateAddItem2"] = true;
                        }
                        if (line.Contains("move Test succeeded"))
                        {
                            Store.PfValidationDictionary["validateMove"] = true;
                        }
                        if (line.Contains("Modify Folder Permissions Test succeeded"))
                        {
                            Store.PfValidationDictionary["modifyFoldersPerms"] = true;
                        }
                        if (line.Contains("Add Attachment Test succeeded"))
                        {
                            Store.PfValidationDictionary["addAttachment"] = true;
                        }
                        if (line.Contains("Modify Item Test succeeded"))
                        {
                            Store.PfValidationDictionary["modifyItem"] = true;
                        }
                        if (line.Contains("Modify Contact Item Test succeeded"))
                        {
                            Store.PfValidationDictionary["modifyContact"] = true;
                        }
                        if (line.Contains("Modify Sticky Note succeeded"))
                        {
                            Store.PfValidationDictionary["modifyNote"] = true;
                        }
                        if (line.Contains("Rename Folder succeeded"))
                        {
                            Store.PfValidationDictionary["folderRename"] = true;
                        }
                        if (line.Contains("Move Folder succeeded"))
                        {
                            Store.PfValidationDictionary["folderMove"] = true;
                        }
                        if (line.Contains("Delete Folder succeeded"))
                        {
                            Store.PfValidationDictionary["folderDelete"] = true;
                        }
                        if (line.Contains("Move Item succeeded"))
                        {
                            Store.PfValidationDictionary["moveItem"] = true;
                        }
                        if (line.Contains("Delete Item succeeded"))
                        {
                            Store.PfValidationDictionary["deleteItem"] = true;
                        }
                        if (line.Contains("Validate Modify Folder Permissions succeeded"))
                        {
                            Store.PfValidationDictionary["validateFolderPerms"] = true;
                        }
                        if (line.Contains("Validate Add Attachment succeeded"))
                        {
                            Store.PfValidationDictionary["validateAttachment"] = true;
                        }
                        if (line.Contains("Validate Modify Item Subject succeeded"))
                        {
                            Store.PfValidationDictionary["validateModifyItem"] = true;
                        }
                        if (line.Contains("Validate Modify Item contact succeeded"))
                        {
                            Store.PfValidationDictionary["validateModifyContact"] = true;
                        }
                        if (line.Contains("Validate Modify StickyNote succeeded"))
                        {
                            Store.PfValidationDictionary["validateModifyNote"] = true;
                        }
                        if (line.Contains("Validate rename folder succeeded"))
                        {
                            Store.PfValidationDictionary["validateRenameFolder"] = true;
                        }
                        if (line.Contains("Validate move folder succeeded"))
                        {
                            Store.PfValidationDictionary["validateMoveFolder"] = true;
                        }
                        if (line.Contains("Validate delete folder succeeded"))
                        {
                            Store.PfValidationDictionary["validateDeleteFolder"] = true;
                        }
                        if (line.Contains("Validate Move Item succeeded"))
                        {
                            Store.PfValidationDictionary["validateMoveItem"] = true;
                        }
                        if (line.Contains("Validate Delete Item succeeded"))
                        {
                            Store.PfValidationDictionary["validateDeleteItem"] = true;
                        }
                        if (line.Contains("Validate Mail Enable Folder succeeded"))
                        {
                            Store.PfValidationDictionary["validateMailEnable"] = true;
                        }
                        if (line.Contains("validate Add SendAS Permission succeeded"))
                        {
                            Store.PfValidationDictionary["validateAddSendAsPerms"] = true;
                        }
                        if (line.Contains("Validate Add Proxy Address validation succeeded"))
                        {
                            Store.PfValidationDictionary["validateProxy"] = true;
                        }
                    }
                    mainScript.WaitForExit(30000);
                }
                foreach (var check in Store.PfValidationDictionary)
                {
                    Assert.IsTrue(check.Value, check.Key + " check failed");
                }
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #8
0
        public override void Run()
        {
            Log.Info("=-=-=-=-=-=-=-=-=");
            var sourceCloudLogin      = RunConfigurator.GetTenantValue(tenants, "source", "user");
            var sourceCloudPassword   = RunConfigurator.GetTenantValue(tenants, "source", "password");
            var sourceObjectUPNSuffix = RunConfigurator.GetTenantValue(tenants, "source", "domain");

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

            var testObjectNamePrefix = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//objectprefix");
            var testDiscoveryGroup   = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//discoverygroup");
            var testObjectPassword   = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//password");

            try
            {
                //  -sourceCloudLogin,
                //  -sourceCloudPassword,
                //  -targetCloudLogin,
                //  -targetCloudPassword,
                //  -testObjectNamePrefix,
                //  -testDiscoveryGroup,
                //  -testObjectUPNSuffix,
                //  -testObjectPassword,
                //  -msolUri = "https://ps.outlook.com/powershell",
                //  -msolConnectParams = "",
                //  -simulationMode

                string msolConnectParams = "";
                using (var process = new PsLauncher().LaunchPowerShellInstance("resources\\CreateAndVerifyC2C.ps1",
                                                                               $" -sourceCloudLogin \"{sourceCloudLogin}\"" +
                                                                               $" -sourceCloudPassword \"{sourceCloudPassword}\"" +
                                                                               $" -sourceObjectUPNSuffix \"{sourceObjectUPNSuffix}\"" +

                                                                               $" -targetCloudLogin \"{targetCloudLogin}\"" +
                                                                               $" -targetCloudPassword \"{targetCloudPassword}\"" +
                                                                               $" -targetObjectUPNSuffix \"{targetObjectUPNSuffix}\"" +

                                                                               $" -testObjectNamePrefix \"{testObjectNamePrefix}\"" +
                                                                               $" -testDiscoveryGroup \"{testDiscoveryGroup}\"" +
                                                                               $" -testObjectPassword \"{testObjectPassword}\"" +
                                                                               $" -msolUri \"{msolUri}\"" +
                                                                               $" -msolConnectParams \"{msolConnectParams}\"",
                                                                               "x64"))

                {
                    Task stdout = Task.Run(() =>
                    {
                        while (!process.StandardOutput.EndOfStream)
                        {
                            var line = process.StandardOutput.ReadLine();
                            Log.Info(line);
                        }
                    });

                    Task stderr = Task.Run(() =>
                    {
                        while (!process.StandardError.EndOfStream)
                        {
                            var line = process.StandardError.ReadLine();
                            Log.Error(line);
                        }
                    });

                    Task.WaitAll(stderr, stdout);
                    process.WaitForExit(60000);

                    stdout.Dispose();
                    stderr.Dispose();

                    if (process.ExitCode != 0)
                    {
                        throw new Exception(string.Format("PowerShell script returned exit code: {0}", process.ExitCode));
                    }
                }
            }
            catch (Exception e)
            {
                InsertDataToSql(DateTime.UtcNow, "PowerShell/Wait till user will be created step error");
                throw;
            }

            InsertDataToSql(DateTime.UtcNow);
        }
예제 #9
0
        public void Automation_MO_RollbackTest()
        {
            string login             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password          = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client            = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string projectName       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//name");
            string sourceMailbox     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps4']/..//source");
            string targetMailbox     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps4']/..//target");
            string sourceLogin       = RunConfigurator.GetTenantValue("T1->T2", "source", "psuser2");
            string sourcePassword    = RunConfigurator.GetTenantValue("T1->T2", "source", "pspassword2");
            string targetLogin       = RunConfigurator.GetTenantValue("T1->T2", "target", "psuser2");
            string targetPassword    = RunConfigurator.GetTenantValue("T1->T2", "target", "pspassword2");
            string stopFile1         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='stopfile9']/..//path");
            string stopFile2         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='stopfile7']/..//path");
            string stopFile3         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='stopfile10']/..//path");
            string stopFile4         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='stopfile8']/..//path");
            string permSourceMailbox = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entry2']/..//source");
            string permTargetMailbox = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entry2']/..//target");
            string stopFolder        = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//stopfolder");

            try
            {
                using (
                    var sourcePreparation = new PsLauncher().LaunchPowerShellInstance("Cleanup_Rollback.ps1", $" -slogin {sourceLogin}" +
                                                                                      $" -spassword {sourcePassword}" +
                                                                                      $" -tlogin {targetLogin}" +
                                                                                      $" -tpassword {targetPassword}" +
                                                                                      $" -smailbox {sourceMailbox}" +
                                                                                      $" -SourceMailbox {permSourceMailbox}", "x64"))
                {
                    while (!sourcePreparation.StandardOutput.EndOfStream)
                    {
                        string line = sourcePreparation.StandardOutput.ReadLine();
                        Log.Info(line);
                    }
                    sourcePreparation.WaitForExit(30000);
                }

                bool success  = true;
                var  launcher = new PsLauncher();
                RunConfigurator.CreateFlagFolder(stopFolder);
                using (var process = launcher.LaunchPowerShellInstance("Rollback1.ps1", $" -slogin {sourceLogin}" +
                                                                       $" -spassword {sourcePassword}" +
                                                                       $" -tlogin {targetLogin}" +
                                                                       $" -tpassword {targetPassword}" +
                                                                       $" -smailbox {sourceMailbox}" +
                                                                       $" -tmailbox {targetMailbox}" +
                                                                       $" -StopFilePath1 {stopFile1}" +
                                                                       $" -SourceMailbox1 {permSourceMailbox}" +
                                                                       $" -TargetMailbox1 {permTargetMailbox}" +
                                                                       $" -StopFilePathRollback1 {stopFile2}" +
                                                                       $" -StopFilePath3 {stopFile3}" +
                                                                       $" -StopFilePathRollback4 {stopFile4}"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        string line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("failed"))
                        {
                            Log.Fatal(line);
                            success = false;
                        }
                        if (line == "Powershell will pause until Migration is complete - 1")
                        {
                            LoginAndSelectRole(login, password, client);
                            SelectProject(projectName);
                            User.AtProjectOverviewForm().OpenUsersList();
                            User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                            User.AtUsersForm().SelectAction(ActionType.Rollback);
                            User.AtUsersForm().AssertApplyIsDisabled();
                            User.AtUsersForm().SelectAction(ActionType.Sync);
                            try
                            {
                                User.AtUsersForm().Apply();
                            }
                            catch (Exception)
                            {
                                Log.Info("Apply button is disabled");
                                Browser.GetDriver().Navigate().Refresh();
                                User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                                User.AtUsersForm().SelectAction(ActionType.Sync);
                                User.AtUsersForm().Apply();
                            }
                            User.AtUsersForm().ConfirmSync();
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Syncing, 10000);
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Synced, 60000);
                            RunConfigurator.CreateEmptyFile(stopFile1);
                        }
                        if (line == "Powershell will pause until Migration is complete - 2")
                        {
                            User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                            User.AtUsersForm().SelectAction(ActionType.Rollback);
                            User.AtUsersForm().Apply();
                            User.AtUsersForm().SetDontResetPermissions();
                            User.AtUsersForm().SetSureCheckbox();
                            User.AtUsersForm().Rollback();
                            User.AtUsersForm().WaitForState(sourceMailbox, State.RollbackInProgress, 10000);
                            User.AtUsersForm().WaitForState(sourceMailbox, State.RollbackCompleted, 60000);
                            User.AtUsersForm().OpenDetailsByLocator(sourceMailbox);
                            User.AtUsersForm().DownloadRollbackLogs();
                            User.AtUsersForm().CloseUserDetails();
                            RunConfigurator.CheckRollbackLogsFileIsDownloaded();
                            RunConfigurator.CreateEmptyFile(stopFile2);
                        }

                        if (line == "Powershell will pause until Migration is complete - 3")
                        {
                            User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                            User.AtUsersForm().SelectAction(ActionType.Sync);
                            try
                            {
                                User.AtUsersForm().Apply();
                            }
                            catch (Exception)
                            {
                                Log.Info("Apply button is disabled");
                                Browser.GetDriver().Navigate().Refresh();
                                User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                                User.AtUsersForm().SelectAction(ActionType.Sync);
                                User.AtUsersForm().Apply();
                            }
                            User.AtUsersForm().ConfirmSync();
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Syncing, 10000);
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Synced, 60000);
                            RunConfigurator.CreateEmptyFile(stopFile3);
                        }

                        if (line == "Powershell will pause until Migration is complete - 4")
                        {
                            User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                            User.AtUsersForm().SelectAction(ActionType.Rollback);
                            User.AtUsersForm().Apply();
                            User.AtUsersForm().SetResetPermissions();
                            User.AtUsersForm().SetSureCheckbox();
                            User.AtUsersForm().Rollback();
                            User.AtUsersForm().WaitForState(sourceMailbox, State.RollbackInProgress, 10000);
                            User.AtUsersForm().WaitForState(sourceMailbox, State.RollbackCompleted, 60000);
                            RunConfigurator.CreateEmptyFile(stopFile4);
                        }
                    }
                    process.WaitForExit();
                }
                Assert.IsTrue(success, "Test failed");
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #10
0
        public void Automation_IN_PS_DistributionGroupsValidationTest()
        {
            string userName             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password             = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client               = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string project              = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//name");
            string sourceTenantName     = RunConfigurator.GetTenantValue("T5->T6", "source", "name");
            string targetTenantName     = RunConfigurator.GetTenantValue("T5->T6", "target", "name");
            string group1Name           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group1']/..//name");
            string group2Name           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group2']/..//name");
            string group3Name           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group3']/..//name");
            string group4Name           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group4']/..//name");
            string group5Name           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group5']/..//name");
            string group6Name           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group6']/..//name");
            string targetCloudLogin     = RunConfigurator.GetTenantValue("T5->T6", "target", "user");
            string targetCloudPassword  = RunConfigurator.GetTenantValue("T5->T6", "target", "password");
            string group2Mail           = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group2']/..//mail");
            string group1Member1        = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group1']/..//member1");
            string group1Owner          = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group1']/..//owner");
            string group3Member1        = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group3']/..//member1");
            string group3Owner          = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group3']/..//owner");
            string targetOnPremLogin    = RunConfigurator.GetTenantValue("T5->T6", "target", "aduser");
            string targetOnPremPassword = RunConfigurator.GetTenantValue("T5->T6", "target", "adpassword");
            string targetOnPremUri      = RunConfigurator.GetTenantValue("T5->T6", "target", "uri");

            try
            {
                LoginAndSelectRole(userName, password, client);
                SelectProject(project);
                //NOTE: Discovery
                User.AtProjectOverviewForm().EditTenants();
                User.AtTenantsConfigurationForm().OpenDiscoveryTab();
                User.AtTenantsConfigurationForm().RunDiscovery(sourceTenantName);
                User.AtTenantsConfigurationForm().RunDiscovery(targetTenantName);
                User.AtTenantsConfigurationForm().GoToDashboard();
                User.AtProjectOverviewForm().WaitTillDiscoveryIsComplete(30, sourceTenantName);
                User.AtProjectOverviewForm().WaitTillDiscoveryIsComplete(30, targetTenantName);
                User.AtProjectOverviewForm().OpenMigrationGroups();
                Thread.Sleep(180000);
                //NOTE: Second sync
                User.AtGroupsMigrationForm().SyncUserByLocator(group1Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group1Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group2Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group2Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group3Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group3Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group4Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().SyncUserByLocator(group5Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group5Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group6Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group6Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().WaitForState(group1Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group2Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group3Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group4Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group5Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group6Name, State.Complete, 60000);
                Thread.Sleep(2400000);
                bool tc31803 = false;
                bool tc32395 = false;
                bool tc31805 = false;
                bool tc31806 = false;
                bool tc31814 = false;
                bool tc31818 = false;
                bool tc32493 = false;
                bool tc31808 = false;
                bool tc32281 = false;
                using (
                    var process = new PsLauncher().LaunchPowerShellInstance("IntegrationGroups-Sync.ps1",
                                                                            $" -slogin {targetCloudLogin}" +
                                                                            $" -spassword {targetCloudPassword}" +
                                                                            $" -SourceGrp1 {group1Name}" +
                                                                            $" -SourceGrp1TargetMail {group2Mail}" +
                                                                            $" -SourceGrp1TargetMember {group1Member1}" +
                                                                            $" -SourceGrp2 {group2Name}" +
                                                                            $" -SourceGrp2TargetOwner {group1Owner}" +
                                                                            $" -SourceGrp3 {group3Name}" +
                                                                            $" -SourceGrp4 {group4Name}" +
                                                                            $" -SourceGrp5 {group5Name}" +
                                                                            $" -SourceGrp6 {group6Name}" +
                                                                            $" -SourceGrp3TargetMember {group5Name}" +
                                                                            $" -SourceGrp3TargetMemberRemove {group3Member1}" +
                                                                            $" -SourceGrp3TargetOwnerRemove {group3Owner}" +
                                                                            $" -adlogin {targetOnPremLogin}" +
                                                                            $" -adpassword {targetOnPremPassword}" +
                                                                            $" -uri {targetOnPremUri}",
                                                                            "x64"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        var line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("TC31803 Passed"))
                        {
                            tc31803 = true;
                        }
                        if (line.Contains("TC31805 Passed"))
                        {
                            tc31805 = true;
                        }
                        if (line.Contains("TC31806 Passed"))
                        {
                            tc31806 = true;
                        }
                        if (line.Contains("TC31806 Passed"))
                        {
                            tc31806 = true;
                        }
                        if (line.Contains("TC31814 Passed"))
                        {
                            tc31814 = true;
                        }
                        if (line.Contains("TC31818 Passed"))
                        {
                            tc31818 = true;
                        }
                        if (line.Contains("TC32493 Passed"))
                        {
                            tc32493 = true;
                        }
                        if (line.Contains("TC32281 Passed"))
                        {
                            tc32281 = true;
                        }
                        if (line.Contains("TC32395 Passed"))
                        {
                            tc32395 = true;
                        }
                        if (line.Contains("TC31808 Passed"))
                        {
                            tc31808 = true;
                        }
                    }
                    process.WaitForExit(600000);
                }
                Assert.IsTrue(tc31803, "TC 31803 Failed");
                Assert.IsTrue(tc31805, "TC 31805 Failed");
                Assert.IsTrue(tc31806, "TC 31806 Failed");
                Assert.IsTrue(tc31814, "TC 31814 Failed");
                Assert.IsTrue(tc31818, "TC 31818 Failed");
                Assert.IsTrue(tc32493, "TC 32493 Failed");
                Assert.IsTrue(tc32281, "TC 32281 Failed");
                Assert.IsTrue(tc32395, "TC 32395 Failed");
                Assert.IsTrue(tc31808, "TC 31808 Failed");
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
        public void Automation_MO_PS_DeleteFoldersAndItemsTest()
        {
            string stopFolder     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//stopfolder");
            string sourceLogin    = RunConfigurator.GetTenantValue("T1->T2", "source", "psuser");
            string sourcePassword = RunConfigurator.GetTenantValue("T1->T2", "source", "pspassword");
            string targetLogin    = RunConfigurator.GetTenantValue("T1->T2", "target", "psuser");
            string targetPassword = RunConfigurator.GetTenantValue("T1->T2", "target", "pspassword");
            string sourceMailbox  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps1']/..//source");
            string targetMailbox  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps1']/..//target");
            string stopFile1      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='stopfile3']/..//path");
            string stopFile2      = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='stopfile4']/..//path");
            string userName       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string project        = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//name");

            try
            {
                bool success  = true;
                var  launcher = new PsLauncher();
                RunConfigurator.CreateFlagFolder(stopFolder);
                using (var process = launcher.LaunchPowerShellInstance("DeleteFoldersAndItems.ps1",
                                                                       $" -slogin {sourceLogin}" +
                                                                       $" -spassword {sourcePassword}" +
                                                                       $" -tlogin {targetLogin}" +
                                                                       $" -tpassword {targetPassword}" +
                                                                       $" -smailbox {sourceMailbox}" +
                                                                       $" -tmailbox {targetMailbox}" +
                                                                       $" -StopFilePath1 {stopFile1}" +
                                                                       $" -StopFilePath2 {stopFile2}"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        string line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("failed"))
                        {
                            Log.Fatal(line);
                            success = false;
                        }
                        if (line == "Powershell will pause until Migration is complete - 1")
                        {
                            LoginAndSelectRole(userName, password, client);
                            SelectProject(project);
                            User.AtProjectOverviewForm().OpenUsersList();
                            User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                            User.AtUsersForm().SelectAction(ActionType.Sync);
                            try
                            {
                                User.AtUsersForm().Apply();
                            }
                            catch (Exception)
                            {
                                Log.Info("Apply button is disabled");
                                Browser.GetDriver().Navigate().Refresh();
                                User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                                User.AtUsersForm().SelectAction(ActionType.Sync);
                                User.AtUsersForm().Apply();
                            }
                            User.AtUsersForm().ConfirmSync();
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Syncing, 10000);
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Synced, 60000);
                            RunConfigurator.CreateEmptyFile(stopFile1);
                        }
                        if (line == "Powershell will pause until Migration is complete - 2")
                        {
                            User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                            User.AtUsersForm().SelectAction(ActionType.Sync);
                            try
                            {
                                User.AtUsersForm().Apply();
                            }
                            catch (Exception)
                            {
                                Log.Info("Apply button is disabled");
                                Browser.GetDriver().Navigate().Refresh();
                                User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                                User.AtUsersForm().SelectAction(ActionType.Sync);
                                User.AtUsersForm().Apply();
                            }
                            User.AtUsersForm().ConfirmSync();
                            Browser.GetDriver().Navigate().Refresh();
                            User.AtUsersForm().WaitForState(sourceMailbox, State.Synced, 60000);
                            RunConfigurator.CreateEmptyFile(stopFile2);
                        }
                    }
                    process.WaitForExit();
                }
                Assert.IsTrue(success, "Test failed");
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #12
0
        public override void Run()
        {
            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 testObjectNamePrefix = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//objectprefix");
            var testObjectOU         = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//ou");


            var testObjectUPNSuffix = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//source");
            var testObjectPassword  = RunConfigurator.GetValueByXpath($"//metaname[text()='{clientName}']/..//metaname[text()='{projectName}']/..//metaname[text()='entry1']/..//password");

            try
            {
                using (var process = new PsLauncher().LaunchPowerShellInstance("CreateAndVerify.ps1",
                                                                               $" -sourceLocalLogin {sourceLocalLogin}" +
                                                                               $" -sourceLocalPassword {sourceLocalPassword}" +
                                                                               $" -sourceLocalExchangePowerShellUri {sourceLocalExchangePowerShellUri}" +
                                                                               $" -targetLocalLogin {targetLocalLogin}" +
                                                                               $" -targetLocalPassword {targetLocalPassword}" +
                                                                               $" -targetLocalExchangePowerShellUri {targetLocalExchangePowerShellUri}" +
                                                                               $" -testObjectNamePrefix {testObjectNamePrefix}" +
                                                                               $" -testObjectOU {testObjectOU}" +
                                                                               $" -testObjectUPNSuffix {testObjectUPNSuffix}" +
                                                                               $" -testObjectPassword {testObjectPassword}",
                                                                               "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, "PowerShell/Wait till user will be created step error");
                throw;
            }

            InsertDataToSql(DateTime.UtcNow);
        }
예제 #13
0
        public void Automation_IN_PS_DistributionGroupsInitialTest()
        {
            string userName       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string project        = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//name");
            string group1Name     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group1']/..//name");
            string group2Name     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group2']/..//name");
            string group3Name     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group3']/..//name");
            string group4Name     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group4']/..//name");
            string group5Name     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group5']/..//name");
            string group6Name     = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group6']/..//name");
            string sourceLogin    = RunConfigurator.GetTenantValue("T5->T6", "source", "aduser");
            string sourcePassword = RunConfigurator.GetTenantValue("T5->T6", "source", "adpassword");
            string group3Member1  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group3']/..//member1");
            string group3Owner    = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project2']/..//metaname[text()='group3']/..//owner");
            string sourceUri      = RunConfigurator.GetTenantValue("T5->T6", "source", "uri");

            try
            {
                LoginAndSelectRole(userName, password, client);
                SelectProject(project);
                try
                {
                    User.AtProjectOverviewForm().OpenMigrationGroups();
                }
                catch (Exception)
                {
                    Log.Info("Failed to open migration groups form");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtProjectOverviewForm().OpenMigrationGroups();
                }
                User.AtGroupsMigrationForm().SyncUserByLocator(group1Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group1Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group2Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group2Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group3Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group3Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group4Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().SyncUserByLocator(group5Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group5Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().SyncUserByLocator(group6Name);
                User.AtGroupsMigrationForm().ConfirmSync();
                User.AtGroupsMigrationForm().WaitForState(group6Name, State.Syncing, 10000);
                User.AtGroupsMigrationForm().WaitForState(group1Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group2Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group3Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group4Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group5Name, State.Complete, 60000);
                User.AtGroupsMigrationForm().WaitForState(group6Name, State.Complete, 60000);
                using (
                    var deltaProcess = new PsLauncher().LaunchPowerShellInstance("IntegrationGroups-Delta.ps1",
                                                                                 $" -slogin {sourceLogin}" +
                                                                                 $" -spassword {sourcePassword}" +
                                                                                 $" -SourceGrp3 {group3Name}" +
                                                                                 $" -SourceGrp3MemberRemove {group3Member1}" +
                                                                                 $" -SourceGrp3OwnerRemove {group3Owner}" +
                                                                                 $" -uri {sourceUri}",
                                                                                 "x64"))
                {
                    while (!deltaProcess.StandardOutput.EndOfStream)
                    {
                        var line = deltaProcess.StandardOutput.ReadLine();
                        Log.Info(line);
                    }
                    deltaProcess.WaitForExit(600000);
                }
            }
            catch (Exception)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }
예제 #14
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);
        }
예제 #15
0
        public void Automation_PS_MO_CompareTest()
        {
            string userName       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//user");
            string password       = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//password");
            string client         = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/../name");
            string project        = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//name");
            string sourceMailbox  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps4']/..//source");
            string sourceLogin    = RunConfigurator.GetTenantValue("T1->T2", "source", "psuser2");
            string sourcePassword = RunConfigurator.GetTenantValue("T1->T2", "source", "pspassword2");
            string targetLogin    = RunConfigurator.GetTenantValue("T1->T2", "target", "psuser2");
            string targetPassword = RunConfigurator.GetTenantValue("T1->T2", "target", "pspassword2");
            string targetMailbox  = RunConfigurator.GetValueByXpath("//metaname[text()='client2']/..//metaname[text()='project1']/..//metaname[text()='entryps4']/..//target");

            try
            {
                var IsFirstTestSuccess  = false;
                var IsSecondTestSuccess = false;
                var IsExpectedFailed    = false;
                LoginAndSelectRole(userName, password, client);
                SelectProject(project);
                User.AtProjectOverviewForm().OpenUsersList();
                User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                User.AtUsersForm().SelectAction(ActionType.Sync);
                try
                {
                    User.AtUsersForm().Apply();
                }
                catch (Exception)
                {
                    Log.Info("Apply button is disabled");
                    Browser.GetDriver().Navigate().Refresh();
                    User.AtUsersForm().SelectEntryBylocator(sourceMailbox);
                    User.AtUsersForm().SelectAction(ActionType.Sync);
                    User.AtUsersForm().Apply();
                }
                User.AtUsersForm().ConfirmSync();
                User.AtUsersForm().WaitForState(sourceMailbox, State.Syncing, 10000);
                User.AtUsersForm().WaitForState(sourceMailbox, State.Synced,
                                                60000);
                using (var process = new PsLauncher().LaunchPowerShellInstance("Compare.ps1",
                                                                               $" -slogin {sourceLogin}" +
                                                                               $" -spassword {sourcePassword}" +
                                                                               $" -tlogin {targetLogin}" +
                                                                               $" -tpassword {targetPassword}" +
                                                                               $" -smailbox {sourceMailbox}" +
                                                                               $" -tmailbox {targetMailbox}"))
                {
                    while (!process.StandardOutput.EndOfStream)
                    {
                        var line = process.StandardOutput.ReadLine();
                        Log.Info(line);
                        if (line.Contains("failed as expected") || line.Contains("Test 6 (Calendar with multiple attachments)") || line.Contains("Test 5 (Calendar with 1 Attachment)") || line.Contains("Test Case 3 (Calendar item with HTML Body)") || line.Contains("Test 15 Contact with 2 Attachments") || line.Contains("Test 14 Contact with 1 Attachment") || line.Contains("Testt 13 Contact with HTML Body") || line.Contains("Test Case 3 (Calendar item with HTML Body)") || line.Contains("Test 49, Task with two attachements") || line.Contains("Test 48, Task with one attachment") || line.Contains("Test 47, Task with HTML In body"))
                        {
                            IsExpectedFailed = true;
                        }
                        if (line.Contains("Folder existance Check succeeded"))
                        {
                            IsFirstTestSuccess = true;
                        }
                        if (line.Contains("Source Target Item existance Check succeeded"))
                        {
                            IsSecondTestSuccess = true;
                        }
                    }
                    process.WaitForExit();
                }
                Assert.IsTrue(IsFirstTestSuccess, "Folder existance Test failed");
                if (!IsExpectedFailed)
                {
                    Assert.IsTrue(IsSecondTestSuccess, "Source Target Item existance failed");
                }
                else
                {
                    Log.Fatal("Source Target Item existance test failed as expected");
                }
            }
            catch (Exception e)
            {
                LogHtml(Browser.GetDriver().PageSource);
                throw;
            }
        }