public void Init()
        {
            //Deleting cookies in ie browser through command line.
            /*var procStartInfo = new System.Diagnostics.ProcessStartInfo("cmd", "/c RunDll32.exe InetCpl.cpl,ClearMyTracksByProcess 2");
            var proc = new System.Diagnostics.Process { StartInfo = procStartInfo };
            proc.Start();
            WebDriverObj = new InternetExplorerDriver();
            */
            string URL = "https://stg-gib.ladbrokes.com/admin";
            WebDriverObj = new FirefoxDriver();
            MyBrowser = new WebDriverBackedSelenium(WebDriverObj, URL);
            MyBrowser.Start();
            WebDriverObj.Manage().Window.Maximize();
            MyBrowser.WindowMaximize();

            MyBrowser.Open(URL);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Refresh();
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Type(TestDataCreation.ControlsRepository.UsrNmeTxtBx, "Automation1");
            MyBrowser.Type(TestDataCreation.ControlsRepository.PwdTxtBx, "aditi123");
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
            MyBrowser.Click(TestDataCreation.ControlsRepository.LoginBtn);
            MyBrowser.WaitForPageToLoad(FrameGlobals.PageLoadTimeOut);
        }
Exemple #2
0
        public void StartSelenium()
        {
            string platform = System.Configuration.ConfigurationManager.AppSettings["Platform"];
            selenium = new DefaultSelenium("localhost", 4444, platform, "http://www.google.com.hk/");

            selenium.Start();
            selenium.WindowMaximize();
        }
 /// <summary>
 /// Instantiates a new Home Page object. Pass in the Selenium object created in the test SetUp(). 
 /// When the object in instantiated it will navigate to the root
 /// </summary>
 /// Selenium Object created in the tests
 public Home(ISelenium selenium)
 {
     this._selenium = selenium;
     if (!selenium.GetTitle().Contains("home"))
     {
         selenium.Open("/");
     }
     selenium.WindowMaximize();
 }
Exemple #4
0
 public void StartupServer(string _ip)
 {
     selenium =
         new DefaultSelenium("localhost", 4444, "*firefox", _ip);//firefox//googlechrome//iexplore
     selenium.Start();
     selenium.SetSpeed("500");
     selenium.Open("/config");
     selenium.WindowMaximize();
     System.Threading.Thread.Sleep(1000);
 }
Exemple #5
0
        public void SetupTest()
        {
            selenium = new DefaultSelenium("localhost", 4444, "*firefox", url);
            selenium.SetSpeed("1000");
            selenium.Start();
            verificationErrors = new StringBuilder();
            selenium.Open("");
            selenium.WindowMaximize();

            //selenium.KeyDown(ID, "13");//enter key
        }
Exemple #6
0
 public void TheSampleMVCTestsTest()
 {
     selenium.Open("/");
     selenium.WindowMaximize();
     selenium.Click("link=Home");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=About");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Contact");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Home");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=About");
     selenium.WaitForPageToLoad("30000");
     selenium.Click("link=Contact");
     selenium.WaitForPageToLoad("30000");
 }
Exemple #7
0
        public void StartSelenium()
        {
            verificationErrors = new StringBuilder();

            string platform = System.Configuration.ConfigurationManager.AppSettings["Platform"];
            this.URL = System.Configuration.ConfigurationManager.AppSettings["TestURL"];
            //get un/pw from db
            //this.UN = "";
            //this.PW = "";

            selenium = new DefaultSelenium("localhost", 4444, platform, this.URL);
            //selenium = new DefaultSelenium("localhost", 4444, "*firefox3 C:\\Program Files\\Mozilla Firefox\\firefox.exe", "http://dev.lofinc.net");
            selenium.Start();
            Thread.Sleep(5000);
            selenium.WindowMaximize();

            selenium.SetTimeout("0");
            selenium.Open("/admin/");
            this.selenium.WaitForPageToLoad("5000");
        }
Exemple #8
0
        public static void Start(BrowserType btype, PlatformType ptype, string driverPath, string url)
        {
            selenim = new DefaultSelenium("localhost", 4444, btype.ToString(), url);

            Init(btype, url, ptype, driverPath);

            selenim.Start();

            selenim.WindowMaximize();

            webDriver.Manage().Window.Maximize();

            if (btype != BrowserType.Chrome && btype != BrowserType.Safari)
            {
                webDriver.Manage().Timeouts().SetPageLoadTimeout(TimeSpan.FromSeconds(60000));
            }

            webDriver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(60000));

            selenim.WaitForPageToLoad("120000");

            webDriver.Url = url;
            //selenim.Open(url);
        }
 public void MyTestInitialize()
 {
     selenium = new DefaultSelenium("localhost", 4441, "*googlechrome", "http://seleniumhq.org/"); // "*iehta" IE -  "*firefoxproxy" FF - *googlechrome
     selenium.Start();
     selenium.WindowMaximize();
 }
Exemple #10
0
 public void OpenNewBrowser()
 {
     _selenium.Open("/");
     _selenium.WindowMaximize();
     Thread.Sleep(5000);
 }
Exemple #11
0
 public void WindowMaximize()
 {
     selenium.WindowMaximize();
 }
        public void XeroSimple_NewRepInvoice()
        {
            selenium.Open("/");

            //Maximizing the window
            selenium.WindowMaximize();

            //check for "Welcome to XERO" text on the Login Page
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Welcome to Xero" == selenium.GetText("css=h2.x-boxed.noBorder"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Welcome to Xero", selenium.GetText("css=h2.x-boxed.noBorder"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the credentials to login
            selenium.Type("id=email", "*****@*****.**");
            selenium.Type("id=password", "swamiji123");
            selenium.Click("id=submitButton");
            selenium.WaitForPageToLoad("30000");

            //Check for the organization name as"Demo NZ" on the following page
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ" == selenium.GetText("id=title"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ", selenium.GetText("id=title"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // On the DashBoard page, Clicking on the "Go to Sales" Link
            selenium.Click("link=Go to Sales ›");
            selenium.WaitForPageToLoad("30000");

            //Checking whether the Sales page is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Sales" == selenium.GetText("css=#page_title > div > h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Sales", selenium.GetText("css=#page_title > div > h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Click on the repeating invoice option in the dropdown on the Sales page
            selenium.Click("css=#ext-gen1037 > span");
            selenium.Click("link=Repeating invoice");
            selenium.WaitForPageToLoad("30000");

            //Checking whether the New Repeating Invoice is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ - New Repeating Invoice" == selenium.GetText("//div[@id='bodyContainer']/div/div/h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ - New Repeating Invoice", selenium.GetText("//div[@id='bodyContainer']/div/div/h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Enter all the valid values for the Invoice page
            string InvoiceDate = DateTime.Now.AddDays(1).ToString("dd MMM yyyy");

            selenium.Type("id=StartDate", InvoiceDate);
            selenium.Type("id=DueDateDay", "1");
            selenium.Click("id=DueDateType_toggle");
            selenium.Click("//div[@id='DueDateType_suggestions']/div/div[2]");
            selenium.Click("id=saveAsAutoApproved");
            selenium.Type("//div[@id='ext-gen48']/input", "Associated Limited");
            selenium.Type("//div[@id='invoiceForm']/div/div[2]/div/input", "Sanjana");
            Thread.Sleep(300);

            //Enter the Items in the  first row of the Table from the inventory
            selenium.Click("//div[@id='ext-gen19']/div/table/tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[8]/div/div[5]");

            //Enter the Items in the  second row of the Table from the inventory
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[8]/div/div[6]");

            //Deleting all the un- necessary rows from the table
            selenium.Click("//div[@id='ext-gen19']/div[3]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[3]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[3]/table/tbody/tr/td[11]/div/div/div");

            //Save the invoice
            selenium.Click("xpath=(//button[@type='button'])[3]");

            //Checking whether the invoice is created
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Repeating Template Saved. Click to view." == selenium.GetText("//div[@id='notify01']/div/p"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Repeating Template Saved. Click to view.", selenium.GetText("//div[@id='notify01']/div/p"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }
            public void TestUpload([Values("BathroomFixtures02.zip",
                                           "Bidet02.zip",
                                           "BlockTable02.zip",
                                           "Chandleir01.zip",
                                           "Chandleir03.zip",
                                           "ClassicDresser02.zip",
                                           "ClassicWoodCoffeeTable02.zip",
                                           "CoffeeTAble02.zip",
                                           "Console02.zip",
                                           "Console03.zip",
                                           "DeskLamp02.zip",
                                           "DinnerChair with arms02.zip",
                                           "DinnerChair01.zip",
                                           "DinnerChair02.zip",
                                           "DirectorsChair02.zip",
                                           "Dresser02.zip",
                                           "EasyChair02.zip",
                                           "EasyChair03.zip",
                                           "EasyChair04.zip",
                                           "ElegantCouch02.zip",
                                           "FloorLamp01.zip",
                                           "FloorLamp03.zip",
                                           "GreenChair02.zip",
                                           "GreenCouch02.zip",
                                           "Grill02.zip",
                                           "Lamp01.zip",
                                           "Lamp02.zip",
                                           "Lamp03.zip",
                                           "LargeChaise02.zip",
                                           "MetalDiningChair02.zip",
                                           "MetalDinnerChairArms02.zip",
                                           "MetalExteriorChair02.zip",
                                           "MetalPoolChair02.zip",
                                           "Microwave02.zip",
                                           "MissionTable01.zip",
                                           "MissionTable02.zip",
                                           "ModernCeilingLight02.zip",
                                           "ModernConsoleTable02.zip",
                                           "ModernEasyChair02.zip",
                                           "ModernEndTable02.zip",
                                           "ModernFloorLamp02.zip",
                                           "ModernHangingLight02.zip",
                                           "ModernSconce01.zip",
                                           "ModernSconce02.zip",
                                           "OfficeChair02.zip",
                                           "OutdoorChair02.zip",
                                           "OvenFront02.zip",
                                           "PlushCouch02.zip",
                                           "RectangularAutoman02.zip",
                                           "RollingChaise02.zip",
                                           "RoundAutoman02.zip",
                                           "RoundEndTable01.zip",
                                           "RoundEndTable02.zip",
                                           "Sconce02.zip",
                                           "ServingTrayTable02.zip",
                                           "SquareLamp02.zip",
                                           "Stool02.zip",
                                           "TableLamp02.zip",
                                           "Tent 02.zip",
                                           "Tent02.zip",
                                           "Toilet02.zip",
                                           "Umbrella 01.zip",
                                           "Umbrella01.zip",
                                           "Umbrella03.zip",
                                           "WickerAutoman02.zip",
                                           "WickerChair02.zip",
                                           "WickerCouch02.zip",
                                           "WickerOutdoorLoveseat02.zip",
                                           "WingBackChair02.zip",
                                           "WoodAndMetalCoffeeTable02.zip",
                                           "WoodAndMetalDinnerTable01.zip",
                                           "WoodAndMetalDinnerTable02.zip",
                                           "WoodenDresser02.zip",
                                           "WoodEndTable02.zip")]  string filename)
            {
                selenium.WindowMaximize();
                selenium.Open("/Default.aspx");
                selenium.WindowFocus();

                if (!UserLoggedIn)
                {
                    Login();
                }

                selenium.WaitForPageToLoad("30000");
                selenium.Open("/Users/Upload.aspx");
                selenium.WaitForPageToLoad("30000");

                path = _3DR_Testing.Properties.Settings.Default.ContentPath;
                if (String.IsNullOrEmpty(filename))
                {
                    verificationErrors.Append("Error, filename to be upload cannot be blank.");
                    return;
                }
                else if (!File.Exists(path + filename))
                {
                    verificationErrors.Append("Error, " + path + filename + " could not be found");
                    return;
                }


                bool uploadResult = UploadFile(path + filename, UploadButtonIdentifier.MODEL_UPLOAD);

                if (!uploadResult)
                {
                    return;
                }

                string windowHandle  = "selenium.browserbot.getCurrentWindow()";
                string currentFormat = "";

                try
                {
                    selenium.WaitForCondition(windowHandle + ".MODE != ''", "20000");
                    currentFormat = selenium.GetEval(windowHandle + ".MODE");
                    string formatDetectStatus = selenium.GetText("id=formatDetectStatus");
                    int    substringIndex     = formatDetectStatus.LastIndexOf("Format Detected:");
                    switch (currentFormat)
                    {
                    case "VIEWABLE":
                        Assert.GreaterOrEqual(substringIndex, 0);
                        selenium.WaitForCondition(windowHandle + ".ModelConverted == true", "120000");
                        string conversionStatus = selenium.GetText("id=conversionStatus");
                        if (conversionStatus != "Conversion Failed")
                        {
                            Assert.AreEqual("Model Ready for Viewer", conversionStatus);
                            break;
                        }
                        else
                        {
                            return;      //Conversion failed, test has ended
                        }

                    case "RECOGNIZED":
                        Assert.GreaterOrEqual(substringIndex, 0);
                        break;

                    case "MULTIPLE_RECOGNIZED":
                        Assert.AreEqual("Multiple Models Detected", formatDetectStatus);
                        return;     //We have multiple recognized models, so the test has ended

                    case "UNRECOGNIZED":
                        Assert.AreEqual("Unrecognized Format", formatDetectStatus);
                        return;     //Unrecognized format, test has ended

                    default:
                        Assert.AreEqual("Server Error", formatDetectStatus);
                        return;     //Invalid server response, test has ended
                    }
                }
                catch (SeleniumException e)
                {
                    throw new NUnit.Framework.InconclusiveException(e.Message);
                }

                string title = String.Format("Automatic Upload of {0} at {1}",
                                             filename,
                                             DateTime.Now.ToString());

                selenium.Type("id=ctl00_ContentPlaceHolder1_Upload1_TitleInput", title);
                selenium.Type("id=ctl00_ContentPlaceHolder1_Upload1_DescriptionInput", FormDefaults.Description);
                selenium.Type("id=ctl00_ContentPlaceHolder1_Upload1_TagsInput", FormDefaults.Tags);

                string nextButtonDisplay = selenium.GetEval(windowHandle + ".jQuery('#nextbutton_upload').css('display')");

                Assert.AreEqual("block", nextButtonDisplay);

                selenium.Click("id=nextbutton_upload");
                Thread.Sleep(3000);
                string imageFileName = path + FormDefaults.ScreenshotFilename;//GetImageFileName(filename);

                if (currentFormat == "VIEWABLE")
                {
                    scaleValue  = selenium.GetEval("window.g_unitscale");
                    upAxisValue = selenium.GetEval("window.g_upaxis");
                    selenium.GetEval("window.updateCamera()");
                    selenium.Click("id=SetThumbnailHeader");
                    Thread.Sleep(500);
                    selenium.Click("id=ViewableSnapshotButton");
                    selenium.WaitForCondition("var thumbnailSrc = " + windowHandle + ".jQuery('#ThumbnailPreview_Viewable').attr('src');" +
                                              "thumbnailSrc != window.thumbnailLoadingLocation && thumbnailSrc != window.previewImageLocation", "30000");
                }
                else
                {
                    if (!UploadFile(imageFileName, UploadButtonIdentifier.SCREENSHOT_RECOGNIZED))
                    {
                        return;
                    }
                }

                selenium.Click("id=nextbutton_step2");
                Thread.Sleep(3000);

                selenium.Type("id=DeveloperName", FormDefaults.DeveloperName);
                selenium.Type("id=ArtistName", FormDefaults.ArtistName);
                selenium.Type("id=DeveloperUrl", FormDefaults.DeveloperUrl);
                UploadFile(path + FormDefaults.DevLogoFilename, UploadButtonIdentifier.DEVLOGO);

                selenium.Click("id=SponsorInfoTab");

                selenium.Type("id=SponsorName", FormDefaults.SponsorName);
                UploadFile(path + FormDefaults.SponsorLogoFilename, UploadButtonIdentifier.SPONSORLOGO);

                selenium.Click("id=nextbutton_step3");
                selenium.WaitForPageToLoad("120000");

                Assert.True(selenium.IsTextPresent(FormDefaults.ArtistName));
                Assert.True(selenium.IsTextPresent(FormDefaults.DeveloperName));
                Assert.True(selenium.IsTextPresent(FormDefaults.DeveloperUrl));
                Assert.True(selenium.IsTextPresent(FormDefaults.SponsorName));
                Assert.True(selenium.IsTextPresent(FormDefaults.Description));

                int tagsCount = 0;

                string[] expectedTags = FormDefaults.Tags.Split(',');
                foreach (string s in expectedTags)
                {
                    if (selenium.IsTextPresent(s))
                    {
                        tagsCount++;
                    }
                }
                if (tagsCount < expectedTags.Length)
                {
                    throw new Exception("Not all tags were found on the details page.");
                }

                Assert.AreEqual(FormDefaults.LicenseTypeUrl, selenium.GetAttribute("ctl00_ContentPlaceHolder1_CCLHyperLink@href"));
                if (currentFormat == "VIEWABLE")
                {
                    Thread.Sleep(1000);
                    selenium.Click("xpath=//div[@id='ctl00_ContentPlaceHolder1_ViewOptionsTab']/div/ul/li[2]/a/span/span/span");
                    selenium.WaitForCondition("window.g_init == true", "60000");
                    Assert.AreEqual(scaleValue, selenium.GetEval("window.g_unitscale"));
                    Assert.AreEqual(upAxisValue.ToLower(), selenium.GetEval("window.g_upaxis").ToLower());
                }
            }
        public void TheXero_NewInventory_NewRepInvoiceTest()
        {
            selenium.Open("/");

            //Maximizing the window
            selenium.WindowMaximize();

            //check for "Welcome to XERO" text on the Login Page
            try
            {
                Assert.AreEqual("Welcome to Xero", selenium.GetText("css=h2.x-boxed.noBorder"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the credentials for Login
            selenium.Type("id=email", "*****@*****.**");
            selenium.Type("id=password", "swamiji123");
            selenium.Click("id=submitButton");
            selenium.WaitForPageToLoad("30000");

            // Checking for the organization name "Demo NZ" on the DashBoard
            try
            {
                Assert.AreEqual("Demo NZ", selenium.GetText("id=title"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Navigate to the Sales page through the Accounts Tab
            selenium.Click("id=Accounts");
            selenium.Click("link=Sales");
            selenium.WaitForPageToLoad("30000");

            // Check whether the Sales page is opened
            try
            {
                Assert.AreEqual("Sales", selenium.GetText("css=#page_title > div > h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Navigate to the New Repeating Invoice Page by clicking the repeating invoice option in the dropdown
            selenium.Click("css=#ext-gen1037 > span");
            selenium.Click("css=li.ico-repeating-invoice > a > b");
            selenium.WaitForPageToLoad("30000");

            //Checking if the New Repeating Invoice page is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ - New Repeating Invoice" == selenium.GetText("//div[@id='bodyContainer']/div/div/h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ - New Repeating Invoice", selenium.GetText("//div[@id='bodyContainer']/div/div/h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Entering all the valid inputs on the page.
            string InvoiceDate = DateTime.Now.AddDays(1).ToString("dd MMM yyyy");

            selenium.Type("id=StartDate", InvoiceDate);
            selenium.Click("id=DueDateDay");
            selenium.Type("id=DueDateDay", "1");
            selenium.Click("id=DueDateType_toggle");
            selenium.Click("//div[@id='DueDateType_suggestions']/div/div[2]");
            selenium.Click("id=saveAsAutoApproved");
            selenium.Type("//div[@id='ext-gen48']/input", "associates");
            selenium.Click("//div[@id='invoiceForm']/div/div[2]/div/input");
            selenium.Type("//div[@id='invoiceForm']/div/div[2]/div/input", "sanjana");

            // Enter data in the Item's table by adding a new item in the Inventory.
            selenium.Click("//tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[8]/div/div/span");
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Item Code" == selenium.GetText("css=div.field.code > label"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Item Code", selenium.GetText("css=div.field.code > label"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the item code,Item name,unit Price and Description of your chioce before executing.
            // Using javascript method to randomly create the item code.
            selenium.Type("//div[@id='lineItem']/div/div/div/input", "javascript{Math.floor(Math.random()*9000)+1000}");
            selenium.Type("//div[@id='lineItem']/div/div[2]/div/input", "apples");
            selenium.Type("//div[@id='lineItem']/div[3]/div[2]/div/div/input", "40");
            selenium.Click("id=Account_toggle");
            selenium.Click("//div[@id='Account_suggestions']/div/div[12]");
            selenium.Type("//div[@id='lineItem']/div[3]/div[2]/div[4]/div/textarea", "board");
            selenium.Click("link=Save");

            Thread.Sleep(5000);

            //Save the invoice
            selenium.Click("xpath=(//button[@type='button'])[3]");
            selenium.WaitForPageToLoad("30000");


            //Checking whether the invoice is created
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Repeating Template Saved. Click to view." == selenium.GetText("//div[@id='notify01']/div/p"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Repeating Template Saved. Click to view.", selenium.GetText("//div[@id='notify01']/div/p"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }
Exemple #15
0
        public void TheXero_DraftEmail_NewRepInvoiceTest()
        {
            selenium.Open("/");

            //Maximizing the window
            selenium.WindowMaximize();

            //check for "Welcome to XERO" text on the Login Page
            try
            {
                Assert.AreEqual("Welcome to Xero", selenium.GetText("css=h2.x-boxed.noBorder"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Entering the credentials for Login
            selenium.Type("id=email", "*****@*****.**");
            selenium.Type("id=password", "swamiji123");
            selenium.Click("id=submitButton");
            selenium.WaitForPageToLoad("30000");

            // Checking for the organization name "Demo NZ" on the DashBoard
            try
            {
                Assert.AreEqual("Demo NZ", selenium.GetText("id=title"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Navigate to the Sales page through the Accounts Tab
            selenium.Click("id=Accounts");
            selenium.Click("link=Sales");
            selenium.WaitForPageToLoad("30000");

            // Check whether the Sales page is opened
            try
            {
                Assert.AreEqual("Sales", selenium.GetText("css=#page_title > div > h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            //Navigate to the New Repeating Invoice Page by clicking the repeating invoice option in the dropdown
            selenium.Click("css=#ext-gen1037 > span");
            selenium.Click("link=Repeating invoice");
            selenium.WaitForPageToLoad("30000");

            //Checking if the New Repeating Invoice page is opened
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Demo NZ - New Repeating Invoice" == selenium.GetText("//div[@id='bodyContainer']/div/div/h1"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Demo NZ - New Repeating Invoice", selenium.GetText("//div[@id='bodyContainer']/div/div/h1"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Entering all the valid inputs on the page.
            string InvoiceDate = DateTime.Now.AddDays(1).ToString("dd MMM yyyy");

            selenium.Type("id=StartDate", InvoiceDate);
            selenium.Type("id=DueDateDay", "1");
            selenium.Click("id=DueDateType_toggle");
            selenium.Click("//div[@id='DueDateType_suggestions']/div/div[2]");

            //Checking the Drafting of Email facility of the Invoice page when we choose the Approve for sending option on the New Repeating Invoice page.
            selenium.Click("id=saveAsAutoApprovedAndEmail");
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("" == selenium.GetText("//form[@id='frmEmailStatements']/div/div/div/div/div[3]/input"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }

            //Entering the Email Id and all the other details of the customer
            selenium.Type("//form[@id='frmEmailStatements']/div/div/div/div/div[3]/input", "*****@*****.**");
            selenium.Type("//form[@id='frmEmailStatements']/div/div/div/div/div[9]/div[6]/textarea", "Hi Prabodh,\n\nHere's your [Current Month] invoice [Invoice Number] for [Invoice Total].\n\nThe amount outstanding of [Amount Due] is due on [Due Date].\n\nView and pay your bill online: [Online Invoice Link]\n\nFrom your online bill you can print a PDF, export a CSV, or create a free login and view your outstanding bills.\n\nIf you have any questions, please let us know.\n\nThanks,\n[Trading Name]");
            Thread.Sleep(1000);
            selenium.Click("//div/button");
            selenium.Type("//div[@id='ext-gen48']/input", "associated limited");
            selenium.Type("//div[@id='invoiceForm']/div/div[2]/div/input", "sanjana");
            Thread.Sleep(1000);

            //Enter data in the first row of the Item's table from the inventory
            selenium.Click("//div[@id='ext-gen19']/div/table/tbody/tr/td[2]/div");
            selenium.Click("//div[2]/div/img");
            selenium.Click("//div[@id='ext-gen84']/div[5]");

            //Deleting the unused rows
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");
            selenium.Click("//div[@id='ext-gen19']/div[2]/table/tbody/tr/td[11]/div/div/div");

            //Saving the data
            selenium.Click("xpath=(//button[@type='button'])[3]");

            //Checking whether the invoice is created
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("Repeating Template Saved. Click to view." == selenium.GetText("//div[@id='notify01']/div/p"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("Repeating Template Saved. Click to view.", selenium.GetText("//div[@id='notify01']/div/p"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }

            // Deleting all the invoices made
            selenium.Click("//table[@id='ext-gen48']/thead/tr/td/input");
            selenium.Click("css=#ext-gen45 > span.text");
            selenium.Click("//div[2]/div[2]/a/span");
            selenium.WaitForPageToLoad("30000");

            //Checking if the repeated transactions are deleted
            for (int second = 0; ; second++)
            {
                if (second >= 60)
                {
                    Assert.Fail("timeout");
                }
                try
                {
                    if ("There are no items to display." == selenium.GetText("//div[7]"))
                    {
                        break;
                    }
                }
                catch (Exception)
                { }
                Thread.Sleep(1000);
            }
            try
            {
                Assert.AreEqual("There are no items to display.", selenium.GetText("//div[7]"));
            }
            catch (AssertionException e)
            {
                verificationErrors.Append(e.Message);
            }
        }