Skip to content

MMonik/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
  • bi-monthly
  • monthly

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
1 givenOnTheJavaWebWeeklyPage_whenSubscriptionPopupLoads_thenItContainsSubscriptionElements

hourly
2 givenOnTheRwSTeamOptInPage_whenTheGetAccessButtonIsClicked_thenTheOptInsPopupsWorkFine

every 30 minutes

This test verifies optin popups in the following article - http://www.baeldung.com/rest-with-spring-for-teams-opt-in
3 givenOnTheHomePage_whenPageLoads_thenJavaWeeklyLinksMatchWithTheLinkText

daily

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

daily

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

daily

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

daily

This test looks for JS error in the browser console falling in server category
7 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
8 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/
9 givenTheArticleWithSeries_whenArticleLoads_thenPluginLoadsProperly

daily

Verifies the series plugin on the following page - http://www.baeldung.com/spring-security-registration
10 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
11 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
12 givenThePageWithGoogleAnalytics_whenPageLoads_thenPageHasAnalyticsCode

daily

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

daily

Baeldung feed URL - http://www.baeldung.com/feed/ should redirect to http://feeds.feedburner.com/Baeldung
14 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/
15 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
16 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/
17 givenOnTheHomePage_whenPageLoads_thenItHasOneAboutMenuInTheFooter

daily

The test verifies that exactly one ABOUT menu is available in the footer of homepage
18 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
19 givenTheArticleWithFixedWidget_whenArticleLoads_thenStopIDIsConfiguredCorrectly

daily

This test verifies that the stop ID value is set as footer in the fixed widget settings. Post tested - http://www.baeldung.com/java-classloaders
20 givenThePageWithFixedWidget_whenPageLoads_thenStopIDIsConfiguredCorrectly

daily

This test verifies that the stop ID value is set as footer in the fixed widget settings. Page tested - http://www.baeldung.com/spring-tutorial
21 givenTheArticleWithTheStickySidebar_whenTheArticleLoads_thenTheContainerClassProptertyIsConfiguredCorrectly

daily

This test verifies that the Container Class property is set to #Content in the Sticky Sidebar plugin . Post tested - http://www.baeldung.com/java-classloaders
22 givenThePageWithTheStickySidebar_whenThePageLoads_thenTheContainerClassProptertyIsConfiguredCorrectly

daily

This test verifies that the Container Class property is set to #Content in the Sticky Sidebar plugin. Page tested - http://www.baeldung.com/spring-tutorial
23 givenOnTheHomePage_whenTheSurveyStarts_thenTheSelectValueIsPostedToTheDrip

weekly

This test verifies that the drip survey is working fine.
24 givenAllArticlesURLs_whenArticleLoads_thenItReturns200OK

weekly

Loops over full list of posts and verifies that 200OK is returned
25 givenAllPagesURLs_whenPageLoads_thenItReturns200OK

weekly

Loops over full list of pages and verifies that 200OK is returned
26 givenAllArticleList_whenArticleLoads_thenItHasSingleShortcodeAtTheTop

twice-a-month

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

twice-a-month

Test verifies that a single short code is available at the start of every page
28 givenAllTheArticles_whenArticleLoads_thenArticleHasNoEmptyDiv

twice-a-month

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

twice-a-month

Verifies that the images in the posts point to live env
30 givenAllThePages_whenPageLoads_thenImagesPointToCorrectEnv

twice-a-month

Verifies that the images in the pages point to live env
31 givenAllArticles_whenTheArticleLoads_thenTheMetaDescriptionExists

twice-a-month

This test verifies that all posts have meta description defined
32 givenAllPages_whenPageLods_thenTheMetaDescriptionExists

twice-a-month

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

twice-a-month

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)
34 givenAllTheArticles_whenAnArticleLoads_thenTheAuthorIsNotFromTheExcludedList

twice-a-month

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
35 givenAnArticleWithTheDripScript_whenTheArticleLoads_thenTheArticleHasTheDripScrip

daily

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

daily

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

daily

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

daily

This test loads http://baeldung.com/learn-spring-security-course/ with EU proxy and verifies that VAT prices are available
39 givenTheGitHubModuleReadme_theArticlesLinkedInTheGitHubMouduleLinkForwardTotheSameGitHubModule

monthly

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

monthly

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.

Releases

No releases published

Packages

No packages published

Languages

  • Java 100.0%