public void UpLoad()
        {
            inboxPage = new InboxPage(driver);
            inboxPage.SubmitCreateMailPage();
            createPage = new CreateMailPage(driver);
            createPage.UploadLiink.Click();
            string File     = "складні запити.xlsx";
            string FilePath = @"D:\Magnis\медіатека\" + File;//задаємо шлях до файлу

            Thread.Sleep(2000);
            WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(800));

            wait.Until(p => driver.FindElement(By.XPath("//input[@type='file']")).Displayed);
            createPage.ChooseFileButton.SendKeys(FilePath);
            createPage.SaveButton.Click();
            DraftsPage draftPage = inboxPage.OpenDrafts();
            Screenshot ss        = ((ITakesScreenshot)driver).GetScreenshot();

            Thread.Sleep(3000);
            string title    = TestContext.CurrentContext.Test.Name;
            string runname  = title + DateTime.Now.ToString("yyyy-MM-dd-HH_mm_ss");
            string filePath = @"C:\Temp\";

            ss.SaveAsFile(filePath + runname + ".jpg", ScreenshotImageFormat.Jpeg);

            string expectedAttachment = draftPage.GetAttachment(File).GetAttribute("title");

            Assert.IsTrue(expectedAttachment.Contains(File));
        }
Example #2
0
        public override void OneTimeSetUp()
        {
            InboxPage inboxPage = Navigator.OpenInboxPage(driver);

            inboxPage.OpenDrafts();
            DraftsPage draftsPage = new DraftsPage(driver);

            draftsPage.DeleteDrafts();
            inboxPage.SubmitCreateMailPage();
        }
Example #3
0
        public void SaveInDrafts()
        {
            //createPage = new CreateMailPage(driver);
            //createPage.SaveButton.Click();
            InboxPage inboxPage = new InboxPage(driver);

            inboxPage.OpenDrafts();
            IWebElement OpenDrafts = driver.FindElement(By.XPath("//span[text()='" + Name + "']"));

            OpenDrafts.Click();
        }
        public void DriverQuite()
        {
            InboxPage inboxPage = new InboxPage(driver);

            //рпропропропорпорпопорп
            inboxPage.OpenDrafts();
            DraftsPage draftsPage = new DraftsPage(driver);

            draftsPage.DeleteDrafts();
            Thread.Sleep(2000);
            driver.Quit();
            if (TestContext.CurrentContext.Result.Outcome.Status.Equals("Failed"))
            {
                inboxPage.TakesScreenshot();
            }
        }
Example #5
0
        public void EditForWhome(string ForWhome)

        {
            createPage = new CreateMailPage(driver);
            createPage.ForWhomeField.SendKeys(ForWhome);
            createPage.SaveButton.Click();
            InboxPage inboxPage = new InboxPage(driver);

            DraftsPage draftPage = inboxPage.OpenDrafts();

            Name = ForWhome;

            IWebElement Element           = draftPage.GetDraftForWhome(ForWhome);
            string      expectedFromWhome = draftPage.GetDraftForWhome(ForWhome).Text;

            Assert.AreEqual(ForWhome, draftPage.GetDraftForWhome(ForWhome).Text);
            //inboxPage.SubmitCreateMailPage();
        }
Example #6
0
        public void EditgSubject(string Subject)
        {
            createPage = new CreateMailPage(driver);
            createPage.SubjectField.SendKeys(Subject);

            createPage.SaveButton.Click();
            InboxPage inboxPage = new InboxPage(driver);

            DraftsPage draftPage = inboxPage.OpenDrafts();

            Name = Subject;
            IWebElement Element         = draftPage.GetDraftSubject(Subject);
            string      expectedSubject = draftPage.GetDraftSubject(Subject).Text;

            Assert.AreEqual("TeMa", draftPage.GetDraftSubject(Subject).Text);

            /*inboxPage.SubmitCreateMailPage();
             * inboxPage.OpenDrafts();
             * IWebElement OpenDrafts = driver.FindElement(By.XPath("//span[text()='" + Name + "']"));*/
        }
Example #7
0
        public void EditLetterText(string ForWhome, string LetterText)
        {
            createPage = new CreateMailPage(driver);
            createPage.ForWhomeField.SendKeys(ForWhome);
            createPage.LetterTextField.SendKeys(LetterText);
            createPage.SaveButton.Click();
            InboxPage  inboxPage = new InboxPage(driver);
            DraftsPage draftPage = inboxPage.OpenDrafts();

            Name = ForWhome;

            IWebElement OpenDrafts = driver.FindElement(By.XPath("//span[text()='" + Name + "']"));

            OpenDrafts.Click();

            IWebElement Element            = draftPage.GetDraftLetterText(LetterText);
            string      expectedLetterText = draftPage.GetDraftLetterText(LetterText).Text;

            Assert.AreEqual(LetterText + "\r\n", draftPage.GetDraftLetterText(LetterText).GetAttribute("value"));
            createPage.SaveButton.Click();
            //  inboxPage.OpenDrafts();
            // IWebElement OpenDrafts = driver.FindElement(By.XPath("//span[text()='" + Name + "']"));
        }
        public void zDownLoad()
        {
            //InboxPage inboxPage = Navigator.OpenInboxPage(driver);
            //inboxPage.OpenDrafts();
            inboxPage = new InboxPage(driver);
            DraftsPage draftPage = inboxPage.OpenDrafts();

            draftPage.CreatedDraft.Click();
            ChromeOptions chromeOptions = new ChromeOptions();
            string        File          = "складні запити.xlsx";
            string        FilePath      = @"//*[@id='attached']/li/b/a";//задаємо шлях до файлу

            chromeOptions.AddUserProfilePreference("download.default_directory", FilePath);
            chromeOptions.AddUserProfilePreference("disable-popup-blocking", "true");
            //Thread.Sleep(3000);
            //string title = TestContext.CurrentContext.Test.Name;
            //string runname = title + DateTime.Now.ToString("yyyy-MM-dd-HH_mm_ss");
            //string filePath = @"C:\Temp\";
            //ss.SaveAsFile(filePath + runname + ".jpg", ScreenshotImageFormat.Jpeg);
            //ChromeDriver driver = new ChromeDriver(chromeOptions);
            Thread.Sleep(2000);
            driver.FindElement(By.LinkText(File)).Click();
        }