Skip to content

luiz158/blogwatch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Blog Watch

This project contains UI tests for baeldung.com

Overview

The project uses Selenium framework, Crawler4J and REST Assured for UI tests . The tests can be run in GUI or headless mode. UI browser has been configured with Firefox using gecodriver and tested with Firefox 56.0 (64 bit) on Windows. Headless mode works with PhantomJS and HtmlUnit browsers.

Running Tests from the IDE

The default configuration executes tests with headless mode in windows environment and target URL is https://www.baeldung.com. The configuration can be changed using following properties:

  • spring.profiles.active - environment variable to either "headless-browser" and "ui-browser"
  • target.env - environment variable should be set to "win" or "linux" for headless browser
  • base.url - to target base URL, for example http://www.baeldung.com

These can be set as environment variables via the Eclipse run configuration.

Running Tests Using Maven

Three Maven profiles are available for running tests:

  • headless-browser-windows
  • headless-browser-linux
  • ui-brower-windows

The target URL for all profiles is https://www.baeldung.com. The can be changed using following property

Headless Browser selection

Available headless browsers

  • PhantomJS (default)
  • HtmlUnit

Headless browser can be configured using following system property

  • headless.browser.name

Updating List of Posts and Pages

Run UpdateArticlesAndPagesLinks#updateLinks test for updataing list of articles and pages.

JUnit Tags

Following tags are available for running tests selectively. Refer Java docs in GlobalConstants.java for details

  • hourly
  • daily
  • weekly
  • editorial
  • github-related
  • technical

Excluding a URL for tests running in the bi-monthly bild

URLs can be added to the follwoing file to skip a specific test from the bi-monthly build - https://github.com/eugenp/blogwatch/blob/master/src/main/resources/exceptions-for-tests-hitting-all-urls.yaml

Launch Mode

Set environment variable "LAUNCH_FLAG" to either true or false to set launch mode. Default is false

On Jenkins

The tests are running here, on Jenkins

Tests

The tests which are crossed out are disabled.

Sr. Test Name
2 givenOnTheHomePage_whenPageLoads_thenJavaWeeklyLinksMatchWithTheLinkText

daily

Verifies that the Java weekly issue links in the homepage point to correct URLs
3 givenOnTheHomePage_whenPageLoads_thenItContainsCategoriesInTheFooterMenu

daily

Verifies that the CATEGORY menu is available in the homepage footer
4 givenOnTheHomePageUrlWithoutWWWPrefix_whenUrlIsHit_thenItRedirectsToWWW

daily

If we hit http://baeldung.com, it should redirect to http://www.baeldung.com
5 givenOnTheHomePage_whenHomePageLoaded_thenNoSevereMessagesInBrowserLog

daily

This test looks for JS error in the browser console falling in server category
6 givenOnTheMicroservicesGuidePage_whenOptinPopupIsLoaded_thenItContainsImages

daily

This test verifies that the images are displayed properly on Download Guide popup in following URL - http://www.baeldung.com/spring-microservices-guide
7 givenArticleWithPopup_whenPopupOpens_thenPopupHasCloseButton

daily

This test checks that the pop-up, the one which auto lods, has close button on the following page - http://www.baeldung.com/rest-with-spring-series/
8 givenTheArticleWithSeries_whenArticleLoads_thenPluginLoadsProperly

daily

Verifies the series plugin on the following page - http://www.baeldung.com/spring-security-registration
9 givenTheArticleWithPersistenceEBookDownload_whenPageLoads_thenFooterImageIsDisplayed

daily

This test checks that the image is displayed properly in the EBook download widget available at the end of following page - http://www.baeldung.com/hibernate-spatial
10 givenTheArticleWithGoogleAnalytics_whenArticleLoads_thenArticleHasAnalyticsCode

daily

This test looks for the Google Analytics code in the following post - http://www.baeldung.com/persistence-layer-with-spring-and-hibernate
11 givenThePageWithGoogleAnalytics_whenPageLoads_thenPageHasAnalyticsCode

daily

This test looks for the Google Analytics code in the following page - http://www.baeldung.com/rest-with-spring-course
12 givenBaeldungFeedUrl_whenUrlIsHit_thenItRedirectsToFeedburner

daily

Baeldung feed URL - http://www.baeldung.com/feed/ should redirect to http://feeds.feedburner.com/Baeldung
13 givenTheCategoryPage_whenPageLoads_thenItContainsNoindexRobotsMeta

daily

For testing that the category pages should have a robots meta tag with noindex. Following URL is tested - http://www.baeldung.com/category/series/
14 givenThePagesWithBlankTitle_whenPageLoads_thenItDoesNotContainNotitleText

daily

This test verifies that the pages which have no title set do not show invalid title - No Title. The test runs against a list of following five pages. http://www.baeldung.com/java-weekly-sponsorship/ , http://www.baeldung.com/webinar-rest-with-spring-thank-you , http://www.baeldung.com/webinar-api-security-thank-you , http://www.baeldung.com/webinar-api-discoverability-thank-you , http://www.baeldung.com/webinar-cqrs-thank-you
15 givenTheTagArticle_whenArticleLoads_thenItContainsNoindexRobotsMeta

daily

Verifies that the tag pages should have a robots meta tag with noindex. Following URL is tested - http://www.baeldung.com/tag/activiti/
16 givenOnTheHomePage_whenPageLoads_thenItHasOneAboutMenuInTheFooter

daily

The test verifies that exactly one ABOUT menu is available in the footer of Homepage
17 givenOnTheCoursePage_whenPageLoads_thenTrackingIsSetupCorrectly

daily

Verifies tracking on the course pages. Tracking details are here - https://github.com/eugenp/blogwatch/blob/master/src/main/resources/blog-url-list/coursePagesBuyLinks.json
18 givenAllURLs_whenURlLoads_thenItReturns200OK

weekly

Loops over full list of posts & pages, and verifies that 200OK is returned
19 givenAllArticles_whenAnArticleLoads_thenItHasSingleShortcodeAtTheTop

twice-a-month

Technical

This Test verifies that a single short code is available at the start of every post
20 givenAllArticles_whenAnArticleLoads_thenItHasSingleShortcodeAtTheEnd

twice-a-month

Technical

Test verifies that a single short code is available at the start of every page
21 givenAllArticles_whenAnArticleLoads_thenArticleHasNoEmptyDiv

twice-a-month

Technical

This test loops over all the articles and looks for empty div in code samples.
22 givenAllArticles_whenAnArticleLoads_thenImagesPointToCorrectEnv

twice-a-month

Technical

Verifies that the images in the posts point to live env
23 givenAllPages_whenAPageLoads_thenImagesPointToCorrectEnv

twice-a-month

Technical

Verifies that the images in the pages point to live env
24 givenAllArticles_whenAnArticleLoads_thenTheMetaDescriptionExists

twice-a-month

Editorial

This test verifies that all posts have meta description defined
25 givenAllPages_whenAPageLoads_thenTheMetaDescriptionExists

twice-a-month

Editorial

This test verifies that all pages have meta description defined
26 givenArticlesWithALinkToTheGitHubModule_whenTheArticleLoads_thenTheGitHubModuleLinksBackToTheArticle

twice-a-month

GitHub Related

Almost every post has a link to GitHub module containing the working code. The test verifies that the linked GitHub module links back to the post. The test looks for a back-link in the, 1- URL linked from the Article 2- Master module (immediate child of /master) 3- Immediate parent of initial(1st) URL, 4- Immediate child of main repository (/eugenp or /Baeldung)
27 givenAllArticles_whenAnArticleLoads_thenTheAuthorIsNotFromTheExcludedList

twice-a-month

Editorial

Loops over all the post and verifies that the author is not from the restricted list. Here is excluded list - https://github.com/eugenp/blogwatch/blob/73b841bedeee0803cc7ee0ae0c28d0d70161805b/src/main/resources/blog.properties#L14
28 givenAnArticleWithTheDripScript_whenTheArticleLoads_thenTheArticleHasTheDripScrip

daily

Verifies the Drip script on https://www.baeldung.com/spring-cache-tutorial
29 givenAPageWithTheDripScript_whenThePageLoads_thenThePageHasTheDripScrip

daily

Verifies the Drip script on https://baeldung.com/spring-tutorial
30 givenOnTheCoursePage_whenThePageLoads_thenAGeoIPApiProviderWorks

daily

This test loads http://baeldung.com/learn-spring-security-course/ and verifies that any of the following messages is logged in the browser console:
VAT Calc Notice: geoIP API provider is set to ipdata
VAT Calc Notice: geoIP API provider is set to ipinfo.io
VAT Calc Notice: geoIP API provider is set to ipapi.com
31 givenOnTheCoursePage_whenThePageLoadsInEUCountry_thenTheVATPricesAreShown

daily

This test loads http://baeldung.com/learn-spring-security-course/ with EU proxy and verifies that VAT prices are available. The test run on HtmlUnit browser
32 givenTheGitHubModuleReadme_theArticlesLinkedInTheGitHubMouduleLinkForwardTotheSameGitHubModule

twice-a-month

GitHub Related

This test verifies that articles linked in GitHub READMEs link forward to the same GitHub module.
The test also documents no of articles linked from READMEs.
As of now, the test scans only tutorials (https://github.com/eugenp/tutorials) repo.
33 givenTheGitHubModule_theModuleHasANonEmptyReadme

twice-a-month

GitHub Related

This test verifies that GitHub modules have non empty README. A README not linking to an article is also considered empty. As of now, the test scans only tutorials(https://github.com/eugenp/tutorials) repo.
34 givenAllArticles_whenAnArticleLoads_thenMetaOGImageAndTwitterImagePointToTheAbsolutePath

twice-a-month

Technical

This test verifies that image links in the og:image and twitter:image parameters are absolute. The rest runs on all the posts
35 givenAllPages_whenAPageLoads_thenMetaOGImageAndTwitterImagePointToTheAbsolutePath

twice-a-month

Technical

This test verifies that image links in the og:image and twitter:image parameters are absolute. The test runs on all the pages
36 givenOnTheBaeldungRSSFeed_whenTheFirstUrlIsHit_thenItPointsToTheBaeldungSite

daily

This test verifies that the first link in the Baeldung RSS feed ( https://www.baeldung.com/rss/ ) points to the www.baeldung.com
37 givenOnCoursePages_whenAPageLoads_thenItContainsImportantAnchors

daily

This test verifies that the LSS and RWS course pages contain following anchors:
#table
#master-class
#certification-class
38 givenAllArticles_whenAnArticleLoads_thenTheArticleDoesNotCotainWrongQuotations

twice-a-month

Editorial

This test verifies that the articles does not contain ”> or ”"> characters
39 givenAllTheArticles_whenAnArticleLoads_thenJavaClassesAndMethodsCanBeFoundOnGitHub

on-demand

This test verifies that the Java Classs, Interfaces and Methods match with the code on the GitHub. Job link: http://jenkins.baeldung.com/job/sites-monitor/job/site-watch/job/blogwatch-test-article-code-matches-github/
40 givenAllArticles_whenAnArticleLoads_thenTheArticleHasProperTitleCapitalization

twice-a-month

Editorial

This test verifies that first character of every word in titles has capital case.
41 givenTheBaeldungMediaKitURL_whenPageLoads_thenItReturns200OK

daily

This test verifies that Baeldung Media Kit URL returns 200OK. Media Kit URL - https://s3.amazonaws.com/baeldung.com/Baeldung+-+Media+Kit.pdf
42 givenAllArticles_whenAnalyzingCategories_thenTheArticleDoesNotContainUnnecessaryCategory

twice-a-month

Editorial

This test reports posts having Spring as well as one or more of following labels:
Spring Security
SpringBoot
Spring Cloud
Spring Web
Spring MVC
44 givenAllArticles_whenAnalyzingCodeBlocks_thenCodeBlocksAreRenderedProperly

twice-a-month

Technical

This test looks for <pre> tags having brush css class. These tags could be found in the page if code blocks are not rendered properly.
45 givenArticlesWithALinkToTheGitHubModule_whenTheArticleLoads_thenTheArticleTitleAndGitHubLinkMatch

twice-a-month

GitHub Related

This test verified that Article Title match with the link given in the GitHub Module.
46 givenAllArticles_whenAnalyzingCodeBlocks_thenCodeBlocksAreRenderedProperly

twice-a-month

Technical

This test verifies that all GitHub links in articles return 200OK
47 givenAllArticles_whenAnArticleLoads_thenItDoesNotContainOverlappingText

twice-a-month

Technical

The test looks for overlapping text in the all posts
48 givenAllPages_whenAPageLoads_thenItDoesNotContainOverlappingText

twice-a-month

Technical

The test looks for overlapping text in the all pages
49 givenTheBaeldungRSSFeed_whenAnalysingFeed_thenItIsUptoDate

daily

Technical

The test loads https://www.baeldung.com/rss, and verifies that the RSS feed is up to date.
50 givenURLsWithAnchorsLinkingWithinSamePage_whenAnaysingPage_thenAnHtmlElementExistsForEachAnchor

daily

This test verifies that page has HTHML elements corresponding to anchors linking within same page. The test reads test data from https://github.com/eugenp/blogwatch/blob/master/src/main/resources/data-for-anchor-test.json
51 givenTheContactForm_whenAMessageIsSubmitted_thenItIsSentSuccessfully

daily

This test verifies that contact form works fine. The test runs on HtmlUnit browser.

Releases

No releases published

Packages

No packages published

Languages