lor6 / blogwatch

blogwatch

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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 givenOnTheTeamOptInPage_whenTheGetAccessButtonIsClicked_thenTheOptInsPopupsWorkFine

daily

This test verifies optin popups in the following article - https://www.baeldung.com/rest-with-spring-for-teams-kinsta-test
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
0 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 givenAllArticlesURLs_whenArticleLoads_thenItReturns200OK

weekly

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

weekly

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

twice-a-month

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

twice-a-month

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

twice-a-month

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

twice-a-month

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

twice-a-month

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

twice-a-month

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

twice-a-month

This test verifies that all pages have meta description defined
27 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)
28 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
29 givenAnArticleWithTheDripScript_whenTheArticleLoads_thenTheArticleHasTheDripScrip

daily

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

daily

Verifies the Drip script on https://baeldung.com/spring-tutorial
31 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
32 givenOnTheCoursePage_whenThePageLoadsInEUCountry_thenTheVATPricesAreShown

daily

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

monthly

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.
34 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.
35 givenAllTheArticles_whenAnArticleLoads_thenMetaOGImageAndTwitterImagePointToTheAbsolutePath

twice-a-month

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

twice-a-month

This test verifies that mage links in the og:image and twitter:image parameters are absolute. The test runs on all the pages
37 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
38 givenOnCoursePages_whenAPageLoads_thenItContainsImportantAnchors

daily

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

About

blogwatch


Languages

Language:Java 100.0%