public void AutomateThePlanet() { _automateThePanetHomePage = new Pages.AutomateThePlanet.HomePage(Driver); _blogPage = new BlogPage(_driver); _articlePage = new ArticlePage(_driver); _driver.Url = "https://www.automatetheplanet.com/"; _automateThePanetHomePage.BlogButton.Click(); _blogPage.Articles[5].Click(); for (int i = 0; i < _articlePage.NavigationMainTitles.Count; i++) { Thread.Sleep(1000); //ama to pak ne znam dali stana,maj ne _articlePage.ScrollTo(_articlePage.QickNavigaion); _articlePage.Scroll(200); //scroll-нахме 200 пиксела нагоре, за да може да стигнем до главните в навигейшъна var text = _articlePage.NavigationMainTitles[i].Text; //ama tochno tuk li trqbwa da e.... _articlePage.NavigationMainTitles[i].Click(); Assert.IsTrue(_articlePage.MainHeader[i].Displayed); } var navigationTitles = _articlePage.NavigationMainTitles.Select(e => e.Text).ToList(); //взимаме текста на вс елементи вътре в колекциите (от менюто и от текста в таговете). Като вземем тези елементи ще ги сравним var titles = _articlePage.MainHeader.Select(e => e.Text).ToList(); CollectionAssert.AreEqual(navigationTitles, titles); var navigationSecondaryTitles = _articlePage.NavigationSecondaryTitles.Select(e => e.Text).ToList(); var secondaryTitles = _articlePage.SecondaryHeader.Select(e => e.Text).ToList(); CollectionAssert.AreEqual(navigationSecondaryTitles, secondaryTitles); }
public void OpenBlog_VerifyQuickNavigationTextsAreSameAsArticlesNames(int position) { //Arrange BlogPage blogPage = PageFactory.Get <BlogPage>(); ATPMainPage mainPage = PageFactory.Get <ATPMainPage>(); BlogSectionPage blogSectionPage = PageFactory.Get <BlogSectionPage>(); mainPage.Load(); mainPage.OpenBlogSection(); blogSectionPage.OpenBlog(position); //Act foreach (IWebElement navigation in blogPage.QuickNavigations) { blogPage.ScrollTo(navigation); string navigationHref = navigation.GetAttribute("href"); string articleID = navigationHref.Substring(navigationHref.IndexOf('#') + 1); navigation.Click(); IWebElement articleName = blogPage.ElementWith(articleID); //Assert Assert.IsTrue(articleName.Text == navigation.Text); Assert.IsTrue(articleName.Displayed); Assert.IsTrue(hTags.Contains(articleName.TagName)); } }
public async Task OnGetAsync_HasPage() { var fakePage = new BlogPage { Id = Guid.Empty, CreateTimeUtc = new DateTime(996, 9, 6), CssContent = ".jack-ma .heart {color: black !important;}", HideSidebar = false, IsPublished = false, MetaDescription = "F**k Jack Ma", RawHtmlContent = "<p>F**k 996</p>", Slug = "f**k-jack-ma", Title = "F**k Jack Ma 1000 years!", UpdateTimeUtc = new DateTime(1996, 9, 6) }; _mockPageService.Setup(p => p.GetAsync(It.IsAny <Guid>())) .Returns(Task.FromResult(fakePage)); var editPageModel = CreateEditPageModel(); var result = await editPageModel.OnGetAsync(Guid.Empty); Assert.IsInstanceOf <PageResult>(result); Assert.IsNotNull(editPageModel.PageEditModel); }
protected override void Init() { using (var api = new Api(GetDb(), new ContentServiceFactory(services), storage)) { // Initialize Piranha.App.Init(); var pageTypeBuilder = new PageTypeBuilder(api) .AddType(typeof(BlogPage)); pageTypeBuilder.Build(); // Add site var site = new Data.Site() { Id = SITE_ID, Title = "Hook Site", IsDefault = true }; api.Sites.Save(site); // Add blog page var page = BlogPage.Create(api); page.Id = BLOG_ID; page.SiteId = SITE_ID; page.Title = "Hook Blog"; api.Pages.Save(page); // Add category api.Categories.Save(new Data.Category() { Id = ID, BlogId = BLOG_ID, Title = "Hook Category" }); } }
public async Task <ActionResult> ListNews(int?idBlog, int?idNews, int?v) { ViewBag.Listar = v; ViewBag.Blog = idBlog; if (idBlog != null) { BlogPage blogPage = await db.BlogPages.FindAsync(idBlog); if (blogPage != null) { ViewBag.BlogPage = blogPage.BlogPageCustomValue; return(View(blogPage.News)); } } if (idNews != null) { NewsPage newsPage = await db.NewsPages.FindAsync(idNews); if (newsPage != null) { BlogPage blogPage = await db.BlogPages.FindAsync(newsPage.BlogPageId); if (blogPage != null) { ViewBag.BlogPage = blogPage.BlogPageCustomValue; return(View(blogPage.News)); } } } return(RedirectToAction("NotFound", "Error")); }
public void FillEditPostForm(BlogPage user) { this.Title.Click(); this.EditButton.Click(); Type(this.TitleToEdit, user.Title); Type(this.ContentToEdit, user.Content); this.EditButtonPost.Click(); }
public void Setup() { Initialize("https://www.automatetheplanet.com/"); _homePage = new Pages.HomePage(_driver); _automateThePlanetPage = new SeleniumTasks1.Pages.AutomateThePlanet.HomePage(_driver); _blogpage = new BlogPage(_driver); _articlePage = new ArticlePage(_driver); }
public void ScrollToQuickNavigation() { var blogPage = new BlogPage(driver); blogPage.NavigateTo(); blogPage.GoToBlog(); blogPage.ScrollDown(); Assert.IsTrue(blogPage.QuickNavigation.Text.Contains("QUICK NAVIGATION")); }
// GET: Show public ActionResult Index(int ID = 1) { var blogPage = db.BlogPages.ToList().Where(bp => (bp.ID == ID)).FirstOrDefault(); if (blogPage == null) { blogPage = new BlogPage(); } return(View(blogPage)); }
public void CheckMainLabelOnBlogNews() { MakeScreenshotWhenFail(() => { Driver.Navigate().GoToUrl("https://doms.by/"); NewsPage nPage = new MainPage(Driver).ClickToNews(); BlogPage sPage = nPage.ClickToBlog(); Assert.AreEqual("Блог", sPage.MainLabelTextField.Text); }); }
public void ValidateTestCaseCodeLink() { var blogPage = new BlogPage(driver); blogPage.NavigateTo(); blogPage.GoToBlog(); blogPage.ScrollDown(); blogPage.ClickFourthLink(); Assert.IsTrue(blogPage.TestCaseCodeHeader.Text.Contains("Test Case")); }
public void ValidateBenchmarkAgainstOtherBrowsersLink() { var blogPage = new BlogPage(driver); blogPage.NavigateTo(); blogPage.GoToBlog(); blogPage.ScrollDown(); blogPage.ClickThirdLink(); Assert.IsTrue(blogPage.BenchmarkAgainstOtherBrowsersHeader.Text.Contains("Benchmark against Other Browsers")); }
public void ValidateHeadlessExecutionFirefoxDriverLink() { var blogPage = new BlogPage(driver); blogPage.NavigateTo(); blogPage.GoToBlog(); blogPage.ScrollDown(); blogPage.ClickSecondLink(); Assert.IsTrue(blogPage.HeadlessExecutionFirefoxDriverHeader.Text.Contains("Headless Execution Firefox Driver")); }
public void ValidateBenchmarkResultsLink() { var blogPage = new BlogPage(driver); blogPage.NavigateTo(); blogPage.GoToBlog(); blogPage.ScrollDown(); blogPage.ClickSeventhLink(); Assert.IsTrue(blogPage.BenchmarkResultsHeader.Text.Contains("Benchmark Results")); }
public void ValidateBenchmarkExecutionTimeLink() { var blogPage = new BlogPage(driver); blogPage.NavigateTo(); blogPage.GoToBlog(); blogPage.ScrollDown(); blogPage.ClickFifthLink(); Assert.IsTrue(blogPage.BenchmarkExecutionTimeHeader.Text.Contains("Benchmark Execution Time")); }
public async Task <IActionResult> OnGetAsync(Guid pageId) { var page = await _mediator.Send(new GetPageByIdQuery(pageId)); if (page is null) { return(NotFound()); } BlogPage = page; return(Page()); }
public void init() { webDriver = new ChromeDriver(ChromeDriverDirectory); webDriver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(5); webDriver.Manage().Window.Maximize(); mainPage = new MainPage(webDriver); blogPage = new BlogPage(webDriver); howWeDoItPage = new HowWeDoItPage(webDriver); contactPage = new ContactPage(webDriver); instagramPage = new InstagramPage(webDriver); }
public async Task <IActionResult> OnGetAsync(Guid pageId) { var page = await _blogPageService.GetAsync(pageId); if (page is null) { return(NotFound()); } BlogPage = page; return(Page()); }
public ActionResult AddNewBlog(FormCollection fc, HttpPostedFileBase image) { if (!CheckLogin()) { return(RedirectToAction("Index", "Home")); } //验证 string title = fc["inputTitle"]; string summary = fc["inputSketch"]; //string imageInput = fc["image"]; string content = fc["inputMD-markdown-doc"]; string imgPath = ""; if (string.IsNullOrEmpty(title) | string.IsNullOrEmpty(summary) | image == null | string.IsNullOrEmpty(content)) { return(View()); } //保存图片 if (image != null && image.ContentLength > 0) { const string fileTypes = "gif,jpg,jpeg,png,bmp"; const int maxSize = 205000; string fileName = Guid.NewGuid().ToString(); imgPath = $"/Images/{fileName}.jpg"; if (image.ContentLength > maxSize) { //超大 return(RedirectToAction("AddNewBlog")); } var fileExt = Path.GetExtension(image.FileName); if (string.IsNullOrEmpty(fileExt) || Array.IndexOf(fileTypes.Split(','), fileExt.Substring(1).ToLower()) == -1) { //扩展名不匹配 return(RedirectToAction("AddNewBlog")); } image.SaveAs(Server.MapPath(imgPath)); } //保存文章 BlogPage bp = new BlogPage { Title = title, Sketch = summary, CreateTime = DateTime.Now, ImagePath = imgPath, Content = content }; db.BlogPages.Add(bp); db.SaveChanges(); return(RedirectToAction("BlogSettings")); }
public async Task <ActionResult> Active(int id) { BlogPage BlogPage = await db.BlogPages.FindAsync(id); if (BlogPage != null) { if (BlogPage.BlogPageActive == "EnEdicion" || BlogPage.BlogPageActive == "Desactivada") { return(View("ActiveConfirmed", BlogPage)); } } return(RedirectToAction("NotFound", "Error")); }
public void Setup() { InitializeMaximizedBrowser(); _homePage = new HomePage(Driver); _blogPage = new BlogPage(Driver); _articlePage = new ArticlePage(Driver); Driver.NavigateTo(_homePage.URL); _homePage.BlogButton.Click(); _blogPage.Articles[0].Click(); Driver.NavigateTo("https://www.automatetheplanet.com/api-usability-part-one/"); }
public IActionResult RebuildBlog(string id, string d, [FromServices] dbContext context) // call using e.g. : /Home/RebuildBlog/blog1?d=portfolio { var pageData = new JsonData(context); pageData.currentHost = HttpContext.Request.Host.Host; pageData.LoadJsonForPage("Index", _appEnvironment.ContentRootPath + "/wwwroot", null, d); BlogPage blogPage = new BlogPage(); blogPage.RebuildBlog(_appEnvironment.ContentRootPath + "/wwwroot", id, pageData.currentSite.siteTag); return(View()); }
private Page ToMetaWeblogPage(BlogPage blogPage) { var mPage = new Page { title = blogPage.Title, description = blogPage.RawHtmlContent, dateCreated = _timeZoneResolver.ToTimeZone(blogPage.CreateTimeUtc), categories = Array.Empty <string>(), page_id = blogPage.Id.ToString(), wp_author_id = _blogConfig.GeneralSettings.OwnerName }; return(mPage); }
public async Task OnGetAsync_NotFound_Unpublished() { var page = new BlogPage { IsPublished = false }; _mockBlogCache.Setup(p => p.GetOrCreate(CacheDivision.Page, FakeData.ShortString2, It.IsAny <Func <ICacheEntry, BlogPage> >())) .Returns(page); var blogPageModel = CreateBlogPageModel(); var result = await blogPageModel.OnGetAsync(FakeData.ShortString2); Assert.IsInstanceOf <NotFoundResult>(result); }
public void OpenDevedPage() { mp_POM = new MainPage(chrome); head_ru_POM = new HeaderCityRu(chrome); cr_POM = new CoursePage(chrome); gr_POM = new GraduatePage(chrome); news_POM = new NewsPage(chrome); blog_POM = new BlogPage(chrome); about_POM = new AboutPage(chrome); contact_POM = new ContactPage(chrome); chrome.Navigate().GoToUrl("https://deveducation.com"); chrome.Manage().Window.Maximize(); chrome.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); }
public void SetUp() { driver = new ChromeDriver(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)); driver.Manage().Window.Maximize(); wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10)); HomePage = new HomePage(driver); RegisterPage = new RegisterPage(driver); LogInPage = new LogInPage(driver); CreatePage = new CreatePage(driver); AccountPage = new AccountPage(driver); PasswordPage = new PasswordPage(driver); BlogPage = new BlogPage(driver); DeletePage = new DeletePage(driver); EditPage = new EditPage(driver); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } BlogPage = await _context.Blogs.FirstOrDefaultAsync(m => m.ID == id); if (BlogPage == null) { return(NotFound()); } return(Page()); }
public void TestInTheCloud() { var homePage = new HomePage(this.driver); this.TestContext.BeginTimer("Automate The Planet Home Page- Navigate"); homePage.Navigate(); this.TestContext.EndTimer("Automate The Planet Home Page- Navigate"); homePage.AssertHeadline(); this.TestContext.BeginTimer("Automate The Planet- Go to Blog"); homePage.GoToBlog(); var blogPage = new BlogPage(this.driver); blogPage.WaitForSubscribeWidget(); this.TestContext.EndTimer("Automate The Planet- Go to Blog"); blogPage.AssertTitle(); }
protected override void Init() { using (var api = new Api(GetDb(), storage, cache)) { Piranha.App.Init(api); var pageTypeBuilder = new PageTypeBuilder(api) .AddType(typeof(BlogPage)); pageTypeBuilder.Build(); // Add site var site = new Data.Site() { Id = SITE_ID, Title = "Category Site", InternalId = "CategorySite", IsDefault = true }; api.Sites.Save(site); // Add blog page var page = BlogPage.Create(api); page.Id = BLOG_ID; page.SiteId = SITE_ID; page.Title = "Blog"; api.Pages.Save(page); // Add categories api.Categories.Save(new Data.Category() { Id = CAT_1_ID, BlogId = BLOG_ID, Title = CAT_1 }); api.Categories.Save(new Data.Category() { BlogId = BLOG_ID, Title = CAT_4 }); api.Categories.Save(new Data.Category() { Id = CAT_5_ID, BlogId = BLOG_ID, Title = CAT_5 }); } }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } BlogPage = await _context.Blogs.FindAsync(id); if (BlogPage != null) { _context.Blogs.Remove(BlogPage); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { BlogPage bp = new BlogPage(); bp.Where.BlogPageID.Value = BlogPageID; if (bp.Query.Load()) { lblName.Text = bp.GetColumn(BlogPage.ColumnNames.Name).ToString(); if (!bp.IsColumnNull(BlogPage.ColumnNames.PageContent)) { divCategoryContent.InnerHtml = Utils.FormatContent(bp.GetColumn(BlogPage.ColumnNames.PageContent).ToString()); } if (bp.IsBlogPage && (!bp.IsColumnNull(BlogPage.ColumnNames.StartTravelDate) || !bp.IsColumnNull(BlogPage.ColumnNames.EndTravelDate))) { lblTravelDate.Visible = true; if (!bp.IsColumnNull(BlogPage.ColumnNames.StartTravelDate)) { lblTravelDate.Text = bp.s_StartTravelDate; } if (!bp.IsColumnNull(BlogPage.ColumnNames.EndTravelDate)) { lblTravelDate.Text += " - " + bp.s_EndTravelDate; } } else { pTravelDate.Visible = false; } if (bp.IsBlogPage) { blogPageTableList.LoadBlogPages(BlogPageID); } else { blogPageTableList.Visible = false; } if (!bp.IsColumnNull(BlogPage.ColumnNames.MainImage) && bp.s_MainImage.Length > 0) { pnlPageTitle.Attributes["style"] = "background-image: url(" + Master.SiteURL + Utils.GaleryImagePath.Replace("~", "") + "/" + bp.MainImage + ");"; } } } }
private void LoadCommonPageData() { Settings s = new Settings(); if (s.LoadByPrimaryKey(1)) { if (IsCountryPage) { Country c = new Country(); if (c.LoadByPrimaryKey(CountryID)) { m_Title = c.GetColumn(Country.ColumnNames.Name).ToString(); if (!s.IsColumnNull(Settings.ColumnNames.TitleSuffix)) { m_Title += " - " + s.GetColumn(Settings.ColumnNames.TitleSuffix).ToString(); } if (!c.IsColumnNull(Country.ColumnNames.Keywords)) { m_Keywords = c.GetColumn(Country.ColumnNames.Keywords).ToString(); } if (!c.IsColumnNull(Country.ColumnNames.Description)) { m_Description = c.GetColumn(Country.ColumnNames.Description).ToString(); } } } else if (IsCityPage) { City c = new City(); if (c.LoadByPrimaryKey(CityID)) { m_Title = c.GetColumn(City.ColumnNames.Name).ToString(); if (!s.IsColumnNull(Settings.ColumnNames.TitleSuffix)) { m_Title += " - " + s.GetColumn(Settings.ColumnNames.TitleSuffix).ToString(); } if (!c.IsColumnNull(City.ColumnNames.Keywords)) { m_Keywords = c.GetColumn(City.ColumnNames.Keywords).ToString(); } if (!c.IsColumnNull(City.ColumnNames.Description)) { m_Description = c.GetColumn(City.ColumnNames.Description).ToString(); } } } else if (IsBlogPagePage) { BlogPage bp = new BlogPage(); if (bp.LoadByPrimaryKey(BlogPageID)) { m_Title = bp.GetColumn(BlogPage.ColumnNames.Name).ToString(); if (!s.IsColumnNull(Settings.ColumnNames.TitleSuffix)) { m_Title += " - " + s.GetColumn(Settings.ColumnNames.TitleSuffix).ToString(); } if (!bp.IsColumnNull(BlogPage.ColumnNames.Keywords)) { m_Keywords = bp.GetColumn(BlogPage.ColumnNames.Keywords).ToString(); } if (!bp.IsColumnNull(BlogPage.ColumnNames.Description)) { m_Description = bp.GetColumn(BlogPage.ColumnNames.Description).ToString(); } } } if (m_Title.TrimEnd().Length == 0 && !s.IsColumnNull(Settings.ColumnNames.Title)) { m_Title = s.GetColumn(Settings.ColumnNames.Title).ToString(); } if (m_Keywords.TrimEnd().Length == 0 && !s.IsColumnNull(Settings.ColumnNames.Keywords)) { m_Keywords = s.GetColumn(Settings.ColumnNames.Keywords).ToString(); } if (m_Description.TrimEnd().Length == 0 && !s.IsColumnNull(Settings.ColumnNames.Description)) { m_Description = s.GetColumn(Settings.ColumnNames.Description).ToString(); } } }