示例#1
0
        public TestParametar()
        {
            SearchListPage.WriteInto("Start of Test parameter");

            string configFilePath = @"C://TestConfiguration//config.xml";

            if (!File.Exists(configFilePath))
            {
                throw new FileNotFoundException("Specified test configuration file does not exist.");
            }


            //Load configuration xml file
            XmlDocument doc = new XmlDocument();

            doc.Load(configFilePath);
            string browsersValue = doc.DocumentElement.SelectSingleNode("//testconfiguration//browser").InnerText;

            string urlValue = doc.DocumentElement.SelectSingleNode("//testconfiguration//url").InnerText;


            if (string.IsNullOrWhiteSpace(browsersValue))
            {
                throw new ArgumentNullException("Test parameters from configuration XML file are not valid. Please check configuration xml file");
            }
            else
            {
                this.browser = browsersValue;
                this.url     = urlValue;
            }

            SearchListPage.WriteInto("End of Test parameter");
        }
示例#2
0
        public void Init()
        {
            SearchListPage.WriteInto("Start of init");

            TestParametar parameters = new TestParametar();
            int           n          = int.Parse(parameters.browser);

            Driver.Initialize(n);
            SearchListPage.WriteInto("End of init");
        }
示例#3
0
        public void TEST_SearcForBg()
        {
            string subject = "",
                   body    = "";

            string url = "";

            SearchListPage.WriteInto("TEST_SearcForBg" + "_Start of Test_" + DateTime.Now.ToString("(dd_MMMM_hh_mm_ss_tt)"));
            SearchListPage.WriteInto("Start of Login");
            TestParametar parameters = new TestParametar();

            url = parameters.url;

            LoginPage.GoTo(url);

            string TestName   = "SearchForBg";
            string folderpath = @"C:/ScreenShot/" + TestName + "/";

            SearchListPage.WriteInto("Start of DeleteFolder");
            SearchForBgList.DeleteFolder(folderpath);

            SearchListPage.WriteInto("Start of CreateFolder");
            SearchForBgList.CreateFolder(folderpath);

            SearchListPage.WriteInto("Start of Searching Image");
            string imageMessage = SearchForBgList.SearchImageOnGoogle("Beograd", 4);

            SearchListPage.WriteInto("End of Searching");

            subject = "Moj treci test";

            if (!imageMessage.Contains("ERROR"))
            {
                subject = "Passed!!! " + subject;
                body    = "Google image upload option works properly" + "\n" + imageMessage;
            }
            else
            {
                subject = "Failed!!! " + subject;
                body    = imageMessage;
            }

            SearchListPage.WriteInto("Start of Attachment");
            SearchForBgList.SendEmailAttachment(subject, body, TestName);
            SearchListPage.WriteInto("End of Attachment");


            Assert.IsTrue(subject.Contains("Passed"));
            Assert.IsFalse(subject.Contains("Failed"));

            SearchListPage.WriteInto(TestName + "_End of Test_" + DateTime.Now.ToString("(dd_MMMM_hh_mm_ss_tt)"));
        }
示例#4
0
        public void TEST_SearchForFF()
        {
            string subject = "",
                   body    = "";


            string testName = "SearchForFF";

            string folderpath = @"C:/ScreenShot/" + testName + "/";

            SearchListPage.DeleteFolder(folderpath);
            SearchListPage.CreateFolder(folderpath);


            LoginPage.GoTo("https://www.google.com/");
            SearchPage.FindText("Jugoslavija");

            // SearchListPage.GoTo(ListType.Page);

            string imageMessage = SearchListPage.SelectImage("Slike", testName);
            string allMessage   = SearchListPage.SelectAll("Sve", testName);
            string videoMessage = SearchListPage.SelectVideo("Videozapisi", testName);
            string booksMessage = SearchListPage.SelectBooks("Više", "Knjige", testName);
            string idMessage    = SearchListPage.ClickOnElementByID("hdtb-tls");

            subject = "Ovo je naslov email-a mog prvog testa!";
            body    = imageMessage + "\n" + allMessage + "\n" + videoMessage + "\n" + booksMessage;

            if (!imageMessage.Contains("ERROR") && !allMessage.Contains("ERROR") && !videoMessage.Contains("ERROR") && !booksMessage.Contains("ERROR"))
            {
                subject = "Passed!!! " + subject;
            }
            else
            {
                subject = "Failed!!! " + subject;
            }

            SearchListPage.JSExecuteCode("");

            SearchListPage.SendEmailAttachment(subject, body, testName);

            Assert.IsTrue(subject.Contains("Passed"));
            Assert.IsFalse(subject.Contains("Failed"));
        }
示例#5
0
 public void Cleanup()
 {
     SearchListPage.WriteInto("Start of Driver");
     Driver.Close();
     SearchListPage.WriteInto("End of Driver");
 }