public void Should_Show_Basic_People_Search() { username = RandomString(); password = RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin", "Finance" }); Login(); Wait(3); Open($"{rootUrl}Bundles/"); Find(text: "Create New Bundle").Click(); Find(id: "Bundle_TotalCash").SendKeys("1000"); Find(xpath: "//button[@type='submit']").Click(); var bundleHeaderId = db.BundleHeaders.OrderByDescending(b => b.CreatedDate).FirstOrDefault().BundleHeaderId; Open($"{rootUrl}PostBundle/{bundleHeaderId}"); Find(xpath: "//input[@id='pid']").SendKeys("1"); Find(xpath: "//input[@id='amt']").SendKeys("100"); Find(xpath: "(//a[contains(text(),'Update')])[4]").Click(); Wait(3); Find(xpath: "//table[@id='bundle']/tbody/tr/td/a").Click(); Wait(3); PageSource.ShouldContain("People to add..."); }
private void CheckForSources() { if (userId == 339) { return; //pageadmin } string srcId = FindFBSource(activity.RawActivity.BodyStr); if (!string.IsNullOrEmpty(srcId)) { Logger.Instance.Debug($"found fb source {srcId} in post.looking for page"); PageSource record = PageSources.GetBySourceId(srcId, "fb_page"); if (record == null) { //create a page and assign this action to it Task.Run(() => CreatePageAndAssignActivity(srcId, activity.ActivityId)); } else { //like or increase like to this page LikeSourceIfPossible(record.page_id, "sitepage_page"); } } }
//[Theory, FeatureTest] //[InlineData(320)] //[InlineData(425)] //[InlineData(768)] //Disabled until we can fix the flakiness public void Should_Open_Datepicker_On_Mobile_Resolutions(int width) { var window = driver.Manage().Window; window.Size = new Size(width, window.Size.Height); username = RandomString(); password = RandomString(); string roleName = "role_" + RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin", "Finance" }); Login(); Open($"{rootUrl}Bundle/Edit/{new FinanceTestUtils(db).BundleHeader.BundleHeaderId}"); Wait(10); PageSource.ShouldContain("Contribution Bundle"); Check_If_DateTimePicker_Exists("Bundle_ContributionDate"); Open($"{rootUrl}Person2/{user.PeopleId}"); Wait(10); WaitForElement(css: ".edit-basic"); WaitForElementToDisappear(loadingUI); Find(css: ".edit-basic").Click(); Wait(5); ScrollTo(id: "WeddingDate"); Check_If_DateTimePicker_Exists("WeddingDate"); }
public void linking_document_at_parent_level() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetAbsoluteUrl("FolderTest", "../page"); actual.Should().Be("page"); }
public void Create_Role_Test() { username = RandomString(); password = RandomString(); string roleName = "role_" + RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin" }); Login(); Open($"{rootUrl}Lookups/"); PageSource.ShouldContain("Lookup Codes"); Find(text: "Roles").Click(); CurrentUrl.ShouldBe($"{rootUrl}Roles"); RepeatUntil(() => Find(css: ".box-tools button[type=submit]")?.Click(), condition: () => Find(id: "RoleName.NEW") != null); var newRole = Find(id: "RoleName.NEW"); ScrollTo(newRole); RepeatUntil(() => newRole.Click(), condition: () => Find(css: ".editable-input input[type=text]") != null); Find(css: ".editable-input input[type=text]").Clear(); Find(css: ".editable-input input[type=text]").SendKeys(roleName); Find(css: ".editable-buttons button[type=submit]").Click(); Wait(2); var adminRole = db.Roles.SingleOrDefault(r => r.RoleName == "Admin"); var role = db.Roles.SingleOrDefault(r => r.RoleName == roleName); role.ShouldNotBeNull(); role.Priority.GetValueOrDefault().ShouldBeGreaterThan(adminRole.Priority.GetValueOrDefault()); }
public void getting_root_should_give_us_the_index_document_from_the_root() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetContent("/"); actual.Should().Be("index"); }
public void larger_path() { var sut = new PageSource("/trafikinfo/Intranet/doc/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetContent("/FolderTest/"); actual.Should().Be("indexfolder"); }
public void folerName_should_give_us_the_index_document_in_that_folder() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetContent("FolderTest"); actual.Should().Be("indexfolder"); }
public void drop_root_url_from_url() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetContent("/intranet/"); actual.Should().Be("index"); }
public void Should_Show_Closed_Funds() { var fund = new ContributionFund { FundId = RandomNumber(500, 1000), CreatedBy = 1, CreatedDate = DateTime.Now, FundName = RandomString(), FundStatusId = 2, FundTypeId = 1, FundPledgeFlag = false }; db.ContributionFunds.InsertOnSubmit(fund); db.SubmitChanges(); username = RandomString(); password = RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin", "Finance" }); Login(); Open($"{rootUrl}Funds/"); Find(xpath: "//a[contains(@href, '/Funds?status=2')]").Click(); PageSource.ShouldContain(fund.FundName); db.ContributionFunds.DeleteOnSubmit(fund); db.SubmitChanges(); }
public ParsePage VerifyRobotsPresentWithIndexFollow() { PageSource.ShouldContain("meta name=\"robots\" content=\"index, follow\""); //RB: there is an issue with lower case, to be consistent it should be <meta name="robots" content="INDEX, FOLLOW" /> PageSource.ShouldNotContain("meta name=\"robots\" content=\"NOINDEX, NOFOLLOW\""); PageSource.ShouldNotContain("meta name=\"robots\" content=\"NOINDEX, FOLLOW\""); PageSource.ShouldNotContain("meta name=\"robots\" content=\"INDEX, NOFOLLOW\""); return(this); }
public void PyscriptWithParameters() { LoginAsAdmin(); db.WriteContentPython("HelloWorld", "print 'parameters {} {}'.format(Data.p1, Data.p2)"); Open($"{rootUrl}PyScript/HelloWorld/testing/123"); PageSource.ShouldContain("parameters testing 123"); Open($"{rootUrl}PyScript/HelloWorld?p1=testing&p2=123"); PageSource.ShouldContain("parameters testing 123"); }
public void MyData_User_Logon_Fail_Test() { username = RandomString(); password = RandomString(); var user = CreateUser(); Login(withPassword: "******"); PageSource.ShouldContain("Logon Error!"); }
public void DbInQueryModelShouldBeInstantiatedByModelBinding() { username = RandomString(); password = RandomString(); CreateUser(username, password, roles: new[] { "Access", "Edit", "Admin" }); Login(); Open($"{rootUrl}QueryCode?code=Age>65"); WaitForElement("input[id=totcnt]"); PageSource.ShouldContain("David Carroll"); }
static void Main(string[] args) { Console.WriteLine("Hello World!"); var page = PageSource.For <CauseOfLossPage>(); var element = page.Element1; }
public void NodeToTreeTest( [PexAssumeUnderTest] PageSource target, XmlNode node, string indent, bool last ) { target.NodeToTree(node, indent, last); // TODO: add assertions to method PageSourceTest.NodeToTreeTest(PageSource, XmlNode, String, Boolean) }
public ParsePage VerifyCanonicalPresent() { if (Url.Contains("?")) { var cutUrl = Url.Split('?'); Url = cutUrl[0]; PageSource.ShouldContain("link rel=\"canonical\" href=\"" + Url + "\""); //RB: Checking Canonical link } return(this); }
public ParsePage VerifyURLWithQuerySuburbCanonical() { if (Url.Contains("?")) { var cutUrl = Url.Replace("?suburb=", "").Trim(); Url = cutUrl; PageSource.ShouldContain("link rel=\"canonical\" href=\"" + Url + "\""); //RB: Checking Canonical link } return(this); }
public void MyData_User_Logon_Success_Test() { username = RandomString(); password = RandomString(); var user = CreateUser(); Login(); PageSource.ShouldContain(user.Person.Name); PageSource.ShouldContain(user.Person.EmailAddress); }
/// <summary> /// * This method will check for Sold, Sale, Rent /// and any URLwithout a query type('?' +query type): /// - If the canonical link is present /// - If the meta robots tag /// < NOINDEX, NOFOLLOW> /// is present /// - If the link for next page is present and in a correct format /// * Any pages which contains an URLs with a query type have to contain /// the meta robots tag /// < NOINDEX, FOLLOW> /// . /// * For any Share listings, the method will *not* check /// if the next link is present /// </summary> /// <param name="mode"></param> public ParsePage VerifyPageSource(ListingType mode) { if (mode != ListingType.Share) { if (Url.Contains("?")) { var cutUrl = Url.Split('?'); Url = cutUrl[0]; VerifyCanonicalPresent(); VerifyRobotsPresentWithNoIndexFollow(); PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?page=2\""); } else { if (Url.Contains("auction")) { Url = Url.Replace("http", "https"); VerifyCanonicalPresent(); VerifyRobotsNotPresent(); } else { VerifyCanonicalPresent(); if (Url.Contains("sold")) { VerifyRobotsPresentWithNoIndexFollow(); } else { VerifyRobotsNotPresent(); } PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?page=2\""); //RB: Checking next link } } } else { if (Url.Contains("?")) { var cutUrl = Url.Split('?'); Url = cutUrl[0]; VerifyCanonicalPresent(); VerifyRobotsPresentWithNoIndexFollow(); } else { VerifyCanonicalPresent(); VerifyRobotsNotPresent(); } } return(this); }
public void Column_Number_Out_Of_Range_Should_Show_Error() { CMSDataContext db = CMSDataContext.Create(DatabaseFixture.Host); var requestManager = FakeRequestManager.Create(); var controller = new CmsWeb.Areas.OnlineReg.Controllers.OnlineRegController(requestManager); var routeDataValues = new Dictionary <string, string> { { "controller", "OnlineReg" } }; controller.ControllerContext = ControllerTestUtils.FakeControllerContext(controller, routeDataValues); var FakeOrg = FakeOrganizationUtils.MakeFakeOrganization(requestManager, new CmsData.Organization() { OrganizationName = "MockName", RegistrationTitle = "MockTitle", Location = "MockLocation", RegistrationTypeId = RegistrationTypeCode.JoinOrganization }); OrgId = FakeOrg.org.OrganizationId; username = RandomString(); password = RandomString(); var user = CreateUser(username, password, roles: new string[] { "Edit", "Access" }); Login(); Wait(3); Open($"{rootUrl}Org/{OrgId}#tab-Registrations-tab"); WaitForElementToDisappear(loadingUI); Find(css: "#Questions-tab > .ajax").Click(); WaitForElementToDisappear(loadingUI); Find(css: ".row:nth-child(1) > .col-sm-12 .edit").Click(); WaitForElementToDisappear(loadingUI); Find(text: "Add Question").Click(); Wait(2); Find(text: "Checkboxes").Click(); Wait(2); Find(text: "Done").Click(); Wait(2); Find(css: ".confirm").Click(); Wait(2); Find(xpath: "//div[4]/div/div/input").SendKeys("5"); Find(text: "Save").Click(); Wait(2); PageSource.ShouldContain("The field Columns must be between 0 and 4."); }
public void Page_NotFound_Test() { username = RandomString(); password = RandomString(); var user = CreateUser(); Login(); Open($"{rootUrl}Invalid"); PageSource.ShouldContain("Not Found"); }
public void Page_NotAuthorized_Test() { username = RandomString(); password = RandomString(); var user = CreateUser(); Login(); Open($"{rootUrl}Bundles"); PageSource.ShouldContain("Sign In"); }
public void Should_Display_No_CheckIn_Times() { username = RandomString(); password = RandomString(); string roleName = "role_" + RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin" }); Login(); Open($"{rootUrl}CheckinTimes/"); PageSource.ShouldContain("no checkin times available"); }
public void Page_NotFound_Test() { username = RandomString(); password = RandomString(); var user = CreateUser(); Login(); Open($"{rootUrl}Invalid"); WaitForPageLoad(); PageSource.ShouldMatch("cannot be found|Not Found"); }
public ParsePage VerifyPropertyProfileForSold(string mode, string address) { var propertyProfileUrl = ConfigurationHelper.DomainWebServer + "/property-profile/" + address + "-" + Regex.Match(Url, @"\d+").Value; if (mode == "Sold") { PageSource.ShouldContain(propertyProfileUrl); } else { PageSource.ShouldNotContain(propertyProfileUrl); } return(this); }
//public void CloseWalkMeDialogIfPresent() //{ // //Force Sleep statement due to Load Time of WalkMe Links // Thread.Sleep(5000); // List<IWebElement> closeWalkMeLinks = new List<IWebElement>(); // closeWalkMeLinks.AddRange(driver.FindElements(By.CssSelector(".walkme-action-close"))); // if (closeWalkMeLinks.Count > 0) { closeWalkMeLinks[0].Click(); } //} //testing local run public void EvaluateScreenshotSourcePageSaving() { if (TestContext.CurrentContext.Result.Outcome.Status != ResultState.Success.Status) { string testName = TestContext.CurrentContext.Test.MethodName + "_"; if (Convert.ToBoolean(ConfigurationManager.AppSettings.Get("ScreenOnFail?"))) { PageScreenshot.Take(driver, testName); } if (Convert.ToBoolean(ConfigurationManager.AppSettings.Get("SourceOnFail?"))) { PageSource.Save(driver, testName); } } }
// Get Google Results internal static async Task <List <Result> > GetGoogleResults(IWebDriver web, string searchPattern) { long GetLong(Task <PageSource> task1) { return(Convert.ToInt64(Convert .ToString(Regex.Match(Convert.ToString(Regex.Match(task1.Result.Source, GoogleRegExResultsA).Groups[0]), GoogleRegExResultsB).Groups[0] ).Replace(",", ""))); } List <Result> results = new List <Result>(); long lastResult = 0; Retry: var task = GetUrlSourceCode(web, SearchEngines.Google, string.Format(GoogleQuery, searchPattern), searchPattern, LastPageSource?.SpellOrig == null); await task; LastPageSource = task.Result; long result; try { result = GetLong(task); } catch { result = 0; } var spelledWord = task.Result.SpellOrig?.Text; results.Add(string.IsNullOrEmpty(spelledWord) ? new Result(searchPattern, result) : new Result(searchPattern, lastResult, spelledWord, result)); task.Result.SpellOrig?.Click(); if (task.Result.SpellOrig == null) { return(results); } searchPattern = spelledWord; lastResult = result; goto Retry; }
/// <summary> /// * This method will check for any URLs without a query type('?' +query type): /// - If the canonical link is present /// - If the meta robots tag /// < NOINDEX, NOFOLLOW> /// is present /// - If the link for next page is present and in a correct format /// * Any pages which contains an URLs with a query type have to contain /// the meta robots tag /// < NOINDEX, FOLLOW> /// . /// * For any Share listings, the method will *not* check /// if the next link is present /// </summary> public ParsePage VerifyHomeBuy() { if (Url.Contains("?")) { VerifyRobotsPresentWithNoIndexFollow(); VerifyCanonicalPresent(); PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?page=2\""); } else { VerifyRobotsNotPresent(); VerifyCanonicalPresent(); PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?page=2\""); //RB: Checking next link } return(this); }
public void MyData_User_ForgotPassword_Test() { username = RandomString(); password = RandomString(); var newPassword = RandomString() + "1!"; var user = CreateUser(); Open(rootUrl); WaitForElement("#inputEmail", 30); Find(text: "Forgot?").Click(); CurrentUrl.ShouldBe($"{rootUrl}Account/ForgotPassword"); var input = "[name=UsernameOrEmail]"; var button = "input[type=submit]"; RepeatUntil(() => { Find(css: input)?.SendKeys(username); Find(css: button)?.Click(); }, () => PageSource.Contains("Password Sent")); db.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, user); user.ResetPasswordCode.ShouldNotBeNull(); Open($"{rootUrl}Account/SetPassword/{user.ResetPasswordCode}"); PageSource.ShouldContain("Confirm Password Reset"); Find(css: "button[type=submit]").Click(); CurrentUrl.ShouldBe($"{rootUrl}Account/SetPasswordConfirm"); RepeatUntil(() => { Find(id: "newPassword").SendKeys(newPassword); Find(id: "confirmPassword").SendKeys(newPassword); Find(css: button).Click(); }, () => PageSource.Contains("Password Changed")); Find(text: "Return to Home").Click(); WaitForPageLoad(); Logout(); Login(withPassword: newPassword); PageSource.ShouldContain(user.Person.Name); PageSource.ShouldContain(user.Person.EmailAddress); }
public override void UpdateCurrentPageSource(PageSource pageSource) { PreviousePageSource = CurrentPageSource; CurrentPageSource = pageSource; switch (pageSource) { case PageSource.DAILY_REPORT_DETAIL_PAGE: CurrentPageOV.PageUri = DailyReportDetailPage.Value.PageUri; CurrentPageOV.LoadingDelayTime = DailyReportDetailPage.Value.LoadingDelayTime; break; default: CurrentPageOV.PageUri = NonePage.Value.PageUri; CurrentPageOV.LoadingDelayTime = NonePage.Value.LoadingDelayTime; break; } NotifyChange(CurrentPageOV); }
public void Should_Change_Years_In_Graph() { username = RandomString(); password = RandomString(); string roleName = "role_" + RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin" }); Login(); List <int?> Years = CMSDataContext.Create(Util.Host).Contributions .Where(x => (x.ContributionDate.HasValue ? ((DateTime)x.ContributionDate).Year : (int?)null) < DateTime.Now.Year) .ToList() .Select(x => x.ContributionDate.HasValue ? ((DateTime)x.ContributionDate).Year : (int?)null) .Distinct() .OrderByDescending(x => x) .ToList(); string YearToTest; if (Years.Count == 0) { YearToTest = DateTime.Now.Year.ToString(); } else { YearToTest = Years[RandomNumber(0, Years.Count - 1)].ToString(); } Open($"{rootUrl}Figures/Figures/Index"); MaximizeWindow(); WaitForElement("div:nth-child(1) > .btn", 5); Find(css: "div:nth-child(1) > .btn").Click(); WaitForElement("#year", 5); var YearDropdown = Find(id: "year"); YearDropdown.SendKeys(YearToTest); RepeatUntil(() => Find(id: "DrawChart").Click(), condition: () => Find(css: "#Fund_chart_display svg > g:nth-child(5)") != null); PageSource.ShouldContain(YearToTest); }
public void Should_Show_Pledge_Giving_Tab() { SettingUtils.UpdateSetting("CombinedGivingSummary", "false"); username = RandomString(); password = RandomString(); var user = CreateUser(username, password); Login(); Open($"{rootUrl}Person2/{user.PeopleId}"); WaitForElement(".active:nth-child(2) > a", 10); PageSource.ShouldContain("<a href=\"#giving\" aria-controls=\"giving\" data-toggle=\"tab\">Giving</a>"); Find(text: "Giving").Click(); WaitForElement("#giving", 10); PageSource.ShouldContain("Contributions"); PageSource.ShouldContain("Pledges"); }
public void Should_Show_Error_Message_For_Ask_Tickets() { MaximizeWindow(); username = RandomString(); password = RandomString(); string roleName = "role_" + RandomString(); var user = CreateUser(username, password, roles: new string[] { "Access", "Edit", "Admin" }); FinanceTestUtils.CreateMockPaymentProcessor(db, PaymentProcessTypes.OnlineRegistration, GatewayTypes.Transnational); Login(); OrgId = CreateOrgWithFee(); Open($"{rootUrl}Org/{OrgId}#tab-Registrations-tab"); Find(xpath: "//li[@id='Questions-tab']/a").Click(); Wait(2); Find(xpath: "(//a[contains(text(),'Edit')])[10]").Click(); Wait(2); Find(xpath: "//a[contains(text(),'Add Question')]").Click(); Wait(1); Find(xpath: "//a[@type='AskTickets']").Click(); Wait(2); Find(xpath: "//a[contains(text(),'Done')]").Click(); Wait(2); Find(xpath: "//button[contains(.,'Yes, Add Questions')]").Click(); Wait(1); Find(xpath: "//a[@onclick='saveQuestion();']").Click(); Wait(2); Open($"{rootUrl}OnlineReg/{OrgId}"); Find(id: "List_0__ntickets").SendKeys("two"); Find(id: "otheredit").Click(); Wait(1); PageSource.ShouldContain("Please enter a positive numeric value"); }
//public ParsePage VerifyPageSourceNewHomes() //{ // Url = _baseUri + "search/newdev/property/types/new-home-designs/state/nsw/"; // VerifyNoIndexNoFollow(); // PageSource.ShouldContain("<link rel=\"next\" href=\"" + Url + "?mode=newdev&page=2\""); // //RB: Checking next link // return this; //} public ParsePage VerifyPageSourceNoNext() { if (Url.Contains("?") && !Url.Contains("displaymap")) { var cutUrl = Url.Split('?'); Url = cutUrl[0]; VerifyRobotsPresentWithNoIndexFollow(); VerifyCanonicalNotPresent(); } else if (Url.Contains("displaymap")) { PageSource.ShouldContain("meta name=\"robots\" content=\"NOINDEX, NOFOLLOW\""); VerifyCanonicalPresent(); //RB: In case of Map search } else { VerifyCanonicalPresent(); VerifyRobotsPresentWithNoIndexNoFollow(); } return(this); }
public void two_documents_on_the_same_level() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetAbsoluteUrl("withlink", "page"); actual.Should().Be("page"); }
public void linking_image_from_sibling_folder() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetAbsoluteUrl("FolderTest", "../NoDoc/image.png"); actual.Should().Be("NoDoc/image.png"); }
public void linking_root_should_work_from_sub_folder() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetAbsoluteUrl("FolderTest", ".."); actual.Should().Be("/"); }
public void linking_sub_image_from_root_level() { var sut = new PageSource("/intranet/", Environment.CurrentDirectory + "\\TestDocs\\"); var actual = sut.GetAbsoluteUrl("", "NoDoc/image.png"); actual.Should().Be("NoDoc/image.png"); }