public void SendFolderAfterSendingTest()
        {
            try
            {
                new StartPage().Login(new User(LogIn, Password));
                new InboxPage().GoToSentPage();

                var sentPage = new SentPage();
                sentPage.DeleteAllSent();
                sentPage.GoToNewEmailPage();

                var emailPage = new EmailPage();
                emailPage.CreateANewEmail(new Email(EmailAddress, EmailSubject, EmailText));
                emailPage.SaveAsADraft();
                emailPage.GoToDraftPage();

                new DraftPage().OpenEmail();

                emailPage.SendEmail();
                emailPage.GoToSentPage();

                Assert.IsTrue(sentPage.SentEmailExist());
            }

            catch (Exception ex)
            {
                Logger.TakeScreenshot();
                Logger.log.Error("Exception: " + ex);
            }
        }
Example #2
0
        public void SentMessageTest()
        {
            Login(validLogin, validPassword);

            EmailPage emailPage = new EmailPage(driver);

            var destinationMessage = "*****@*****.**";
            var themeMessage       = "Sending message - test";
            var bodyMessage        = "Hello, Andrey! From Maryna Snitko";

            emailPage.writeMessageButton.Click();
            emailPage.destinationField.SendKeys(destinationMessage);
            emailPage.themeField.SendKeys(themeMessage);
            emailPage.attachFileButton.SendKeys("C:\\Users\\maryn\\Documents\\Test\\Test_Snitko.txt");

            driver.SwitchTo().Frame("mce_0_ifr");
            driver.FindElement(By.CssSelector("#tinymce")).SendKeys(bodyMessage);

            driver.SwitchTo().ParentFrame();
            driver.FindElement(By.CssSelector("button[class='default send']")).Click();

            Thread.Sleep(5000);

            Assert.True(IsElementPresent(emailPage.messageSentMessageSucces),
                        $"Element '{emailPage.messageSentMessageSucces}' is not present on the page as expected");
        }
Example #3
0
        public bool SendEmoticons()
        {
            string    login1    = ConfigurationManager.AppSettings["login1"];
            string    pass1     = ConfigurationManager.AppSettings["password1"];
            string    login3    = ConfigurationManager.AppSettings["login3"];
            string    pass3     = ConfigurationManager.AppSettings["password3"];
            string    message   = ConfigurationManager.AppSettings["message"];
            string    subject   = "Emoticons";
            LoginPage loginPage = new LoginPage();

            loginPage.OpenPage();
            Thread.Sleep(4000);
            LoginPage lp = new LoginPage();

            try
            {
                //                ep.Logout();
                lp.SwitchUser();
            }
            catch (Exception) { }
            loginPage.SetLoginAndPassword(login3, pass3);
            EmailPage emailPage = new EmailPage();

            emailPage.SendEmailWithEmoticons(login1, subject);
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login1, pass1);
            Thread.Sleep(2000);
            return(emailPage.CheckFirstMessage(subject));
        }
 public void GivenIHaveCreatedANewEmailWithAndAnd(string emailAddress, string emaiSubject, string emailText)
 {
     sentPage = new SentPage();
     sentPage.GoToNewEmailPage();
     emailPage = new EmailPage();
     emailPage.CreateANewEmail(new Email(emailAddress, emaiSubject, emailText));
 }
Example #5
0
        public override void BaseOneTimeSetUp()
        {
            emailPage = Navigator.NavigateToEmailPage(driver);
            HomePage hPage = new HomePage(driver);

            hPage.LoginB();
        }
        public void SendAnEmailToRandom()
        {
            var RandomEmail = GetRandomEmailAddress.GetRandomEmail();

            new StartPage().Login(new User(LogIn, Password));
            new InboxPage().GoToSentPage();

            var sentPage = new SentPage();

            sentPage.DeleteAllSent();
            sentPage.GoToNewEmailPage();

            var emailPage = new EmailPage();

            emailPage.CreateANewEmail(new Email(EmailAddress, EmailSubject, EmailText));
            emailPage.SaveAsADraft();
            emailPage.GoToDraftPage();

            new DraftPage().OpenEmail();

            emailPage.SendEmail();
            emailPage.GoToSentPage();

            Assert.IsTrue(sentPage.SentEmailExist());
        }
Example #7
0
        public void SendFolderAfterSendingTest()
        {
            var startForm = new StartPage();

            startForm.Login(LogIn, Password);
            var inboxForm = new InboxPage();

            inboxForm.GoToSentPage();
            var sentForm = new SentPage();

            sentForm.DeleteAllSent();
            sentForm.GoToNewEmailPage();
            var emailForm = new EmailPage();

            emailForm.CreateANewEmail(EmailAddress, EmailSubject, EmailText);
            emailForm.SaveAsADraft();
            emailForm.GoToDraftPage();
            var draftForm = new DraftPage();

            draftForm.OpenEmail();
            emailForm.SendEmail();
            emailForm.GoToSentPage();

            Assert.IsTrue(sentForm.SentEmailExist());
        }
Example #8
0
        public bool AutorizeAndCheckSpam()
        {
            string    login1     = ConfigurationManager.AppSettings["login1"];
            string    pass1      = ConfigurationManager.AppSettings["password1"];
            string    login2     = ConfigurationManager.AppSettings["login2"];
            string    pass2      = ConfigurationManager.AppSettings["password2"];
            string    ip         = ConfigurationManager.AppSettings["ip"];
            IPLocator ipl        = new IPLocator(ip);
            string    textToSend = $"Hello, Dear. \r\n I'm writing you from {ipl.GetCityByIP()}. Weather is perfect. I'm waiting for You.";
            LoginPage loginPage  = new LoginPage();

            loginPage.OpenPage();
            loginPage.SetLoginAndPassword(login1, pass1);
            EmailPage emailPage = new EmailPage();

            emailPage.SendEmail(login2, textToSend);
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login2, pass2);
            emailPage.AddToSpam();
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login1, pass1);
            emailPage.SendEmail(login2, $"new {textToSend}");
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login2, pass2);
            emailPage.GoToSpam();
            return(emailPage.CheckSpam($"new {textToSend}"));
        }
Example #9
0
        public bool SetVacation()
        {
            string    login1    = ConfigurationManager.AppSettings["login1"];
            string    pass1     = ConfigurationManager.AppSettings["password1"];
            string    login3    = ConfigurationManager.AppSettings["login3"];
            string    pass3     = ConfigurationManager.AppSettings["password3"];
            string    subject   = ConfigurationManager.AppSettings["subject"];
            string    message   = ConfigurationManager.AppSettings["message"];
            LoginPage loginPage = new LoginPage();

            loginPage.OpenPage();
            Thread.Sleep(4000);
            LoginPage lp = new LoginPage();

            try
            {
                //                ep.Logout();
                lp.SwitchUser();
            }
            catch (Exception) { }
            loginPage.SetLoginAndPassword(login3, pass3);
            EmailPage ep = new EmailPage();

            ep.SetVacationResponder(subject, message);
            ep.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login1, pass1);
            ep.SendEmail(login3, "testing");
            Thread.Sleep(10000);
            ep.Driver.Navigate().Refresh();
            return(ep.CheckFirstMessage(subject));
        }
Example #10
0
        public void TestSendAndDeleteMail()
        {
            // Login to the mail box.
            HomePage homePage = Login();

            // Send a mail.
            EmailPage emailPage = homePage.ClickWriteBtn();

            emailPage.CreateDraft(this.mailTo, this.subject, this.text);
            emailPage.SendDraft();

            // Delete sent mail.
            SentPage sentPage = homePage.OpenSent();

            sentPage.SelectMailBySubject(this.subject);
            sentPage.DeleteSelectedMail();

            // Verify, that the mail disappeared from ‘Sent’ folder.
            sentPage.RefreshPage();
            bool isMailDisplayed = sentPage.IsMailDisplayed(this.subject);

            Assert.IsFalse(isMailDisplayed);

            // Verify, that the mail is in ‘Trash’ folder
            TrashPage trashPage            = sentPage.OpenTrash();
            string    subjectOfDeletedMail = trashPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfDeletedMail, "The mail wasn't deleted");

            // Log out.
            trashPage.Logout();
        }
Example #11
0
        public void Verify_Subject_Field()
        {
            EmailPage emailPage = new EmailPage(driver);

            emailPage.IncomingMailsTab().Click();
            emailPage.FirstMail().Click();
            Assert.AreEqual("Letter for test", emailPage.Subject().Text);
        }
Example #12
0
        public void Verify_Receiver_Field()
        {
            EmailPage emailPage = new EmailPage(driver);

            emailPage.IncomingMailsTab().Click();
            emailPage.FirstMail().Click();
            Assert.AreEqual("*****@*****.**", emailPage.Receiver().Text);
        }
Example #13
0
        public void Verify_Description_Field()
        {
            EmailPage emailPage = new EmailPage(driver);

            emailPage.IncomingMailsTab().Click();
            emailPage.FirstMail().Click();
            Assert.IsTrue(emailPage.Description().Text.Contains("Description Test"));
        }
Example #14
0
        public void Create_New_Mail()
        {
            EmailPage emailPage = new EmailPage(driver);

            emailPage.CreateNewLetter();
            emailPage.IncomingMailsTab().Click();
            Assert.AreEqual("Letter for test", emailPage.SubjectOfIncomingMail().Text);
        }
Example #15
0
        public bool ForwardMailToAnotherUser(string Path)
        {
            string    login1      = ConfigurationManager.AppSettings["login1"];
            string    pass1       = ConfigurationManager.AppSettings["password1"];
            string    login2      = ConfigurationManager.AppSettings["login2"];
            string    pass2       = ConfigurationManager.AppSettings["password2"];
            string    login3      = ConfigurationManager.AppSettings["login3"];
            string    pass3       = ConfigurationManager.AppSettings["password3"];
            string    textToSend  = "Check Forward with attach";
            string    textToSend2 = "Check Forward without attach";
            LoginPage loginPage   = new LoginPage();

            loginPage.OpenPage();
            Thread.Sleep(4000);
            EmailPage ep = new EmailPage();
            LoginPage lp = new LoginPage();

            try
            {
//                ep.Logout();
                lp.SwitchUser();
            }
            catch (Exception) { }
            loginPage.SetLoginAndPassword(login2, pass2);
            EmailPage emailPage = new EmailPage();

            emailPage.GoToForwarding();
            emailPage.SetForward(login3);
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login3, pass3);
            emailPage.ConfirmForward();
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login2, pass2);
            emailPage.GoToForwarding();
            emailPage.SelectForwardToAndAddFilters(login1);
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login1, pass1);
            Thread.Sleep(4000);
            emailPage.SendEmailWithAttach(/*ConfigurationManager.AppSettings["attachPath"]*/ Path, login2, textToSend);
            emailPage.SendEmail(login2, textToSend2);
            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login2, pass2);
            bool check1 = emailPage.CheckInbox(textToSend2);

            emailPage.GoToBin();
            bool check2 = emailPage.CheckBin(textToSend);

            emailPage.Logout();
            loginPage.SwitchUser();
            loginPage.SetLoginAndPassword(login3, pass3);
            bool check3 = emailPage.CheckInbox(textToSend2);

            return(check1 && check2 && check3);
        }
        [Ignore] // TODO fix failure when IDM is turned off
        public void Employee_Send_Email()
        {
            Console.WriteLine("WindowHandle at Start: " + Driver.GetHashCode().ToString());

            // pages
            // the Applicant Profile page shares some of the same buttons as the employee page
            // TODO create a new page object for employees
            var applicantProfilePage = new ApplicantProfilePages(Driver);
            var email = new EmailPage(Driver);

            // workflows
            var searchWorkflows = new SearchWorkflows(Driver);

            // test data
            const string empNo    = "484";
            const string empName  = "Automation Employee";
            const string empEmail = "*****@*****.**";

            // randomly generate an email subject in order to verify the email was sent correctly
            var rand      = new Random();
            var emailBody = rand.Next().ToString();

            try  //Contains Contents of Test
            {
                //test.Log(LogStatus.Info, "Starting test at URL: " + BaseUrls["ApplitrackLoginPage"]);

                // Open the employee page
                searchWorkflows.OpenEmployeeUsingSearch(empNo, empName);

                // Click the Email button
                Driver.SwitchToFrameById("Emp" + empNo);
                applicantProfilePage.Toolbar.ClickEmailButton();

                // Send the email
                Driver.SwitchToPopup();
                Driver.SwitchToFrameByClass("cke_wysiwyg_frame");
                email.EnterEmailBody(emailBody);
                Driver.SwitchToDefaultFrame();
                email.ClickSendMessageButton();
                test.Log(LogStatus.Pass, "Click the Send Message button");

                // Assert that the email address is displayed on the page
                Assert.IsTrue(email.IsEmailAddressDisplayed(empEmail), "Expected email: " + empEmail + " is not on the screen");
                test.Log(LogStatus.Pass, "The email address: " + empEmail + " appears on the page");
                Driver.ClosePopup();

                // TODO figure out why this is failing on teamcity - error message -Could not find part of the path
                // Check to see if the email was sent
                //Assert.IsTrue(GmailApi.FindEmail(emailBody), "The email was not found in the gmail inbox");
                //test.Log(LogStatus.Pass, "Email found in gmail inbox");
            }
            catch (Exception e) //On Error Do
            {
                HandleException(e, Driver);
                throw;
            }
        }
Example #17
0
        public void Check_Received_Mails()
        {
            EmailPage emailPage = new EmailPage(driver);

            Assert.AreEqual("Невелика довідка про можливості пошти", emailPage.FirstLetter().Text);
            Assert.AreEqual("Рекомендації по безпеці Вашого акаунту", emailPage.SecondLetter().Text);
            Assert.AreEqual("Обережно шахраї!", emailPage.ThirdLetter().Text);
            Assert.AreEqual("Ласкаво просимо на I.UA!", emailPage.FourthLetter().Text);
        }
Example #18
0
        public void VerifyLogin(string domain)
        {
            HomePage hPage = new HomePage(driver);

            hPage.SelectDomain(domain);
            hPage.LoginB();
            EmailPage ePage = new EmailPage(driver);

            Assert.IsFalse(ePage.SettingsButton.Displayed);
        }
Example #19
0
        public void Verify_Fields_Of_Sent_Letter()
        {
            EmailPage emailPage = new EmailPage(driver);

            emailPage.CreateNewLetter();
            emailPage.IncomingMailsTab().Click();
            emailPage.FirstMail().Click();

            Assert.AreEqual("Letter for test", emailPage.Subject().Text);
            Assert.IsTrue(emailPage.Description().Text.Contains("Description Test"));
            Assert.AreEqual("*****@*****.**", emailPage.Receiver().Text);
        }
Example #20
0
        public void DownloadFile()
        {
            string FilePath = @"C:\Users\Lenovo Y500\Desktop\TestFiles\";

            EmailPage emailPage = new EmailPage(driver);

            emailPage.IncomingMailsTab().Click();
            emailPage.FirstMail().Click();

            driver.FindElement(By.LinkText("UploadTEST.txt")).Click();
            Thread.Sleep(2000);
        }
        public void CreateDraftEmailTest()
        {
            new StartPage().Login(new User(LogIn, Password));
            new InboxPage().GoToNewEmailPage();

            var emailPage = new EmailPage();

            emailPage.CreateANewEmail(new Email(EmailAddress, EmailSubject, EmailText));
            emailPage.SaveAsADraft();
            emailPage.GoToDraftPage();

            Assert.AreEqual(EmailAddress, new DraftPage().GetEmailAddress());
        }
Example #22
0
        public void TestCleanUp()
        {
            //    WebDriver.CloseDriver();
            EmailPage ep = new EmailPage();
            LoginPage lp = new LoginPage();

            try
            {
                ep.Logout();
                lp.SwitchUser();
            }
            catch (Exception) { }
        }
Example #23
0
        public void TestCreateAndSendDraft()
        {
            // Login to the mail box.
            HomePage homePage     = Login();
            string   writeBtnText = homePage.GetWriteBtnText();

            // Assert, that the login is successful: Если появляется кнопка Написать, значит вход выполнен успешно
            StringAssert.Contains("Написать", writeBtnText, "Login failed.");

            // Create a new mail(fill addressee, subject and body fields).
            EmailPage emailPage = homePage.ClickWriteBtn();

            emailPage.CreateDraft(this.mailTo, this.subject, this.text);

            // Save the mail as a draft.
            emailPage.SaveAndCloseDraft();

            // Verify, that the mail presents in ‘Drafts’ folder.
            DraftsPage draftsPage            = homePage.OpenDrafts();
            string     subjectOfCreatedDraft = draftsPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfCreatedDraft, "Draft wasn't saved");

            // Verify the draft content(addressee, subject and body – should be the same as in 3).
            emailPage = draftsPage.OpenMailBySubject(this.subject);
            string draftBody    = emailPage.GetBodyText();
            string draftMailTo  = emailPage.GetDraftMailToText();
            string draftSubject = emailPage.GetDraftSubjectText();

            StringAssert.Contains(this.mailTo, draftMailTo, "TO value is not expected");
            StringAssert.Contains(this.subject, draftSubject, "Subject value is not expected");
            StringAssert.Contains(this.text, draftBody, "Body value is not expected");

            // Send the mail.
            emailPage.SendDraft();

            // Verify, that the mail disappeared from ‘Drafts’ folder.
            draftsPage.RefreshPage();
            bool isDraftDisplayed = draftsPage.IsMailDisplayed(this.subject);

            Assert.IsFalse(isDraftDisplayed);

            // Verify, that the mail is in ‘Sent’ folder.
            SentPage sentPage          = draftsPage.OpenSent();
            string   subjectOfSentMail = sentPage.GetMailSubjectText(this.subject);

            Assert.AreEqual(this.subject, subjectOfSentMail, "Mail is not in 'Sent' folder");

            // Log out.
            sentPage.Logout();
        }
        private async Task <string> GetEmailBody(string content, EmailProperties emailProperties)
        {
            // Deserialize the content into an EmailPage object
            EmailPage emailPage = JsonSerializer.Deserialize <EmailPage>(content, new JsonSerializerOptions
            {
                PropertyNameCaseInsensitive = true
            });


            // Create the body
            string body = await emailPage.CreateBody(context);

            return(emailProperties.Set(body));
        }
Example #25
0
        public void TestSmokeEmail()
        {
            User user = usercreator.Create(login, password);

            //Login to the mail.ru
            HomePage  homePage  = new HomePage();
            InboxPage inboxPage = homePage.Login(user);

            //Assert a user is logged in
            Assert.IsTrue(inboxPage.IsSucessfullyLoggedIn(), "User is not logged in");

            //Create a new mail
            EmailPage emailPage = inboxPage.ClickCreateNewMessageButton();

            email = new DraftEmail(email);

            //Navigate to DraftsPage
            NavigationMenu navigationMenu = new NavigationMenu();
            DraftsPage     draftsPage     = navigationMenu.NavigateToDrafts();

            //Open Draft Email on DraftsPage
            emailPage = draftsPage.ClickDraftEmail(email);

            //Verify the draft content (addressee, subject and body – should be the same)
            Assert.IsTrue(emailPage.GetAddress().Equals(address), "Address is wrong.");
            Assert.IsTrue(emailPage.GetSubject().Equals(email.subject), "Message subject doesn't match");
            Assert.IsTrue(emailPage.GetMessage().Contains(expectedTestBody), "Message is incorrect.");

            //Send the mail
            emailPage.ClickSendEmailButton();

            // Verify the email is sent message
            //Assert.IsTrue(emailPage.GetVerificationMessage().Contains(ExpectedMessage));

            //Navigate to DraftsPage and verify, that the mail disappeared from ‘Drafts’ folder
            draftsPage = navigationMenu.NavigateToDrafts();
            draftsPage.WaitForEmailDisappearedBySubject(email.subject);
            Assert.IsFalse(draftsPage.IsEmailPresentBySubject(email.subject));

            //Navigate to SentPage
            SentPage sentPage = navigationMenu.NavigateToSent();

            //Verify, that the mail presents in ‘Sent’ folder.
            sentPage.WaitForEmailinSentFolder(subject);
            Assert.IsTrue(sentPage.IsEmailPresentBySubject(email.subject));

            //Log out
            navigationMenu.LogOut();
        }
        public void CompareDraftEmailTextTest()
        {
            new StartPage().Login(new User(LogIn, Password));
            new InboxPage().GoToNewEmailPage();

            var emailForm = new EmailPage();

            emailForm.CreateANewEmail(new Email(EmailAddress, EmailSubject, EmailText));
            emailForm.SaveAsADraft();
            emailForm.GoToDraftPage();

            new DraftPage().OpenEmail();

            Assert.IsTrue(emailForm.GetDraftEmailText().Contains(EmailSubject));
        }
        public void CreateDraftEmailTest()
        {
            var startForm = new StartPage();

            startForm.Login(LogIn, Password);
            var inboxForm = new InboxPage();

            inboxForm.GoToNewEmailPage();
            var emailForm = new EmailPage();

            emailForm.CreateADraft(EmailAddress, EmailSubject, EmailText);
            emailForm.GoToDraftPage();
            var draftForm = new DraftPage();

            Assert.AreEqual(EmailAddress, draftForm.GetEmailAddress());
        }
        public void CompareDraftEmailTextTest()
        {
            var startForm = new StartPage();

            startForm.Login(LogIn, Password);
            var inboxForm = new InboxPage();

            inboxForm.GoToNewEmailPage();
            var emailForm = new EmailPage();

            emailForm.CreateADraft(EmailAddress, EmailSubject, EmailText);
            emailForm.GoToDraftPage();
            var draftForm = new DraftPage();

            draftForm.OpenEmail();

            Assert.IsTrue(emailForm.GetDraftEmailText().Contains(EmailSubject));
        }
Example #29
0
        public void TestSmokeEmail()
        {
            //Login to the mail.ru
            HomePage homePage = new HomePage();

            homePage.Login(login, password);

            //Assert, that the login is successful
            InboxPage inboxPage = new InboxPage();

            inboxPage.ClickCreate();

            //Create a new mail
            EmailPage emailPage = new EmailPage();

            emailPage.CreateDraftEmail(address, subject, expectedTestBody);

            //Navigate to DraftsPage
            NavigationMenu navigationMenu = new NavigationMenu();
            DraftsPage     draftsPage     = navigationMenu.NavigateToDrafts();

            //Verify, that the mail presents in ‘Drafts’ folder.
            draftsPage.ClickDraftEmail(subject);

            //Verify the draft content (addressee, subject and body – should be the same)
            emailPage = new EmailPage();
            emailPage.CheckEmailFields(address, subject, expectedTestBody);

            //Send the mail
            emailPage.SendEmail();

            //Navigate to DraftsPage and verify, that the mail disappeared from ‘Drafts’ folder
            draftsPage = navigationMenu.NavigateToDrafts();
            draftsPage.CheckDisappearedEmail(subject);

            //Navigate to SentPage
            SentPage sentPage = navigationMenu.NavigateToSent();

            //Verify, that the mail presents in ‘Sent’ folder.
            sentPage.CheckSentEmail(subject);

            //Log out
            homePage = navigationMenu.LogOut();
        }
        public void DragAndDropEmailTest()
        {
            new StartPage().Login(new User(LogIn, Password));
            new InboxPage().GoToSentPage();

            var sentPage = new SentPage();

            sentPage.DeleteAllSent();
            sentPage.GoToNewEmailPage();

            var emailPage = new EmailPage();

            emailPage.CreateANewEmail(new Email(EmailAddress, EmailSubject, EmailText));
            emailPage.SendEmail();
            emailPage.GoToSentPage();
            sentPage.DragAndDropFromSentToDelete();

            Assert.IsFalse(sentPage.SentEmailExist());
        }
        public void ATC3316_CRMInvestigationVerifyRelatedActivitiesOwnerUpdation()
        {
            #region Start Up Excel
            MyBook = MyApp.Workbooks.Open(DatasourceDir + @"\Investigations.xlsx", 0, false, 5, "", "", true, Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
            MySheet = (Excel.Worksheet)MyBook.Sheets[Properties.Settings.Default.ENVIRONMENT.ToString()];
            MyRange = MySheet.UsedRange;

            //Get specific row for the data
            int testDataRows = MyRange.Rows.Count;
            int MyRow = 0;
            for (int i = 2; i <= testDataRows; i++)
            {
                if (MyRange.Cells[i, 1].Value.ToString() == "ClientTestData")
                {
                    MyRow = i;
                    break;
                }
            }
            #endregion

            string clientName = MyRange.Cells[MyRow, InvestigationSchema.GetColumnIndex(ColumnName.CLIENT_NAME)].Value;

            User user = this.environment.GetUser(SecurityRole.InvestigationOfficer);
            new LoginDialog().Login(user.Id, user.Password);

            // Create Investigation Case
            HomePage homePage = new HomePage(driver);
            string HomeWindow = driver.CurrentWindowHandle;
            homePage.HoverCRMRibbonTab();
            homePage.ClickInvestigationsRibbonButton();
            homePage.HoverInvestigationsRibbonTab();
            homePage.ClickInvestigationsCasesRibbonButton();

            InvestigationCaseSearchPage investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.ClickNewInvestigationCaseButton();

            // Create new case
            InvestigationCasePage investigationCasePage = new InvestigationCasePage(driver);
            string BaseWindow = driver.CurrentWindowHandle;
            investigationCasePage.ClickSaveButton();
            String investigationID = investigationCasePage.GetInvestigationCaseNumber();

            //Email
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Email");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            EmailPage emailPage = new EmailPage(driver);
            emailPage.ClickPageTitle();
            emailPage.SetToValueText(clientName);
            Thread.Sleep(500);
            emailPage.SetSubjectValueText("Test 3316 Email");
            emailPage.ClickSaveCloseIMG();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            //Fax
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Fax");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            FaxPage faxPage = new FaxPage(driver);
            faxPage.ClickPageTitle();
            faxPage.SetSubjectValue("Test 3316 Fax");
            faxPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            //Letter
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Letter");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(1000);
            LetterPage letterPage = new LetterPage(driver);
            letterPage.ClickPageTitle();
            letterPage.SetSubjectValue("Test 3316 Letter");
            letterPage.ClickSaveButton();
            letterPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            //Phone Call
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Phone Call");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            PhoneCallPage phoneCall = new PhoneCallPage(driver);
            Thread.Sleep(100);
            phoneCall.ClickPageTitle();
            phoneCall.SetSelectSubjectValue("Bond balance enquiry");
            phoneCall.SetSubject("Test 3316 Phone Call");
            Thread.Sleep(500);
            phoneCall.SetRecipient(clientName);
            phoneCall.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Client Management Activity
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Client Management Activity");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            ClientManagementActivityPage clientManagementActivityPage = new ClientManagementActivityPage(driver);
            clientManagementActivityPage.ClickPageTitle();
            clientManagementActivityPage.SetSubjectValue("Test 3316 Client Management Activity");
            clientManagementActivityPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Front Counter Contact
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Front Counter Contact");
            Thread.Sleep(2000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(1000);
            FrontCounterContactPage frontCounterContactPage = new FrontCounterContactPage(driver);
            frontCounterContactPage.SetSubjectValue("Test 3316 Front Counter Contact");
            frontCounterContactPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Task
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddTaskButton("Task");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(500);
            TaskPage taskPage = new TaskPage(driver);
            taskPage.ClickPageTitle();
            taskPage.SetSelectSubjectValue("Bond existence");
            taskPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Recurring Appointment
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Appointment");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            AppointmentPage appointmentPage = new AppointmentPage(driver);
            string AppWindow = driver.CurrentWindowHandle;
            appointmentPage.ClickPageTitle();
            appointmentPage.SetStartRange(DateTime.Today.AddDays(1).ToString("dd/MM/yyyy"));
            appointmentPage.ClickPageTitle();
            appointmentPage.ClickRecurrenceButton();
            appointmentPage.ClickSetButton();
            driver = driver.SwitchTo().Window(AppWindow);
            appointmentPage = new AppointmentPage(driver);
            appointmentPage.ClickPageTitle();
            appointmentPage.SetSubjectValue("Test 3316 Recurring Appointment");
            appointmentPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Appointment
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickActivitiesAddButton();
            investigationCasePage.ClickAddActivity("Appointment");
            Thread.Sleep(1000);
            driver = investigationCasePage.SwitchNewBrowser(driver, BaseWindow);
            Thread.Sleep(2000);
            appointmentPage = new AppointmentPage(driver);
            appointmentPage.ClickPageTitle();
            appointmentPage.SetSubjectValue("Test 3316 Appointment");
            appointmentPage.ClickSaveCloseButton();
            Thread.Sleep(2000);
            driver = driver.SwitchTo().Window(BaseWindow);

            // Change the owner value
            investigationCasePage.ClickPageTitle();
            investigationCasePage.SetOwnerValue("IMSTestU04");
            investigationCasePage.ClickSaveCloseButton();
            investigationsCaseSearchPage = new InvestigationCaseSearchPage(driver);
            investigationsCaseSearchPage.SetSearchRecord(investigationID);
            Table table = new Table(investigationsCaseSearchPage.GetSearchResultTable());
            table.ClickCellValue("Case Number", investigationID, "Case Number");

            driver = driver.SwitchTo().Window(BaseWindow);
            investigationCasePage.ClickPageTitle();
            investigationCasePage.ClickSeeRecordsAssociatedWithThisViewButton("Activities");
            Thread.Sleep(1000);

            investigationCasePage.SetActivitiesSearchText("Test 3316 Email");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Email", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Fax");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Fax", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Letter");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Letter", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Phone Call");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Phone Call", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Client Management Activity");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Client Management Activity", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Front Counter Contact");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Front Counter Contact", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText(investigationID + ": Bond existence");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", investigationID + ": Bond existence", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Appointment");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Appointment", "Owner"), "IMSTestU04");

            investigationCasePage.SetActivitiesSearchText("Test 3316 Recurring Appointment");
            table = new Table(investigationCasePage.GetActivitiesAssociatedViewTable());
            StringAssert.Contains(table.GetCellContainsValue("Subject", "Test 3316 Recurring Appointment", "Owner"), "IMSTestU04");

            #region Shut down Excel
            MyBook.Save();
            MyBook.Close();
            MyApp.Quit();
            #endregion
        }