public void Upload(string mFileToUpload) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Automatic Test of " + mFileToUpload + " " + System.DateTime.Now.ToString()); SetUploadFile(path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("1200000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "300000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 300)) { count++; System.Threading.Thread.Sleep(1000); } if (selenium.GetEval("window.GetLoadingComplete() == true") == "true") { selenium.GetEval("window.TakeScreenShot();"); System.Threading.Thread.Sleep(3000); //count = 0; //string Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //while (Thumbstring.IndexOf("ScreenShot") == -1 && count < 10) //{ // count++; // System.Threading.Thread.Sleep(1000); // Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //} } // ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("1200000"); }
public void PolygonCount( [Values( "duffle_bag.zip" )] string mFileToUpload ) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Screenshot Test" + System.DateTime.Now.ToString()); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_ContentFileUpload", path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("300000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 30)) { count++; System.Threading.Thread.Sleep(1000); } NUnit.Framework.Assert.AreEqual(selenium.GetEval("window.GetLoadingComplete() == true"), "true"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("30000"); NUnit.Framework.Assert.IsFalse(selenium.IsTextPresent("Number of Polygons: 0")); }
virtual public void UnitScaleInput( [Values( "duffle_bag.zip" )] string mFileToUpload, [Values( ".1", "10" )] string scaleToTest ) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "UnitScaleInput Test: " + scaleToTest + " " + System.DateTime.Now.ToString()); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_ContentFileUpload", path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("300000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 30)) { count++; System.Threading.Thread.Sleep(1000); } NUnit.Framework.Assert.AreEqual(selenium.GetEval("window.GetLoadingComplete() == true"), "true"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_UnitScaleTextBox_text", scaleToTest); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_UnitScaleTextBox", scaleToTest); selenium.Click("//input[@value='Apply']"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("30000"); selenium.Click("//div[@id='ctl00_ContentPlaceHolder1_ViewOptionsTab']/div/ul/li[2]/a/span/span/span"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 30)) { count++; System.Threading.Thread.Sleep(1000); } NUnit.Framework.Assert.AreEqual(scaleToTest, selenium.GetEval("window.GetCurrentUnitScale()")); }
public void FurintureUpload( [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 mFileToUpload) { path = _3DR_Testing.Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", _3DR_Testing.Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", _3DR_Testing.Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", System.IO.Path.GetFileNameWithoutExtension(mFileToUpload)); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ExpandCollapseImage"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_ArtistNameTextBox", "Rob Chadwick"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_SponsorNameTextBox", "ADL"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_FormatTextBox", "Max, Collada"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_KeywordsTextBox_Input"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_KeywordsTextBox_Input", "Furniture"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_AddKeywordButton"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_SponsorLogoFileUpload", "C:\\Documents and Settings\\chadwickr\\My Documents\\Downloads\\logo.gif"); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_CCLicenseDropDownList_Arrow"); selenium.Click("//div[@id='ctl00_ContentPlaceHolder1_Upload1_CCLicenseDropDownList_DropDown']/div/ul/li[5]"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_CCLicenseDropDownList_Input", "Attribution Share Alike (by-sa)"); SetUploadFile(path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("300000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 30)) { count++; System.Threading.Thread.Sleep(1000); } System.Threading.Thread.Sleep(5000); if (selenium.GetEval("window.GetLoadingComplete() == true") == "true") { System.Threading.Thread.Sleep(300); selenium.GetEval("window.updateCamera();"); System.Threading.Thread.Sleep(300); selenium.GetEval("window.TakeScreenShot();"); System.Threading.Thread.Sleep(3000); //count = 0; //string Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //while (Thumbstring.IndexOf("ScreenShot") == -1 && count < 10) //{ // count++; // System.Threading.Thread.Sleep(1000); // Thumbstring = selenium.GetEval("document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage')"); //} } // ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("30000"); }
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 WaitForJQuery() { _selenium.WaitForCondition("selenium.browserbot.getCurrentWindow().jQuery.active == 0;", Timeout); }
public void ScreenShotTest( [Values( "duffle_bag.zip" )] string mFileToUpload, [Values( "o3d", "flash" )] string viewertype ) { path = Properties.Settings.Default.ContentPath; if (mFileToUpload == "") { return; } selenium.Open("/Default.aspx"); if (selenium.IsTextPresent("Sign In")) { selenium.Click("ctl00_LoginStatus1"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_UserName", Properties.Settings.Default._3DRUserName); selenium.Type("ctl00_ContentPlaceHolder1_Login1_Login1_Password", Properties.Settings.Default._3DRPassword); selenium.Click("ctl00_ContentPlaceHolder1_Login1_Login1_LoginButton"); } selenium.WaitForPageToLoad("30000"); selenium.Open("/Users/Upload.aspx"); selenium.WaitForPageToLoad("30000"); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_TitleTextBox", "Screenshot Test" + System.DateTime.Now.ToString()); selenium.Type("ctl00_ContentPlaceHolder1_Upload1_ContentFileUpload", path + mFileToUpload); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_Step1NextButton"); selenium.WaitForPageToLoad("300000"); selenium.WaitForCondition("window.GetLoadingComplete != undefined", "20000"); int count = 0; while ((selenium.GetEval("window.GetLoadingComplete() == true") != "true" && count < 300)) { count++; System.Threading.Thread.Sleep(1000); } NUnit.Framework.Assert.AreEqual(selenium.GetEval("window.GetLoadingComplete() == true"), "true"); selenium.GetEval("window.TakeScreenShot();"); System.Threading.Thread.Sleep(10000); //document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage').src string Thumbstring = selenium.GetEval("window.document.getElementById('ctl00_ContentPlaceHolder1_Upload1_ThumbnailImage').src"); NUnit.Framework.StringAssert.Contains("ScreenShot", Thumbstring); selenium.Click("ctl00_ContentPlaceHolder1_Upload1_ValidationViewSubmitButton"); selenium.WaitForPageToLoad("30000"); string BigThumbSTring = selenium.GetEval("window.document.getElementById('ctl00_ContentPlaceHolder1_ScreenshotImage').src"); NUnit.Framework.StringAssert.Contains("screenshot", BigThumbSTring); }