Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
        public void  SaveInDrafts()
        {
            try
            {
                createPage = new CreateMailPage(driver);

                //Assert.IsTrue(createPage.LetterButton.Displayed);
                createPage.LetterButton.Click();
                // return new InboxPage(driver);
            }
            catch (OpenQA.Selenium.NoSuchElementException)
            {
                // Console.WriteLine("Ошибка: " + ex.Message);
                draftsPage = new DraftsPage(driver);
                //Thread.Sleep(2000);
                draftsPage.InboxLetter.Click();
                //InboxPage inboxPage = draftsPage.OpenInboxLetters();
                //InboxPage DraftsPage.OpenInboxLetters();
                // return new InboxPage(driver);
            }

            // LetterButton.Click();
            //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();
        }
Ejemplo n.º 3
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();
        }
Ejemplo n.º 4
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 + "']"));*/
        }
Ejemplo n.º 5
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 + "']"));
        }