public void clearData()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            LoadHelper loadHelper = new LoadHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "Username");
            password = oXMLData.getData("settings/credentials", "Password");

            //Verify Page title
            verifyTitle("MAPCITE");

            //Click on Map button
            loadHelper.ClickElement("MapButton");

            //Wait for text in page
            loadHelper.WaitForTextVisible("Log in", 30);

            login(username[0], password[0]);

            //Wait for Home Page
            loadHelper.WaitForWorkArround(3000);

            //Verify page title
            verifyTitle("MAPCITE");

            //Verify User login successfully
            loadHelper.VerifyPageText("Log off");

            //Remove Dataset
            loadHelper.ClickElement("Admin");

            loadHelper.DeleteData("DataDrop", "Heatmap UK Test");
            loadHelper.DeleteData("DataDrop", "Country Populations");
            loadHelper.DeleteData("DataDrop", "AnalyticsResults1");

            //Select import from menu
            loadHelper.ClickElement("Import");

            //Click on next button
            loadHelper.ClickElement("Next");

            loadHelper.WaitForWorkArround(4000);

            loadHelper.DeleteAll();

            //Logout from the application
            logout();
     
        }
Example #2
0
        public void login()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            LoginHelper loginHelper = new LoginHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "Username");
            password = oXMLData.getData("settings/credentials", "Password");

            //Verify Page title
            verifyTitle("MAPCITE");

            //Click on Map button
            loginHelper.ClickElement("MapButton");

            //Wait for text in page
            loginHelper.WaitForTextVisible("Log in",30);

            //Enter User name
            loginHelper.type("username", username[0]);

            //Enter Password
            loginHelper.type("password", password[0]);

            //Click on Login Button
            loginHelper.ClickElement("Login");

            //Wait for Home Page
            loginHelper.WaitForWorkArround(3000);

            //Verify page title
            verifyTitle("MAPCITE");

            //Verify User login successfully
            loginHelper.VerifyPageText("Log off");

            //Click on Logout from the application
            loginHelper.ClickElement("Logout");

            //Verify User logout successfully
            loginHelper.WaitForTextVisible("Map", 30);

        }
        public void visualisationHeatmap()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            VisualisationHelper visualisationHelper = new VisualisationHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "Username");
            password = oXMLData.getData("settings/credentials", "Password");

            //Verify Page title
            verifyTitle("MAPCITE");

            //Click on Map button
            visualisationHelper.ClickElement("MapButton");

            //Wait for text in page
            visualisationHelper.WaitForTextVisible("Log in", 30);

            login(username[0], password[0]);

            //Wait for Home Page
            visualisationHelper.WaitForWorkArround(3000);

            //Verify page title
            verifyTitle("MAPCITE");

            //Verify User login successfully
            visualisationHelper.VerifyPageText("Log off");

            //Verify heatmap available or not
            bool result = visualisationHelper.verifyText("Heatmap UK Test");
            if (!result)
            {
                LoadHelper loadHelper = new LoadHelper(GetWebDriver());
                loadHelper.ClickElement("Import");
                loadHelper.ClickElement("Next");
                String path = loadHelper.getPath() + "Heatmap Test UK.csv";
                loadHelper.UploadFile("Upload", path);
                loadHelper.WaitForWorkArround(5000);
                loadHelper.ClickElement("ImportHeatmapFile");
                loadHelper.SelectByText("Lattitude", "Latitude");
                loadHelper.SelectByText("Longitude", "Longitude");
                loadHelper.ClickElement("LongNext");
                loadHelper.SelectAllCheck("CheckBox1");
                loadHelper.ClickElement("CheckNext");
                loadHelper.WaitForWorkArround(5000);
                loadHelper.ClickElement("AuthorityCheck");
                loadHelper.acceptAlert();
                loadHelper.ClickElement("AuthNext");
                loadHelper.SelectByText("Numeric", "population");
                loadHelper.ClickElement("NumeNext");
                loadHelper.type("Dataset", "Heatmap UK Test");
                loadHelper.ClickElement("Beginimport");
                loadHelper.WaitForTextHide("Data load in progress...", 60000);
                loadHelper.WaitForTextVisible("Import Data from a flat file currently(.csv or Excel (.xls 97-2003 and .xlsx workbook", 6000);
            }
            

            //Enter Oxfordshire to search
            visualisationHelper.type("SearchBox", "Oxfordshire");
            
            //Click on Search button
            visualisationHelper.ClickElement("SearchButton");

            visualisationHelper.WaitForWorkArround(5000);

            //Click on Clear button
            visualisationHelper.ClickElement("ClearButton");
            
            //Select Heatmap Menu
            visualisationHelper.ClickElement("HeatmapMenu");

            visualisationHelper.WaitForWorkArround(3000);

            //Select Heatmap from dropdown
            visualisationHelper.SelectByText("Heatmapdropdown", "Heatmap UK Test");
            
            //Click on Show heatmap checkbox
            visualisationHelper.ClickElement("HeatCheck");

            visualisationHelper.WaitForWorkArround(5000);

            //Withdrawn menu
            visualisationHelper.ClickElement("HeatmapMenu");
            visualisationHelper.WaitForWorkArround(5000);

            //Take screen shot
            visualisationHelper.TakeScreenshot("HeatmapVisualisation_" + GetRandomNumber());

            //Select Heatmap from dropdown
            visualisationHelper.ClickElement("HeatmapMenu");

            //Uncheck Show heatmap checkbox
            visualisationHelper.ClickElement("HeatCheck");

            visualisationHelper.WaitForWorkArround(5000);
            //Logout from the application
            logout();

        }
        public void analysis()
        {
            PathToDownloads pathToDownloads = new PathToDownloads();

            
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            AnalysisHelper analysisHelper = new AnalysisHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "Username");
            password = oXMLData.getData("settings/credentials", "Password");

            //Verify Page title
            verifyTitle("MAPCITE");

            //Click on Map button
            analysisHelper.ClickElement("MapButton");

            //Wait for text in page
            analysisHelper.WaitForTextVisible("Log in", 30);

            login(username[0], password[0]);

            //Wait for Home Page
            analysisHelper.WaitForWorkArround(3000);

            //Verify page title
            verifyTitle("MAPCITE");

            //Verify User login successfully
            analysisHelper.VerifyPageText("Log off");
            
            //Verify heatmap available or not
            bool result = analysisHelper.verifyText("Heatmap UK Test");
            if (!result)
            {
                LoadHelper loadHelper = new LoadHelper(GetWebDriver());
                loadHelper.ClickElement("Import");
                loadHelper.ClickElement("Next");
                String path = loadHelper.getPath() + "Heatmap Test UK.csv";
                loadHelper.UploadFile("Upload", path);
                loadHelper.WaitForWorkArround(5000);
                loadHelper.ClickElement("ImportHeatmapFile");
                loadHelper.WaitForWorkArround(4000);
                loadHelper.SelectByText("Lattitude", "Latitude");
                loadHelper.SelectByText("Longitude", "Longitude");
                loadHelper.ClickElement("LongNext");
                loadHelper.SelectAllCheck("CheckBox1");
                loadHelper.ClickElement("CheckNext");
                loadHelper.WaitForWorkArround(5000);
                loadHelper.ClickElement("AuthorityCheck");
                loadHelper.acceptAlert();
                loadHelper.ClickElement("AuthNext");
                loadHelper.SelectByText("Numeric", "population");
                loadHelper.ClickElement("NumeNext");
                loadHelper.type("Dataset", "Heatmap UK Test");
                loadHelper.ClickElement("Beginimport");
                loadHelper.WaitForTextHide("Data load in progress...", 60000);
                loadHelper.WaitForTextVisible("Import Data from a flat file currently(.csv or Excel (.xls 97-2003 and .xlsx workbook", 6000);
            }

            //Remove Dataset
            analysisHelper.ClickElement("AdminMenu");

            analysisHelper.DeleteData("DataDrop", "AnalyticsResults1");
            
            //Enter Aberdeen,uk to search
            analysisHelper.type("SearchBox", "Aberdeen,uk");

            //Click on Search button
            analysisHelper.ClickElement("SearchButton");
            
            //Select the dataset menu
            analysisHelper.ClickElement("DatasetMenu");
            
            analysisHelper.WaitForWorkArround(5000);

            //Select the left hand pin from the two that are visible
            analysisHelper.ClickByIndex("ShowDataSet");

            analysisHelper.WaitForWorkArround(5000);
            
            //Click on Left pin
            analysisHelper.ClickByIndex("LeftPin");

            //Selecting the pin will bring up a modal box
            analysisHelper.WaitForTextVisible("Marker Inspector", 6000);

            //Select the Analytics Tab
            analysisHelper.ClickElement("AnalyticsTab");

            //Select the Analysis Tab
            analysisHelper.ClickElement("AnalysisTab");

            //Select JulianTest1 from the Saved Formula dropdown
            analysisHelper.SelectByText("LoadFormula", "JulianTest1");

            //press the Load button
            analysisHelper.ClickElement("Load");

            //Select the Run button from lower down in the modal box
            analysisHelper.ClickElement("Run");
            analysisHelper.WaitForWorkArround(3000);

            //Select “Heatmap UK Test” in the “Dataset to Run…..” drop down
            analysisHelper.SelectByText("FormAgainst", "Heatmap UK Test");

            //Enter name
            analysisHelper.type("AnaticName", "AnalyticsResults1");

            //Select the Run against dataset button
            analysisHelper.ClickElement("RunAgainst");

            //Wait for completion message (could be 3-4 minutes)
            analysisHelper.WaitForAlert();

            //Select ok
            analysisHelper.acceptAlert();

            analysisHelper.WaitForWorkArround(3000);

            //Close marker window
            analysisHelper.ClickElement("CloseMarker");

            //Select Dataset menu
            analysisHelper.ClickElement("DatasetMenu");

            //Check new Dataset present called AnalyticsResults1
            analysisHelper.WaitForTextVisible("AnalyticsResults1", 5000);
            
            //Enter “Europe” in the search box
            analysisHelper.type("SearchBox", "Europe");

            //Click on Search button
            analysisHelper.ClickElement("SearchButton");

            analysisHelper.WaitForWorkArround(5000);

            //Remove large pin
            analysisHelper.ClickElement("ClearButton");

            //Select the “Draw” menu
            analysisHelper.ClickElement("Drawmenu");

            //Select the rectangle option
            analysisHelper.ClickElement("Rect");
            analysisHelper.WaitForWorkArround(3000);

            //Click the map in the top left hand corner outside the UK and drag the slection to the bottom right (as shown below) 
            String exe = analysisHelper.getPath() + "Rect.exe";
            System.Diagnostics.Process.Start(exe);

            analysisHelper.WaitForWorkArround(5000);
            
            //Select AnalyticsResults1 in the dataset dropdown
            analysisHelper.SelectByText("AnaDrop", "AnalyticsResults1");

            //Select CSV in the format dropdown 
            analysisHelper.SelectByText("Format", "CSV");

            //Select export.  This will download the data as CSV
            analysisHelper.ClickElement("Export");

            analysisHelper.WaitForWorkArround(5000);
            exe = analysisHelper.getPath() + "SaveDialog.exe";
            System.Diagnostics.Process.Start(exe);

            analysisHelper.WaitForWorkArround(5000);

            //Save CSV file to test directory
            Assert.IsTrue(pathToDownloads.pathToFile("Export_*.csv"));
             
            //Select the dataset menu
            analysisHelper.ClickElement("DatasetMenu");

            analysisHelper.WaitForWorkArround(5000);

            //Uncheck the data set
            analysisHelper.ClickByIndex("ShowDataSet");

            analysisHelper.WaitForWorkArround(5000);
            //Logout from the application
            logout();
            
        }
        public void visualizationChoropleth()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            VisualisationHelper visualisationHelper = new VisualisationHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "Username");
            password = oXMLData.getData("settings/credentials", "Password");

            //Verify Page title
            verifyTitle("MAPCITE");

            //Click on Map button
            visualisationHelper.ClickElement("MapButton");

            //Wait for text in page
            visualisationHelper.WaitForTextVisible("Log in", 30);

            login(username[0], password[0]);

            //Wait for Home Page
            visualisationHelper.WaitForWorkArround(3000);

            //Verify page title
            verifyTitle("MAPCITE");

            //Verify User login successfully
            visualisationHelper.VerifyPageText("Log off");

            //Verify heatmap available or not
            bool result = visualisationHelper.verifyText("Country Populations");
            if (!result)
            {
                LoadHelper loadHelper = new LoadHelper(GetWebDriver());
                loadHelper.ClickElement("Import");
                loadHelper.ClickElement("Next");
                String path = loadHelper.getPath() + "Choropleth World Countries - False Populations.csv";
                loadHelper.UploadFile("Upload", path);
                loadHelper.WaitForWorkArround(5000);
                loadHelper.ClickElement("ImportPopulationFile");
                loadHelper.WaitForWorkArround(5000);
                loadHelper.SelectByText("Lattitude", "latitude");
                loadHelper.SelectByText("Longitude", "longitude");
                loadHelper.ClickElement("LongNext");
                loadHelper.SelectAllCheck("CheckBox1");
                loadHelper.ClickElement("CheckNext");
                loadHelper.ClickElement("AuthNext");
                loadHelper.SelectByText("Numeric", "Flse Population Pos");
                loadHelper.ClickElement("NumeNext");
                loadHelper.type("Dataset", "Country Populations");
                loadHelper.ClickElement("Beginimport");
                loadHelper.WaitForTextHide("Data load in progress...", 60000);
                loadHelper.WaitForTextVisible("Import Data from a flat file currently(.csv or Excel (.xls 97-2003 and .xlsx workbook", 6000);
            }


            //Enter Europe to search
            visualisationHelper.type("SearchBox", "Europe");

            //Click on Search button
            visualisationHelper.ClickElement("SearchButton");

            visualisationHelper.WaitForWorkArround(5000);

            //Click on Clear button
            visualisationHelper.ClickElement("ClearButton");

            //Select Choropleth Menu
            visualisationHelper.ClickElement("ChoroplethMenu");

            visualisationHelper.WaitForWorkArround(3000);

            //Select country population from the dropdown
            visualisationHelper.SelectByText("CountryDropdown", "Country Populations");

            //Select Word Borders in Shapeset dropdown
            visualisationHelper.SelectByText("Shapeset", "World Borders");

            //Check the Choropleth checkbox
            visualisationHelper.ClickElement("ChoroplethCheck");

            //Select “OK” to the message and wait
            visualisationHelper.WaitForWorkArround(3000);
            visualisationHelper.acceptAlert();

            //Wait for the process to complete
            visualisationHelper.WaitForTextVisible("Choropleth Loaded", 60000);

            //Select the choropleth menu button to withdraw the menu
            visualisationHelper.ClickElement("ChoroplethMenu");

            visualisationHelper.WaitForWorkArround(5000);

            //Take a screenshot of the active window
            visualisationHelper.TakeScreenshot("Choropleth_" + GetRandomNumber());

            //Select the choropleth menu button to withdraw the menu
            visualisationHelper.ClickElement("ChoroplethMenu");

            //Uncheck the Choropleth checkbox
            visualisationHelper.ClickElement("ChoroplethCheck");

            //Logout from the application
            logout();

        }
        public void loadDataSet2()
        {
            string[] username = null;
            string[] password = null;

            XMLParse oXMLData = new XMLParse();
            oXMLData.LoadXML("../../Config/ApplicationSetting.xml");
            LoadHelper loadHelper = new LoadHelper(GetWebDriver());

            username = oXMLData.getData("settings/credentials", "Username");
            password = oXMLData.getData("settings/credentials", "Password");

            //Verify Page title
            verifyTitle("MAPCITE");

            //Click on Map button
            loadHelper.ClickElement("MapButton");

            //Wait for text in page
            loadHelper.WaitForTextVisible("Log in", 30);

            login(username[0], password[0]);

            //Wait for Home Page
            loadHelper.WaitForWorkArround(3000);

            //Verify page title
            verifyTitle("MAPCITE");

            //Verify User login successfully
            loadHelper.VerifyPageText("Log off");

            //Remove Dataset
            loadHelper.ClickElement("Admin");

            loadHelper.DeleteData("DataDrop", "Country Populations");

            //Select import from menu
            loadHelper.ClickElement("Import");

            loadHelper.WaitForWorkArround(4000);

            //Click on next button
            loadHelper.ClickElement("Next");

            String path = loadHelper.getPath() + "Choropleth World Countries - False Populations.csv";

            //Select browse button and browse to file
            loadHelper.UploadFile("Upload", path);

            loadHelper.WaitForWorkArround(5000);

            //Select Import button against Heatmap Test UK Dataset
            loadHelper.ClickElement("ImportPopulationFile");

            loadHelper.WaitForWorkArround(5000);

            //Select Lat/Long radio button
            loadHelper.ClickElement("LonLat");
            loadHelper.WaitForWorkArround(2000);

            //Select Latitude field in Latitude Field drop down and Longitude field in Longitude Field drop down
            loadHelper.SelectByText("Lattitude", "latitude");
            loadHelper.SelectByText("Longitude", "longitude");
            
            //Select Next button
            loadHelper.ClickElement("LongNext");

            //Select checkbox on all fields, including longitude – just off screen.  Then select next
            loadHelper.SelectAllCheck("CheckBox1");

            //Select next
            loadHelper.ClickElement("CheckNext");

            //Select next
            loadHelper.ClickElement("AuthNext");
            
            //Select the population field in the dropdown selector for Numeric Field.  Leave the other as “No datefield”.
            loadHelper.SelectByText("Numeric", "Flse Population Pos");
            
            //Select next 
            loadHelper.ClickElement("NumeNext");

            //Enter the name “Country Populations” in the Dataset Name box
            loadHelper.type("Dataset", "Country Populations");
            
            //press the “begin import” button
            loadHelper.ClickElement("Beginimport");

            //Wait until the import is finished
            loadHelper.WaitForTextHide("Data load in progress...", 60000);

            //Verify file imported successfully
            loadHelper.WaitForTextVisible("Import Data from a flat file currently(.csv or Excel (.xls 97-2003 and .xlsx workbook", 6000);

            //Validate dataset loaded by going to Dataset menu and finding dataset listed
            loadHelper.ClickElement("DataSetMenu");
            loadHelper.WaitForTextVisible("Country Populations", 5000);

            //Logout from the application
            logout();

        }